提交 b713a5ec 编写于 作者: T Theodore Ts'o

ext4: remove /proc tuning knobs

Remove tuning knobs in /proc/fs/ext4/<dev/* since they have been
replaced by knobs in sysfs at /sys/fs/ext4/<dev>/*.
Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 3197ebdb
...@@ -940,27 +940,6 @@ Table 1-10: Files in /proc/fs/ext4/<devname> ...@@ -940,27 +940,6 @@ Table 1-10: Files in /proc/fs/ext4/<devname>
File Content File Content
mb_groups details of multiblock allocator buddy cache of free blocks mb_groups details of multiblock allocator buddy cache of free blocks
mb_history multiblock allocation history mb_history multiblock allocation history
stats controls whether the multiblock allocator should start
collecting statistics, which are shown during the unmount
group_prealloc the multiblock allocator will round up allocation
requests to a multiple of this tuning parameter if the
stripe size is not set in the ext4 superblock
max_to_scan The maximum number of extents the multiblock allocator
will search to find the best extent
min_to_scan The minimum number of extents the multiblock allocator
will search to find the best extent
order2_req Tuning parameter which controls the minimum size for
requests (as a power of 2) where the buddy cache is
used
stream_req Files which have fewer blocks than this tunable
parameter will have their blocks allocated out of a
block group specific preallocation pool, so that small
files are packed closely together. Each large file
will have its blocks allocated out of its own unique
preallocation pool.
inode_readahead Tuning parameter which controls the maximum number of
inode table blocks that ext4's inode table readahead
algorithm will pre-read into the buffer cache
.............................................................................. ..............................................................................
......
...@@ -976,22 +976,6 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, ...@@ -976,22 +976,6 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
extern struct proc_dir_entry *ext4_proc_root; extern struct proc_dir_entry *ext4_proc_root;
#ifdef CONFIG_PROC_FS
extern const struct file_operations ext4_ui_proc_fops;
#define EXT4_PROC_HANDLER(name, var) \
do { \
proc = proc_create_data(name, mode, sbi->s_proc, \
&ext4_ui_proc_fops, &sbi->s_##var); \
if (proc == NULL) { \
printk(KERN_ERR "EXT4-fs: can't create %s\n", name); \
goto err_out; \
} \
} while (0)
#else
#define EXT4_PROC_HANDLER(name, var)
#endif
/* /*
* Function prototypes * Function prototypes
*/ */
......
...@@ -4153,12 +4153,7 @@ static int __ext4_get_inode_loc(struct inode *inode, ...@@ -4153,12 +4153,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
unsigned num; unsigned num;
table = ext4_inode_table(sb, gdp); table = ext4_inode_table(sb, gdp);
/* Make sure s_inode_readahead_blks is a power of 2 */ /* s_inode_readahead_blks is always a power of 2 */
while (EXT4_SB(sb)->s_inode_readahead_blks &
(EXT4_SB(sb)->s_inode_readahead_blks-1))
EXT4_SB(sb)->s_inode_readahead_blks =
(EXT4_SB(sb)->s_inode_readahead_blks &
(EXT4_SB(sb)->s_inode_readahead_blks-1));
b = block & ~(EXT4_SB(sb)->s_inode_readahead_blks-1); b = block & ~(EXT4_SB(sb)->s_inode_readahead_blks-1);
if (table > b) if (table > b)
b = table; b = table;
......
...@@ -46,22 +46,23 @@ ...@@ -46,22 +46,23 @@
* The allocation request involve request for multiple number of blocks * The allocation request involve request for multiple number of blocks
* near to the goal(block) value specified. * near to the goal(block) value specified.
* *
* During initialization phase of the allocator we decide to use the group * During initialization phase of the allocator we decide to use the
* preallocation or inode preallocation depending on the size file. The * group preallocation or inode preallocation depending on the size of
* size of the file could be the resulting file size we would have after * the file. The size of the file could be the resulting file size we
* allocation or the current file size which ever is larger. If the size is * would have after allocation, or the current file size, which ever
* less that sbi->s_mb_stream_request we select the group * is larger. If the size is less than sbi->s_mb_stream_request we
* preallocation. The default value of s_mb_stream_request is 16 * select to use the group preallocation. The default value of
* blocks. This can also be tuned via * s_mb_stream_request is 16 blocks. This can also be tuned via
* /proc/fs/ext4/<partition>/stream_req. The value is represented in terms * /sys/fs/ext4/<partition>/mb_stream_req. The value is represented in
* of number of blocks. * terms of number of blocks.
* *
* The main motivation for having small file use group preallocation is to * The main motivation for having small file use group preallocation is to
* ensure that we have small file closer in the disk. * ensure that we have small files closer together on the disk.
* *
* First stage the allocator looks at the inode prealloc list * First stage the allocator looks at the inode prealloc list,
* ext4_inode_info->i_prealloc_list contain list of prealloc spaces for * ext4_inode_info->i_prealloc_list, which contains list of prealloc
* this particular inode. The inode prealloc space is represented as: * spaces for this particular inode. The inode prealloc space is
* represented as:
* *
* pa_lstart -> the logical start block for this prealloc space * pa_lstart -> the logical start block for this prealloc space
* pa_pstart -> the physical start block for this prealloc space * pa_pstart -> the physical start block for this prealloc space
...@@ -121,29 +122,29 @@ ...@@ -121,29 +122,29 @@
* list. In case of inode preallocation we follow a list of heuristics * list. In case of inode preallocation we follow a list of heuristics
* based on file size. This can be found in ext4_mb_normalize_request. If * based on file size. This can be found in ext4_mb_normalize_request. If
* we are doing a group prealloc we try to normalize the request to * we are doing a group prealloc we try to normalize the request to
* sbi->s_mb_group_prealloc. Default value of s_mb_group_prealloc is set to * sbi->s_mb_group_prealloc. Default value of s_mb_group_prealloc is
* 512 blocks. This can be tuned via * 512 blocks. This can be tuned via
* /proc/fs/ext4/<partition/group_prealloc. The value is represented in * /sys/fs/ext4/<partition/mb_group_prealloc. The value is represented in
* terms of number of blocks. If we have mounted the file system with -O * terms of number of blocks. If we have mounted the file system with -O
* stripe=<value> option the group prealloc request is normalized to the * stripe=<value> option the group prealloc request is normalized to the
* stripe value (sbi->s_stripe) * stripe value (sbi->s_stripe)
* *
* The regular allocator(using the buddy cache) support few tunables. * The regular allocator(using the buddy cache) supports few tunables.
* *
* /proc/fs/ext4/<partition>/min_to_scan * /sys/fs/ext4/<partition>/mb_min_to_scan
* /proc/fs/ext4/<partition>/max_to_scan * /sys/fs/ext4/<partition>/mb_max_to_scan
* /proc/fs/ext4/<partition>/order2_req * /sys/fs/ext4/<partition>/mb_order2_req
* *
* The regular allocator use buddy scan only if the request len is power of * The regular allocator uses buddy scan only if the request len is power of
* 2 blocks and the order of allocation is >= sbi->s_mb_order2_reqs. The * 2 blocks and the order of allocation is >= sbi->s_mb_order2_reqs. The
* value of s_mb_order2_reqs can be tuned via * value of s_mb_order2_reqs can be tuned via
* /proc/fs/ext4/<partition>/order2_req. If the request len is equal to * /sys/fs/ext4/<partition>/mb_order2_req. If the request len is equal to
* stripe size (sbi->s_stripe), we try to search for contigous block in * stripe size (sbi->s_stripe), we try to search for contigous block in
* stripe size. This should result in better allocation on RAID setup. If * stripe size. This should result in better allocation on RAID setups. If
* not we search in the specific group using bitmap for best extents. The * not, we search in the specific group using bitmap for best extents. The
* tunable min_to_scan and max_to_scan controll the behaviour here. * tunable min_to_scan and max_to_scan control the behaviour here.
* min_to_scan indicate how long the mballoc __must__ look for a best * min_to_scan indicate how long the mballoc __must__ look for a best
* extent and max_to_scanindicate how long the mballoc __can__ look for a * extent and max_to_scan indicates how long the mballoc __can__ look for a
* best extent in the found extents. Searching for the blocks starts with * best extent in the found extents. Searching for the blocks starts with
* the group specified as the goal value in allocation context via * the group specified as the goal value in allocation context via
* ac_g_ex. Each group is first checked based on the criteria whether it * ac_g_ex. Each group is first checked based on the criteria whether it
...@@ -337,8 +338,6 @@ static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, ...@@ -337,8 +338,6 @@ static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
ext4_group_t group); ext4_group_t group);
static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap, static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap,
ext4_group_t group); ext4_group_t group);
static int ext4_mb_init_per_dev_proc(struct super_block *sb);
static int ext4_mb_destroy_per_dev_proc(struct super_block *sb);
static void release_blocks_on_commit(journal_t *journal, transaction_t *txn); static void release_blocks_on_commit(journal_t *journal, transaction_t *txn);
...@@ -1978,7 +1977,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac) ...@@ -1978,7 +1977,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
/* /*
* We search using buddy data only if the order of the request * We search using buddy data only if the order of the request
* is greater than equal to the sbi_s_mb_order2_reqs * is greater than equal to the sbi_s_mb_order2_reqs
* You can tune it via /proc/fs/ext4/<partition>/order2_req * You can tune it via /sys/fs/ext4/<partition>/mb_order2_req
*/ */
if (i >= sbi->s_mb_order2_reqs) { if (i >= sbi->s_mb_order2_reqs) {
/* /*
...@@ -2753,7 +2752,6 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) ...@@ -2753,7 +2752,6 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
spin_lock_init(&lg->lg_prealloc_lock); spin_lock_init(&lg->lg_prealloc_lock);
} }
ext4_mb_init_per_dev_proc(sb);
ext4_mb_history_init(sb); ext4_mb_history_init(sb);
if (sbi->s_journal) if (sbi->s_journal)
...@@ -2836,7 +2834,6 @@ int ext4_mb_release(struct super_block *sb) ...@@ -2836,7 +2834,6 @@ int ext4_mb_release(struct super_block *sb)
free_percpu(sbi->s_locality_groups); free_percpu(sbi->s_locality_groups);
ext4_mb_history_release(sb); ext4_mb_history_release(sb);
ext4_mb_destroy_per_dev_proc(sb);
return 0; return 0;
} }
...@@ -2897,62 +2894,6 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) ...@@ -2897,62 +2894,6 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
mb_debug("freed %u blocks in %u structures\n", count, count2); mb_debug("freed %u blocks in %u structures\n", count, count2);
} }
#define EXT4_MB_STATS_NAME "stats"
#define EXT4_MB_MAX_TO_SCAN_NAME "max_to_scan"
#define EXT4_MB_MIN_TO_SCAN_NAME "min_to_scan"
#define EXT4_MB_ORDER2_REQ "order2_req"
#define EXT4_MB_STREAM_REQ "stream_req"
#define EXT4_MB_GROUP_PREALLOC "group_prealloc"
static int ext4_mb_init_per_dev_proc(struct super_block *sb)
{
#ifdef CONFIG_PROC_FS
mode_t mode = S_IFREG | S_IRUGO | S_IWUSR;
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct proc_dir_entry *proc;
if (sbi->s_proc == NULL)
return -EINVAL;
EXT4_PROC_HANDLER(EXT4_MB_STATS_NAME, mb_stats);
EXT4_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, mb_max_to_scan);
EXT4_PROC_HANDLER(EXT4_MB_MIN_TO_SCAN_NAME, mb_min_to_scan);
EXT4_PROC_HANDLER(EXT4_MB_ORDER2_REQ, mb_order2_reqs);
EXT4_PROC_HANDLER(EXT4_MB_STREAM_REQ, mb_stream_request);
EXT4_PROC_HANDLER(EXT4_MB_GROUP_PREALLOC, mb_group_prealloc);
return 0;
err_out:
remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc);
remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_proc);
return -ENOMEM;
#else
return 0;
#endif
}
static int ext4_mb_destroy_per_dev_proc(struct super_block *sb)
{
#ifdef CONFIG_PROC_FS
struct ext4_sb_info *sbi = EXT4_SB(sb);
if (sbi->s_proc == NULL)
return -EINVAL;
remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc);
remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_proc);
#endif
return 0;
}
int __init init_ext4_mballoc(void) int __init init_ext4_mballoc(void)
{ {
ext4_pspace_cachep = ext4_pspace_cachep =
...@@ -3123,7 +3064,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, ...@@ -3123,7 +3064,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
* here we normalize request for locality group * here we normalize request for locality group
* Group request are normalized to s_strip size if we set the same via mount * Group request are normalized to s_strip size if we set the same via mount
* option. If not we set it to s_mb_group_prealloc which can be configured via * option. If not we set it to s_mb_group_prealloc which can be configured via
* /proc/fs/ext4/<partition>/group_prealloc * /sys/fs/ext4/<partition>/mb_group_prealloc
* *
* XXX: should we try to preallocate more than the group has now? * XXX: should we try to preallocate more than the group has now?
*/ */
...@@ -4239,7 +4180,7 @@ static inline void ext4_mb_show_ac(struct ext4_allocation_context *ac) ...@@ -4239,7 +4180,7 @@ static inline void ext4_mb_show_ac(struct ext4_allocation_context *ac)
* file is determined by the current size or the resulting size after * file is determined by the current size or the resulting size after
* allocation which ever is larger * allocation which ever is larger
* *
* One can tune this size via /proc/fs/ext4/<partition>/stream_req * One can tune this size via /sys/fs/ext4/<partition>/mb_stream_req
*/ */
static void ext4_mb_group_or_file(struct ext4_allocation_context *ac) static void ext4_mb_group_or_file(struct ext4_allocation_context *ac)
{ {
......
...@@ -579,7 +579,6 @@ static void ext4_put_super(struct super_block *sb) ...@@ -579,7 +579,6 @@ static void ext4_put_super(struct super_block *sb)
ext4_commit_super(sb, es, 1); ext4_commit_super(sb, es, 1);
} }
if (sbi->s_proc) { if (sbi->s_proc) {
remove_proc_entry("inode_readahead_blks", sbi->s_proc);
remove_proc_entry(sb->s_id, ext4_proc_root); remove_proc_entry(sb->s_id, ext4_proc_root);
} }
kobject_del(&sbi->s_kobj); kobject_del(&sbi->s_kobj);
...@@ -2529,11 +2528,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2529,11 +2528,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (ext4_proc_root) if (ext4_proc_root)
sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root); sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root);
if (sbi->s_proc)
proc_create_data("inode_readahead_blks", 0644, sbi->s_proc,
&ext4_ui_proc_fops,
&sbi->s_inode_readahead_blks);
#endif #endif
bgl_lock_init(sbi->s_blockgroup_lock); bgl_lock_init(sbi->s_blockgroup_lock);
...@@ -2832,7 +2826,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2832,7 +2826,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
kfree(sbi->s_group_desc); kfree(sbi->s_group_desc);
failed_mount: failed_mount:
if (sbi->s_proc) { if (sbi->s_proc) {
remove_proc_entry("inode_readahead_blks", sbi->s_proc);
remove_proc_entry(sb->s_id, ext4_proc_root); remove_proc_entry(sb->s_id, ext4_proc_root);
} }
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
...@@ -3865,45 +3858,6 @@ static int ext4_get_sb(struct file_system_type *fs_type, ...@@ -3865,45 +3858,6 @@ static int ext4_get_sb(struct file_system_type *fs_type,
return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super, mnt); return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super, mnt);
} }
#ifdef CONFIG_PROC_FS
static int ext4_ui_proc_show(struct seq_file *m, void *v)
{
unsigned int *p = m->private;
seq_printf(m, "%u\n", *p);
return 0;
}
static int ext4_ui_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, ext4_ui_proc_show, PDE(inode)->data);
}
static ssize_t ext4_ui_proc_write(struct file *file, const char __user *buf,
size_t cnt, loff_t *ppos)
{
unsigned long *p = PDE(file->f_path.dentry->d_inode)->data;
char str[32];
if (cnt >= sizeof(str))
return -EINVAL;
if (copy_from_user(str, buf, cnt))
return -EFAULT;
*p = simple_strtoul(str, NULL, 0);
return cnt;
}
const struct file_operations ext4_ui_proc_fops = {
.owner = THIS_MODULE,
.open = ext4_ui_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = ext4_ui_proc_write,
};
#endif
static struct file_system_type ext4_fs_type = { static struct file_system_type ext4_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ext4", .name = "ext4",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册