From: NeilBrown Date: Mon, 13 Sep 2010 05:07:27 +0000 (+1000) Subject: Remove pinning of iblock in place of dblock X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=f1c05293bfdad2a7de0f5ae6c0cfc16a0d68f71c;p=LaFS.git Remove pinning of iblock in place of dblock We now allow both iblock and dblock to be pinned at the same time. So when pinning the inode dblock, just do it and don't go bothering the inode iblock. Signed-off-by: NeilBrown --- diff --git a/block.c b/block.c index 58af84d..6387647 100644 --- a/block.c +++ b/block.c @@ -462,26 +462,6 @@ lafs_pin_dblock(struct datablock *b, int alloc_type) */ int err; struct fs *fs = fs_from_inode(b->b.inode); - struct block *blk; - struct inode *ino = NULL; - - /* We don't pin a datablock of an inode if there is an - * InoIdx block. We pin the InoIdx block instead. - * They might both be pinned at the same time, but - * only when the index block has swapped phase and the - * data block is waiting to be written. - */ - if ((ino = rcu_my_inode(b)) != NULL && - LAFSI(ino)->iblock) { - struct indexblock *ib = lafs_make_iblock(ino, ADOPT, SYNC, - MKREF(pindb)); - if (IS_ERR(ib)) - blk = getref(&b->b, MKREF(pindb)); - else - blk = &ib->b; - } else - blk = getref(&b->b, MKREF(pindb)); - rcu_iput(ino); LAFS_BUG(!test_bit(B_PinPending, &b->b.flags), &b->b); if (LAFSI(b->b.inode)->type != TypeSegmentMap) { @@ -492,8 +472,7 @@ lafs_pin_dblock(struct datablock *b, int alloc_type) * been written and we want to flip it before it * can be dirtied. */ - if (blk == &b->b && - test_bit(B_Pinned, &b->b.flags) && + if (test_bit(B_Pinned, &b->b.flags) && !!test_bit(B_Phase1, &b->b.flags) != fs->phase) { clear_bit(B_PinPending, &b->b.flags); lafs_refile(&b->b, 0); @@ -502,15 +481,12 @@ lafs_pin_dblock(struct datablock *b, int alloc_type) lafs_iounlock_block(&b->b); } - err = lafs_reserve_block(blk, alloc_type); + err = lafs_reserve_block(&b->b, alloc_type); - if (err) { - putref(blk, MKREF(pindb)); + if (err) return err; - } - lafs_pin_block(blk); - putref(blk, MKREF(pindb)); + lafs_pin_block(&b->b); return 0; }