@@ -2109,7 +2109,6 @@ struct btrfs_ioctl_defrag_range_args {
#define BTRFS_MOUNT_CHECK_INTEGRITY_INCLUDING_EXTENT_DATA (1 << 21)
#define BTRFS_MOUNT_PANIC_ON_FATAL_ERROR (1 << 22)
#define BTRFS_MOUNT_RESCAN_UUID_TREE (1 << 23)
-#define BTRFS_MOUNT_CHANGE_INODE_CACHE (1 << 24)
#define BTRFS_DEFAULT_COMMIT_INTERVAL (30)
#define BTRFS_DEFAULT_MAX_INLINE (8192)
@@ -2832,10 +2832,6 @@ retry_root_backup:
btrfs_set_opt(fs_info->mount_opt, SSD);
}
- /* Set the real inode map cache flag */
- if (btrfs_test_opt(tree_root, CHANGE_INODE_CACHE))
- btrfs_set_opt(tree_root->fs_info->mount_opt, INODE_MAP_CACHE);
-
#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
if (btrfs_test_opt(tree_root, CHECK_INTEGRITY)) {
ret = btrfsic_mount(tree_root, fs_devices,
@@ -3348,7 +3348,7 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root,
struct btrfs_free_space_ctl *ctl = root->free_ino_ctl;
int ret;
- if (!btrfs_test_opt(root, INODE_MAP_CACHE))
+ if (!btrfs_test_trans_opt(trans, INODE_MAP_CACHE))
return 0;
ret = __btrfs_write_out_cache(root, inode, ctl, NULL, trans, path, 0);
@@ -178,7 +178,8 @@ static void start_caching(struct btrfs_root *root)
root->root_key.objectid);
if (IS_ERR(tsk)) {
btrfs_warn(root->fs_info, "failed to start inode caching task");
- btrfs_clear_and_info(root, CHANGE_INODE_CACHE,
+ btrfs_clear_and_info(root->fs_info, root->fs_info->mount_opt,
+ INODE_MAP_CACHE,
"disabling inode map caching");
}
}
@@ -405,7 +406,7 @@ int btrfs_save_ino_cache(struct btrfs_root *root,
if (btrfs_root_refs(&root->root_item) == 0)
return 0;
- if (!btrfs_test_opt(root, INODE_MAP_CACHE))
+ if (!btrfs_test_trans_opt(trans, INODE_MAP_CACHE))
return 0;
path = btrfs_alloc_path();
@@ -1939,15 +1939,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
goto scrub_continue;
}
- /*
- * Since the transaction is done, we should set the inode map cache flag
- * before any other comming transaction.
- */
- if (btrfs_test_opt(root, CHANGE_INODE_CACHE))
- btrfs_set_opt(root->fs_info->mount_opt, INODE_MAP_CACHE);
- else
- btrfs_clear_opt(root->fs_info->mount_opt, INODE_MAP_CACHE);
-
/* commit_fs_roots gets rid of all the tree log roots, it is now
* safe to free the root of tree log roots
*/
Convert btrfs_test_opt() to btrfs_test_trans_opt() if it's called under transaction protection. This will ensure SPACE_CACHE bit is consistent during transaction. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> --- Changelog: v3: Newly introduced. v4~v5: None --- fs/btrfs/ctree.h | 1 - fs/btrfs/disk-io.c | 4 ---- fs/btrfs/free-space-cache.c | 2 +- fs/btrfs/inode-map.c | 5 +++-- fs/btrfs/transaction.c | 9 --------- 5 files changed, 4 insertions(+), 17 deletions(-)