]> git.neil.brown.name Git - LaFS.git/commitdiff
Remove pinning of iblock in place of dblock
authorNeilBrown <neilb@suse.de>
Mon, 13 Sep 2010 05:07:27 +0000 (15:07 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 13 Sep 2010 05:16:00 +0000 (15:16 +1000)
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 <neilb@suse.de>
block.c

diff --git a/block.c b/block.c
index 58af84de5b3ba791083fdf355e98ff3aff44c1ad..638764798198b2bb51ed3714f7aecfad6e70c734 100644 (file)
--- 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;
 }