]> git.neil.brown.name Git - LaFS.git/commitdiff
checkpin: don't hold references on primary superblock.
authorNeilBrown <neilb@suse.de>
Fri, 4 Mar 2011 23:44:23 +0000 (10:44 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 4 Mar 2011 23:44:23 +0000 (10:44 +1100)
This isn't really a need to hold a reference on the primary
superblock as everything else does and when the last reference goes
it will stop the cleaner so these references won't be needed any.

This is only an interim solution - we will be removing the
multiple superblocks soon and all this will go away.

Signed-off-by: NeilBrown <neilb@suse.de>
inode.c

diff --git a/inode.c b/inode.c
index 59979b7ceb79cf26a6b5929fe7af46f2e4939bcd..50ecf31829c6f81828c9a4b2613876add16ef4e4 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -648,8 +648,12 @@ void lafs_inode_checkpin(struct inode *ino)
         */
        if (ino->i_nlink == 0) {
                /* I_Pinned should not be set */
-               if (test_and_clear_bit(I_Pinned, &LAFSI(ino)->iflags))
-                       lafs_iput_fs(ino);
+               if (test_and_clear_bit(I_Pinned, &LAFSI(ino)->iflags)) {
+                       if (ino->i_sb->s_type == &lafs_fs_type)
+                               iput(ino);
+                       else
+                               lafs_iput_fs(ino);
+               }
        } else {
                /* Need to check if iblock is Pinned. */
                struct indexblock *ib = NULL;
@@ -661,11 +665,19 @@ void lafs_inode_checkpin(struct inode *ino)
                        spin_unlock(&ino->i_data.private_lock);
                }
                if (ib) {
-                       if (!test_and_set_bit(I_Pinned, &LAFSI(ino)->iflags))
-                               lafs_igrab_fs(ino);
+                       if (!test_and_set_bit(I_Pinned, &LAFSI(ino)->iflags)) {
+                               if (ino->i_sb->s_type == &lafs_fs_type)
+                                       igrab(ino);
+                               else
+                                       lafs_igrab_fs(ino);
+                       }
                } else {
-                       if (test_and_clear_bit(I_Pinned, &LAFSI(ino)->iflags))
+                       if (test_and_clear_bit(I_Pinned, &LAFSI(ino)->iflags)) {
+                       if (ino->i_sb->s_type == &lafs_fs_type)
+                               iput(ino);
+                       else
                                lafs_iput_fs(ino);
+                       }
                }
        }
 }