Whamcloud - gitweb
LU-13783 ldiskfs: Add support for mainline 5.8 kernel
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / linux-5.8 / ext4-max-dir-size.patch
1 Add a proc interface for max_dir_size.
2
3 ---
4  fs/ext4/sysfs.c |   10 +++++++++-
5  1 file changed, 9 insertions(+), 1 deletion(-)
6
7 --- a/fs/ext4/sysfs.c
8 +++ b/fs/ext4/sysfs.c
9 @@ -209,6 +209,8 @@ EXT4_ATTR_FUNC(reserved_clusters, 0644);
10  EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead,
11                  ext4_sb_info, s_inode_readahead_blks);
12  EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
13 +EXT4_RW_ATTR_SBI_UI(max_dir_size, s_max_dir_size_kb);
14 +EXT4_RW_ATTR_SBI_UI(max_dir_size_kb, s_max_dir_size_kb);
15  EXT4_RW_ATTR_SBI_UI(mb_stats, s_mb_stats);
16  EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
17  EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
18 @@ -252,6 +254,8 @@ static struct attribute *ext4_attrs[] =
19         ATTR_LIST(reserved_clusters),
20         ATTR_LIST(inode_readahead_blks),
21         ATTR_LIST(inode_goal),
22 +       ATTR_LIST(max_dir_size),
23 +       ATTR_LIST(max_dir_size_kb),
24         ATTR_LIST(mb_stats),
25         ATTR_LIST(mb_max_to_scan),
26         ATTR_LIST(mb_min_to_scan),
27 @@ -376,7 +380,9 @@ static ssize_t ext4_attr_show(struct kob
28                                         le32_to_cpup(ptr));
29                 else
30                         return snprintf(buf, PAGE_SIZE, "%u\n",
31 -                                       *((unsigned int *) ptr));
32 +                                       strcmp("max_dir_size", a->attr.name) ?
33 +                                       *((unsigned int *) ptr) :
34 +                                       (*((unsigned int *) ptr)) << 10);
35         case attr_pointer_ul:
36                 if (!ptr)
37                         return 0;
38 @@ -439,6 +445,8 @@ static ssize_t ext4_attr_store(struct ko
39                 ret = kstrtoul(skip_spaces(buf), 0, &t);
40                 if (ret)
41                         return ret;
42 +               if (strcmp("max_dir_size", a->attr.name) == 0)
43 +                       t >>= 10;
44                 if (a->attr_ptr == ptr_ext4_super_block_offset)
45                         *((__le32 *) ptr) = cpu_to_le32(t);
46                 else