afs/fs/cachefs recycling.c,1.29,1.30

dwh at infradead.org dwh at infradead.org
Fri Jul 18 10:53:57 BST 2003


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

Modified Files:
	recycling.c 
Log Message:
don't want reclaimed block to end up being a new recycling node _and_ also its
first dependent child


Index: recycling.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/recycling.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- recycling.c	17 Jul 2003 12:02:13 -0000	1.29
+++ recycling.c	18 Jul 2003 08:53:54 -0000	1.30
@@ -32,11 +32,9 @@
  */
 static int cachefs_recycle_begin_new_node(struct cachefs_super *super,
 					  cachefs_blockix_t bix,
-					  cachefs_blockix_t upblock,
-					  unsigned short upentry)
+					  struct cachefs_transaction *trans)
 {
 	struct cachefs_ondisc_free_node *node;
-	struct cachefs_transaction *trans;
 	struct cachefs_block *block;
 	struct page *page;
 	char used_unready_node = 0;
@@ -64,10 +62,12 @@
 	}
 
 	/* journal what we're going to do */
-	ret = -ENOMEM;
-	trans = cachefs_trans_alloc(super, GFP_KERNEL);
-	if (!trans)
-		goto error_rel_block;
+	if (!trans) {
+		ret = -ENOMEM;
+		trans = cachefs_trans_alloc(super, GFP_KERNEL);
+		if (!trans)
+			goto error_rel_block;
+	}
 
 	cachefs_trans_affects_block(trans, block, 0, PAGE_SIZE);
 
@@ -81,8 +81,6 @@
 	trans->jentry->index	= super->recycle_cur;
 	trans->jentry->ixentry	= super->recycle_cur_n;
 	trans->jentry->block	= bix;
-	trans->jentry->upblock	= upblock;
-	trans->jentry->upentry	= upentry;
 
 	trans->jentry->pgnum =
 		super->layout->bix_unready + used_unready_node;
@@ -90,11 +88,6 @@
 	trans->changed |= CACHEFS_TRANS_CHANGED_RECYCLE;
 	trans->jentry->recycle_cur = bix;
 
-	if (upblock) {
-		trans->changed |= CACHEFS_TRANS_CHANGED_RCMPTR;
-		trans->jentry->rcm_ptrnext = upentry;
-	}
-
 	/* mark the beginning of the operation */
 	ret = cachefs_trans_mark(trans);
 	if (ret<0)
@@ -150,7 +143,7 @@
 	 * consume the next unready block to set up a new one
 	 */
 	if (super->recycle_room == 0)
-		cachefs_recycle_begin_new_node(super, 0, 0, 0);
+		cachefs_recycle_begin_new_node(super, 0, NULL);
 
 	qty = super->layout->bix_end - super->layout->bix_unready;
 	if (qty == 0) {
@@ -394,14 +387,19 @@
 	goto out;
 
  found:
-	/* make sure there's a recycling block with space available */
+	trans = *_trans;
+
+	/* make sure there's a recycling node with space available */
 	if (super->recycle_room == 0) {
+		trans->jentry->upblock		= super->rcm_block;
+		trans->jentry->upentry		= src;
+		trans->jentry->rcm_ptrnext	= src + 1;
+
 		ret = cachefs_recycle_begin_new_node(super, indirect[src],
-						     super->rcm_block, src);
+						     trans);
+		*_trans = NULL;
 		goto out;
 	}
-
-	trans = *_trans;
 
 	cachefs_trans_affects_block(trans, super->recycle_block, 0, PAGE_SIZE);
 




More information about the linux-afs-cvs mailing list