mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dirk Henning Gerdes <mail@dirk-gerdes.de>
To: Jens Axboe <axboe@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/4] linux-2.6-block: deactivating pagecache for benchmarks
Date: Thu, 01 Dec 2005 14:23:20 +0100	[thread overview]
Message-ID: <1133443400.6110.39.camel@noti> (raw)

the code for the /proc/benchmark/pagecache

Signed-Off-By: Dirk Gerdes <mail@dirk-gerdes.de>
---

--- linux-2.6-block_clean/block/pagecache.c	2005-12-01
12:24:30.000000000 +0100
+++ linux-2.6-block-pagecache-clean/block/pagecache.c	2005-11-30 17:14:40.000000000 +0100
@@ -0,0 +1,75 @@
+#include <linux/module.h>
+#include <linux/proc_fs.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <asm/uaccess.h>
+//#include <linux/pagecache.h>
+
+
+MODULE_LICENSE("GPL");
+
+extern int pagecache;
+
+
+static struct proc_dir_entry 	*benchmark_dir, 
+				*pagecache_entry;
+		
+				
+				
+
+			
+				
+static int pagecache_entry_read(char *buf, char **start,off_t offset,int size, int *eof, void *data)
+{
+	int bytes_written = 0;
+	if (pagecache) 
+		bytes_written = snprintf(buf, size, "[on] off\n");
+	else
+		bytes_written = snprintf(buf, size, " on [off]\n");
+	return bytes_written;
+}
+
+static int pagecache_entry_write(struct file * instanz, const char __user *userbuffer, unsigned long count, void *data)
+{	
+	char *kernel_buffer;
+	int not_copied;
+		
+	kernel_buffer = kmalloc(count, GFP_KERNEL);
+	if (!kernel_buffer)
+		return -ENOMEM;
+	not_copied = copy_from_user(kernel_buffer, userbuffer, count);
+	if (strncmp (kernel_buffer,"on",2)==0){
+	 	pagecache=1;
+	}
+	else if (strncmp (kernel_buffer,"off",3)==0){
+		pagecache=0;
+	}
+
+	kfree(kernel_buffer);
+	return count-not_copied;
+}
+
+static int __init my_init(void)
+{
+	
+	
+	benchmark_dir = proc_mkdir("benchmark",NULL);
+	pagecache_entry = create_proc_entry("pagecache",S_IRUGO, benchmark_dir);
+	if (pagecache_entry){
+		pagecache_entry->read_proc  = pagecache_entry_read;
+		pagecache_entry->write_proc = pagecache_entry_write;
+		
+		pagecache_entry->data      = NULL;	
+	}
+	
+	return 0;
+}
+static void __exit my_exit(void){
+	if (pagecache_entry) 	remove_proc_entry("pagecache",benchmark_dir);
+	if (benchmark_dir)	remove_proc_entry("benchmark",NULL);
+}
+
+
+module_init(my_init);
+module_exit(my_exit);
+


                 reply	other threads:[~2005-12-01 13:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1133443400.6110.39.camel@noti \
    --to=mail@dirk-gerdes.de \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®