[Sheepdog] [PATCH] sheep: fix nr_copies calculation in delete_one

Christoph Hellwig hch at infradead.org
Sun Apr 29 13:49:15 CEST 2012


We can only use inode->nr_copies as a lower ceiling for the number of copies
once inode actually is read in.  This fixes a merge error and makes sure this
code behaves the same way as before "sheep: cleanup nr_copies handling".

Signed-off-by: Christoph Hellwig <hch at lst.de>

diff --git a/sheep/vdi.c b/sheep/vdi.c
index 0788f26..3885384 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -457,8 +457,6 @@ static void delete_one(struct work *work)
 	}
 
 	nr_copies = get_nr_copies(dw->vnodes);
-	if (nr_copies > inode->nr_copies)
-		nr_copies = inode->nr_copies;
 
 	ret = read_object(dw->vnodes, dw->epoch, vid_to_vdi_oid(vdi_id),
 			  (void *)inode, sizeof(*inode),
@@ -469,6 +467,9 @@ static void delete_one(struct work *work)
 		goto out;
 	}
 
+	if (nr_copies > inode->nr_copies)
+		nr_copies = inode->nr_copies;
+
 	for (i = 0; i < MAX_DATA_OBJS; i++) {
 		if (!inode->data_vdi_id[i])
 			continue;



More information about the sheepdog mailing list