afs/fs/cachefs status.c,1.5,1.6

dwh at infradead.org dwh at infradead.org
Mon Jun 9 15:38:24 BST 2003


Update of /home/cvs/afs/fs/cachefs
In directory phoenix.infradead.org:/tmp/cvs-serv8649/fs/cachefs

Modified Files:
	status.c 
Log Message:
make write to /cachefs/status cause a dump of extant cache_block structs


Index: status.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/status.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- status.c	2 Apr 2003 09:12:31 -0000	1.5
+++ status.c	9 Jun 2003 13:38:21 -0000	1.6
@@ -21,6 +21,7 @@
 #include "cachefs-int.h"
 
 static int cachefs_status_open(struct inode *inode, struct file *file);
+static ssize_t cachefs_status_write(struct file *, const char __user *, size_t, loff_t *);
 static void *cachefs_status_start(struct seq_file *p, loff_t *pos);
 static void *cachefs_status_next(struct seq_file *p, void *v, loff_t *pos);
 static void cachefs_status_stop(struct seq_file *p, void *v);
@@ -39,6 +40,7 @@
 struct file_operations cachefs_status_file_operations = {
 	.open		= cachefs_status_open,
 	.read		= seq_read,
+	.write		= cachefs_status_write,
 	.llseek		= seq_lseek,
 	.release	= seq_release,
 };
@@ -156,3 +158,52 @@
 
 	return 0;
 } /* end cachefs_status_show() */
+
+/*****************************************************************************/
+/*
+ * 
+ */
+static ssize_t cachefs_status_write(struct file *file, const char __user *data, size_t size,
+				    loff_t *pos)
+{
+	struct cachefs_super *super;
+	struct cachefs_block *block, *xblock;
+	struct rb_node *_rb;
+	unsigned long flags;
+	struct inode *inode;
+
+	inode = file->f_dentry->d_inode;
+	super = inode->i_sb->s_fs_info;
+
+	xblock = NULL;
+	read_lock_irqsave(&super->blk_tree_lock,flags);
+
+	_rb = rb_first(&super->blk_tree);
+	while (_rb) {
+		block = rb_entry(_rb,struct cachefs_block,lookup_node);
+
+		if (block->page) {
+			cachefs_block_get(block);
+
+			read_unlock_irqrestore(&super->blk_tree_lock,flags);
+			cachefs_block_put(xblock);
+
+			printk("- block %05d u=%d fl=%08lx pg=%p wb=%p r=%p\n",
+			       block->bix,
+			       atomic_read(&block->usage) - 1,
+			       block->flags,
+			       block->page,
+			       block->writeback,
+			       block->ref);
+
+			read_lock_irqsave(&super->blk_tree_lock,flags);
+			xblock = block;
+		}
+		_rb = rb_next(_rb);
+	}
+
+	read_unlock_irqrestore(&super->blk_tree_lock,flags);
+	cachefs_block_put(xblock);
+
+	return size;
+} /* end cachefs_status_write() */




More information about the linux-afs-cvs mailing list