Loading fs/btrfs/ctree.h +1 −0 Original line number Diff line number Diff line Loading @@ -1340,6 +1340,7 @@ struct btrfs_ioctl_defrag_range_args { #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) #define BTRFS_MOUNT_ENOSPC_DEBUG (1 << 15) #define BTRFS_MOUNT_AUTO_DEFRAG (1 << 16) #define BTRFS_MOUNT_INODE_MAP_CACHE (1 << 17) #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) Loading fs/btrfs/free-space-cache.c +6 −0 Original line number Diff line number Diff line Loading @@ -2536,6 +2536,9 @@ int load_free_ino_cache(struct btrfs_fs_info *fs_info, struct btrfs_root *root) int ret = 0; u64 root_gen = btrfs_root_generation(&root->root_item); if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; /* * If we're unmounting then just return, since this does a search on the * normal root and not the commit root and we could deadlock. Loading Loading @@ -2575,6 +2578,9 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, struct inode *inode; int ret; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; inode = lookup_free_ino_inode(root, path); if (IS_ERR(inode)) return 0; Loading fs/btrfs/inode-map.c +20 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ static int caching_kthread(void *data) int slot; int ret; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; path = btrfs_alloc_path(); if (!path) return -ENOMEM; Loading Loading @@ -141,6 +144,9 @@ static void start_caching(struct btrfs_root *root) int ret; u64 objectid; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return; spin_lock(&root->cache_lock); if (root->cached != BTRFS_CACHE_NO) { spin_unlock(&root->cache_lock); Loading Loading @@ -178,6 +184,9 @@ static void start_caching(struct btrfs_root *root) int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid) { if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return btrfs_find_free_objectid(root, objectid); again: *objectid = btrfs_find_ino_for_alloc(root); Loading @@ -201,6 +210,10 @@ void btrfs_return_ino(struct btrfs_root *root, u64 objectid) { struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; struct btrfs_free_space_ctl *pinned = root->free_ino_pinned; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return; again: if (root->cached == BTRFS_CACHE_FINISHED) { __btrfs_add_free_space(ctl, objectid, 1); Loading Loading @@ -250,6 +263,9 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) struct rb_node *n; u64 count; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return; while (1) { n = rb_first(rbroot); if (!n) Loading Loading @@ -399,9 +415,13 @@ int btrfs_save_ino_cache(struct btrfs_root *root, root != root->fs_info->tree_root) return 0; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; path = btrfs_alloc_path(); if (!path) return -ENOMEM; again: inode = lookup_free_ino_inode(root, path); if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) { Loading fs/btrfs/super.c +7 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,8 @@ enum { Opt_compress_type, Opt_compress_force, Opt_compress_force_type, Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_err, Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_inode_cache, Opt_err, }; static match_table_t tokens = { Loading Loading @@ -192,6 +193,7 @@ static match_table_t tokens = { {Opt_enospc_debug, "enospc_debug"}, {Opt_subvolrootid, "subvolrootid=%d"}, {Opt_defrag, "autodefrag"}, {Opt_inode_cache, "inode_cache"}, {Opt_err, NULL}, }; Loading Loading @@ -360,6 +362,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) printk(KERN_INFO "btrfs: enabling disk space caching\n"); btrfs_set_opt(info->mount_opt, SPACE_CACHE); break; case Opt_inode_cache: printk(KERN_INFO "btrfs: enabling inode map caching\n"); btrfs_set_opt(info->mount_opt, INODE_MAP_CACHE); break; case Opt_clear_cache: printk(KERN_INFO "btrfs: force clearing of disk cache\n"); btrfs_set_opt(info->mount_opt, CLEAR_CACHE); Loading Loading
fs/btrfs/ctree.h +1 −0 Original line number Diff line number Diff line Loading @@ -1340,6 +1340,7 @@ struct btrfs_ioctl_defrag_range_args { #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) #define BTRFS_MOUNT_ENOSPC_DEBUG (1 << 15) #define BTRFS_MOUNT_AUTO_DEFRAG (1 << 16) #define BTRFS_MOUNT_INODE_MAP_CACHE (1 << 17) #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) Loading
fs/btrfs/free-space-cache.c +6 −0 Original line number Diff line number Diff line Loading @@ -2536,6 +2536,9 @@ int load_free_ino_cache(struct btrfs_fs_info *fs_info, struct btrfs_root *root) int ret = 0; u64 root_gen = btrfs_root_generation(&root->root_item); if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; /* * If we're unmounting then just return, since this does a search on the * normal root and not the commit root and we could deadlock. Loading Loading @@ -2575,6 +2578,9 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, struct inode *inode; int ret; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; inode = lookup_free_ino_inode(root, path); if (IS_ERR(inode)) return 0; Loading
fs/btrfs/inode-map.c +20 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ static int caching_kthread(void *data) int slot; int ret; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; path = btrfs_alloc_path(); if (!path) return -ENOMEM; Loading Loading @@ -141,6 +144,9 @@ static void start_caching(struct btrfs_root *root) int ret; u64 objectid; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return; spin_lock(&root->cache_lock); if (root->cached != BTRFS_CACHE_NO) { spin_unlock(&root->cache_lock); Loading Loading @@ -178,6 +184,9 @@ static void start_caching(struct btrfs_root *root) int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid) { if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return btrfs_find_free_objectid(root, objectid); again: *objectid = btrfs_find_ino_for_alloc(root); Loading @@ -201,6 +210,10 @@ void btrfs_return_ino(struct btrfs_root *root, u64 objectid) { struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; struct btrfs_free_space_ctl *pinned = root->free_ino_pinned; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return; again: if (root->cached == BTRFS_CACHE_FINISHED) { __btrfs_add_free_space(ctl, objectid, 1); Loading Loading @@ -250,6 +263,9 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) struct rb_node *n; u64 count; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return; while (1) { n = rb_first(rbroot); if (!n) Loading Loading @@ -399,9 +415,13 @@ int btrfs_save_ino_cache(struct btrfs_root *root, root != root->fs_info->tree_root) return 0; if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; path = btrfs_alloc_path(); if (!path) return -ENOMEM; again: inode = lookup_free_ino_inode(root, path); if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) { Loading
fs/btrfs/super.c +7 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,8 @@ enum { Opt_compress_type, Opt_compress_force, Opt_compress_force_type, Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_err, Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_inode_cache, Opt_err, }; static match_table_t tokens = { Loading Loading @@ -192,6 +193,7 @@ static match_table_t tokens = { {Opt_enospc_debug, "enospc_debug"}, {Opt_subvolrootid, "subvolrootid=%d"}, {Opt_defrag, "autodefrag"}, {Opt_inode_cache, "inode_cache"}, {Opt_err, NULL}, }; Loading Loading @@ -360,6 +362,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) printk(KERN_INFO "btrfs: enabling disk space caching\n"); btrfs_set_opt(info->mount_opt, SPACE_CACHE); break; case Opt_inode_cache: printk(KERN_INFO "btrfs: enabling inode map caching\n"); btrfs_set_opt(info->mount_opt, INODE_MAP_CACHE); break; case Opt_clear_cache: printk(KERN_INFO "btrfs: force clearing of disk cache\n"); btrfs_set_opt(info->mount_opt, CLEAR_CACHE); Loading