btrfs: clear space cache inode generation always
[pandora-kernel.git] / fs / btrfs / extent-tree.c
index da528f8..57c4ad3 100644 (file)
@@ -2759,13 +2759,6 @@ again:
                goto again;
        }
 
                goto again;
        }
 
-       /* We've already setup this transaction, go ahead and exit */
-       if (block_group->cache_generation == trans->transid &&
-           i_size_read(inode)) {
-               dcs = BTRFS_DC_SETUP;
-               goto out_put;
-       }
-
        /*
         * We want to set the generation to 0, that way if anything goes wrong
         * from here on out we know not to trust this cache when we load up next
        /*
         * We want to set the generation to 0, that way if anything goes wrong
         * from here on out we know not to trust this cache when we load up next
@@ -2775,6 +2768,13 @@ again:
        ret = btrfs_update_inode(trans, root, inode);
        WARN_ON(ret);
 
        ret = btrfs_update_inode(trans, root, inode);
        WARN_ON(ret);
 
+       /* We've already setup this transaction, go ahead and exit */
+       if (block_group->cache_generation == trans->transid &&
+           i_size_read(inode)) {
+               dcs = BTRFS_DC_SETUP;
+               goto out_put;
+       }
+
        if (i_size_read(inode) > 0) {
                ret = btrfs_truncate_free_space_cache(root, trans, path,
                                                      inode);
        if (i_size_read(inode) > 0) {
                ret = btrfs_truncate_free_space_cache(root, trans, path,
                                                      inode);