Btrfs: kill max_extent mount option
PATCH 1/1 Btrfs: kill max_extent mount option
As Yan pointed out, theres not much reason for all this complicated math to account for file extents being split up into max_extent chunks, since they are likely to all end up in the same leaf anyway. Since there isn't much reason to use max_extent, just remove the option altogether so we have one less thing we need to test. Thanks,
--- fs/btrfs/ctree.h | 1 - fs/btrfs/disk-io.c | 1 - fs/btrfs/extent-tree.c | 4 +- fs/btrfs/inode.c | 59 +++------------------------------------------- fs/btrfs/ordered-data.c | 6 +++- fs/btrfs/super.c | 23 ++---------------- 6 files changed, 13 insertions(+), 81 deletions(-)
fs/btrfs/ctree.h +0 -1
@@ -834,7 +834,6 @@ struct btrfs_fs_info {u64 last_trans_log_full_commit;u64 open_ioctl_trans;unsigned long mount_opt; -u64 max_extent;u64 max_inline;u64 alloc_start;struct btrfs_transaction *running_transaction;
fs/btrfs/disk-io.c +0 -1
@@ -1634,7 +1634,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,atomic_set (&fs_info->async_submit_draining,0 );atomic_set (&fs_info->nr_async_bios,0 ); fs_info->sb = sb; - fs_info->max_extent = (u64)-1 ; fs_info->max_inline =8192 *1024 ; fs_info->metadata_ratio =0 ;
fs/btrfs/extent-tree.c +2 -2
@@ -2848,7 +2848,7 @@ int btrfs_unreserve_metadata_for_delalloc(struct btrfs_root *root, }spin_unlock (&BTRFS_I (inode)->accounting_lock); -BTRFS_I (inode)->reserved_extents--; +BTRFS_I (inode)->reserved_extents -= num_items;BUG_ON (BTRFS_I (inode)->reserved_extents <0 );if (meta_sinfo->bytes_delalloc < num_bytes) {
@@ -3110,7 +3110,7 @@ again:return -ENOSPC ; } -BTRFS_I (inode)->reserved_extents++; +BTRFS_I (inode)->reserved_extents += num_items;check_force_delalloc (meta_sinfo);spin_unlock (&meta_sinfo->lock);
fs/btrfs/inode.c +4 -55
116 lines not on this page · raw message
fs/btrfs/ordered-data.c +4 -2
@@ -303,6 +303,7 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, struct btrfs_ordered_extent *entry) {struct btrfs_ordered_inode_tree *tree; +struct btrfs_root *root =BTRFS_I (inode)->root;struct rb_node *node; tree = &BTRFS_I (inode)->ordered_tree;
@@ -312,12 +313,13 @@ static int __btrfs_remove_ordered_extent(struct inode *inode,set_bit (BTRFS_ORDERED_COMPLETE , &entry->flags);spin_lock (&BTRFS_I (inode)->accounting_lock); +WARN_ON (!BTRFS_I (inode)->outstanding_extents);BTRFS_I (inode)->outstanding_extents--;spin_unlock (&BTRFS_I (inode)->accounting_lock);btrfs_unreserve_metadata_for_delalloc (BTRFS_I (inode)->root, inode,1 ); -spin_lock (&BTRFS_I (inode)->root->fs_info->ordered_extent_lock); +spin_lock (&root->fs_info->ordered_extent_lock);list_del_init (&entry->root_extent_list);/*
@@ -329,7 +331,7 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY)) {list_del_init (&BTRFS_I (inode)->ordered_operations); } -spin_unlock (&BTRFS_I (inode)->root->fs_info->ordered_extent_lock); +spin_unlock (&root->fs_info->ordered_extent_lock);return 0 ; }
fs/btrfs/super.c +3 -20
@@ -64,10 +64,9 @@ static void btrfs_put_super(struct super_block *sb)enum { Opt_degraded, Opt_subvol, Opt_subvolid, Opt_device, Opt_nodatasum, - Opt_nodatacow, Opt_max_extent, Opt_max_inline, Opt_alloc_start, - Opt_nobarrier, Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, - Opt_noacl, Opt_compress, Opt_compress_force, Opt_notreelog, Opt_ratio, - Opt_flushoncommit, + Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd, + Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, + Opt_compress_force, Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, Opt_err, };
@@ -79,7 +78,6 @@ static match_table_t tokens = { {Opt_nodatasum, "nodatasum"}, {Opt_nodatacow, "nodatacow"}, {Opt_nobarrier, "nobarrier"}, - {Opt_max_extent, "max_extent=%s"}, {Opt_max_inline, "max_inline=%s"}, {Opt_alloc_start, "alloc_start=%s"}, {Opt_thread_pool, "thread_pool=%d"},
@@ -188,18 +186,6 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) info->thread_pool_size); }break ; -case Opt_max_extent: - num =match_strdup (&args[0 ]); -if (num) { - info->max_extent =memparse (num,NULL ); -kfree (num); - - info->max_extent =max_t (u64, - info->max_extent, root->sectorsize); -printk (KERN_INFO "btrfs: max_extent at %llu\n" , - (unsigned long long )info->max_extent); - } -break ;case Opt_max_inline: num =match_strdup (&args[0 ]);if (num) {
@@ -529,9 +515,6 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)seq_puts (seq,",nodatacow" );if (btrfs_test_opt (root,NOBARRIER ))seq_puts (seq,",nobarrier" ); -if (info->max_extent != (u64)-1 ) -seq_printf (seq,",max_extent=%llu" , - (unsigned long long )info->max_extent);if (info->max_inline !=8192 *1024 )seq_printf (seq,",max_inline=%llu" , (unsigned long long )info->max_inline);
Signature · 1 line
1.6.6
Quoted 5 lines · Josef Bacik
As Yan pointed out, theres not much reason for all this complicated math to account for file extents being split up into
max_extentchunks, since they are likely to all end up in the same leaf anyway. Since there isn't much reason to usemax_extent, just remove the option altogether so we have one less thing we need to test. Thanks,
Since we sometimes have very big extents like several hundered mega bytes, just curious could removing max_extent limit cause more lock contentation for extent locks?
Thanks,
Shaohua
Quoted 8 lines · Shaohua Li
Quoted 5 lines · Josef Bacik
As Yan pointed out, theres not much reason for all this complicated math to account for file extents being split up into
max_extentchunks, since they are likely to all end up in the same leaf anyway. Since there isn't much reason to usemax_extent, just remove the option altogether so we have one less thing we need to test. Thanks,Since we sometimes have very big extents like several hundered mega bytes, just curious could removing
max_extentlimit cause more lock contentation for extent locks?
The default for the max_extent option is (u64)-1. So, in general it was meant to force smaller extents as part of testing.
-chris