]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: put the block group cache after we commit the super
authorJosef Bacik <josef@redhat.com>
Mon, 29 Aug 2011 18:06:00 +0000 (14:06 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 02:20:19 +0000 (21:20 -0500)
In moving some enospc stuff around I noticed that when we unmount we are often
evicting the free space cache inodes before we do our last commit.  This isn't
bad, but it makes us constantly have to re-read the inodes back.  So instead
don't evict the cache until after we do our last commit, this will make things a
little less crappy and makes a future enospc change work properly.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
(cherry picked from commit 300e4f8a56f263797568c95b71c949f9f02e4534)

fs/btrfs/disk-io.c
fs/btrfs/free-space-cache.c

index 3a21da1f13c3aa95e0ad6debfc1837c0511c1c0a..fb85fcd563a2e795d70057b1b791a1e5ec0a487d 100644 (file)
@@ -2623,8 +2623,6 @@ int close_ctree(struct btrfs_root *root)
        /* clear out the rbtree of defraggable inodes */
        btrfs_run_defrag_inodes(root->fs_info);
 
-       btrfs_put_block_group_cache(fs_info);
-
        /*
         * Here come 2 situations when btrfs is broken to flip readonly:
         *
@@ -2650,6 +2648,8 @@ int close_ctree(struct btrfs_root *root)
                        printk(KERN_ERR "btrfs: commit super ret %d\n", ret);
        }
 
+       btrfs_put_block_group_cache(fs_info);
+
        kthread_stop(root->fs_info->transaction_kthread);
        kthread_stop(root->fs_info->cleaner_kthread);
 
index 701ef5951e3f3523ff6e2f70700ab02e81a75d72..1ea10731797add6b5e3c5119074af5dfc7d79c9e 100644 (file)
@@ -105,7 +105,7 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,
                block_group->disk_cache_state = BTRFS_DC_CLEAR;
        }
 
-       if (!btrfs_fs_closing(root->fs_info)) {
+       if (!block_group->iref) {
                block_group->inode = igrab(inode);
                block_group->iref = 1;
        }