1 fs: add dirtytime_expire_seconds sysctl
3 Add a tuning knob so we can adjust the dirtytime expiration timeout,
4 which is very useful for testing lazytime.
6 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 Reviewed-by: Jan Kara <jack@suse.cz>
9 fs/fs-writeback.c | 11 +++++++++++
10 include/linux/writeback.h | 3 +++
11 kernel/sysctl.c | 8 ++++++++
12 3 files changed, 22 insertions(+)
14 diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
15 index 2cfcd74..32a8bbd 100644
16 --- a/fs/fs-writeback.c
17 +++ b/fs/fs-writeback.c
18 @@ -1188,6 +1188,17 @@ static int __init start_dirtytime_writeback(void)
20 __initcall(start_dirtytime_writeback);
22 +int dirtytime_interval_handler(struct ctl_table *table, int write,
23 + void __user *buffer, size_t *lenp, loff_t *ppos)
27 + ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
28 + if (ret == 0 && write)
29 + mod_delayed_work(system_wq, &dirtytime_work, 0);
33 static noinline void block_dump___mark_inode_dirty(struct inode *inode)
35 if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) {
36 diff --git a/include/linux/writeback.h b/include/linux/writeback.h
37 index 0004833..b2dd371e 100644
38 --- a/include/linux/writeback.h
39 +++ b/include/linux/writeback.h
40 @@ -130,6 +130,7 @@ extern int vm_dirty_ratio;
41 extern unsigned long vm_dirty_bytes;
42 extern unsigned int dirty_writeback_interval;
43 extern unsigned int dirty_expire_interval;
44 +extern unsigned int dirtytime_expire_interval;
45 extern int vm_highmem_is_dirtyable;
46 extern int block_dump;
47 extern int laptop_mode;
48 @@ -146,6 +147,8 @@ extern int dirty_ratio_handler(struct ctl_table *table, int write,
49 extern int dirty_bytes_handler(struct ctl_table *table, int write,
50 void __user *buffer, size_t *lenp,
52 +int dirtytime_interval_handler(struct ctl_table *table, int write,
53 + void __user *buffer, size_t *lenp, loff_t *ppos);
56 int dirty_writeback_centisecs_handler(struct ctl_table *, int,
57 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
58 index 88ea2d6..ce410bb 100644
61 @@ -1228,6 +1228,14 @@ static struct ctl_table vm_table[] = {
65 + .procname = "dirtytime_expire_seconds",
66 + .data = &dirtytime_expire_interval,
67 + .maxlen = sizeof(dirty_expire_interval),
69 + .proc_handler = dirtytime_interval_handler,
73 .procname = "nr_pdflush_threads",
74 .mode = 0444 /* read-only */,
75 .proc_handler = pdflush_proc_obsolete,