Whamcloud - gitweb
9c8fc00cc8df503f9c5fa82d6b97ef85901b5a8a
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-max-dir-size.patch
1 Add a proc interface for max_dir_size.
2
3 Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/super.c
4 ===================================================================
5 --- linux-3.10.0-123.13.2.el7.x86_64.orig/fs/ext4/super.c
6 +++ linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/super.c
7 @@ -2476,8 +2476,11 @@ static ssize_t sbi_ui_show(struct ext4_a
8                            struct ext4_sb_info *sbi, char *buf)
9  {
10         unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset);
11 +       unsigned int v = *ui;
12  
13 -       return snprintf(buf, PAGE_SIZE, "%u\n", *ui);
14 +       if (strcmp("max_dir_size", a->attr.name) == 0)
15 +               v <<= 10;
16 +       return snprintf(buf, PAGE_SIZE, "%u\n", v);
17  }
18  
19  static ssize_t sbi_ui_store(struct ext4_attr *a,
20 @@ -2491,6 +2494,8 @@ static ssize_t sbi_ui_store(struct ext4_
21         ret = kstrtoul(skip_spaces(buf), 0, &t);
22         if (ret)
23                 return ret;
24 +       if (strcmp("max_dir_size", a->attr.name) == 0)
25 +               t >>= 10;
26         *ui = t;
27         return count;
28  }
29 @@ -2557,6 +2562,8 @@ EXT4_RW_ATTR(reserved_clusters);
30  EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show,
31                  inode_readahead_blks_store, s_inode_readahead_blks);
32  EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
33 +EXT4_RW_ATTR_SBI_UI(max_dir_size, s_max_dir_size_kb);
34 +EXT4_RW_ATTR_SBI_UI(max_dir_size_kb, s_max_dir_size_kb);
35  EXT4_RW_ATTR_SBI_UI(mb_stats, s_mb_stats);
36  EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
37  EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
38 @@ -2581,6 +2588,8 @@ static struct attribute *ext4_attrs[] =
39         ATTR_LIST(reserved_clusters),
40         ATTR_LIST(inode_readahead_blks),
41         ATTR_LIST(inode_goal),
42 +       ATTR_LIST(max_dir_size),
43 +       ATTR_LIST(max_dir_size_kb),
44         ATTR_LIST(mb_stats),
45         ATTR_LIST(mb_max_to_scan),
46         ATTR_LIST(mb_min_to_scan),