Whamcloud - gitweb
LU-136 change "force_over_16tb" mount option to "force_over_128tb"
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-max-dir-size-rhel5.patch
1 diff -rupN linux-2.6.18-164.6.1_1//fs/ext4/ialloc.c linux-2.6.18-164.6.1_2//fs/ext4/ialloc.c
2 --- linux-2.6.18-164.6.1_1//fs/ext4/ialloc.c    2010-03-31 17:42:50.000000000 +0530
3 +++ linux-2.6.18-164.6.1_2//fs/ext4/ialloc.c    2010-03-31 17:43:22.000000000 +0530
4 @@ -622,11 +622,14 @@ struct inode *ext4_new_inode_goal(handle
5         sb = dir->i_sb;
6         trace_mark(ext4_request_inode, "dev %s dir %lu mode %d", sb->s_id,
7                    dir->i_ino, mode);
8 +       sbi = EXT4_SB(sb);
9 +       if (sbi->s_max_dir_size > 0 && i_size_read(dir) >= sbi->s_max_dir_size)
10 +               return ERR_PTR(-EFBIG);
11 +
12         inode = new_inode(sb);
13         if (!inode)
14                 return ERR_PTR(-ENOMEM);
15         ei = EXT4_I(inode);
16 -       sbi = EXT4_SB(sb);
17  
18         if (goal)
19                 goal = sbi->s_inode_goal;
20 diff -rupN linux-2.6.18-164.6.1_1//fs/ext4/super.c linux-2.6.18-164.6.1_2//fs/ext4/super.c
21 --- linux-2.6.18-164.6.1_1//fs/ext4/super.c     2010-03-31 17:42:50.000000000 +0530
22 +++ linux-2.6.18-164.6.1_2//fs/ext4/super.c     2010-03-31 17:45:32.000000000 +0530
23 @@ -40,6 +40,7 @@
24  EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
25  EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
26  EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
27 +EXT4_RW_ATTR_SBI_UI(max_dir_size, s_max_dir_size);
28  
29  static struct attribute *ext4_attrs[] = {
30         ATTR_LIST(delayed_allocation_blocks),
31 @@ -48,6 +48,7 @@
32         ATTR_LIST(mb_order2_req),
33         ATTR_LIST(mb_stream_req),
34         ATTR_LIST(mb_group_prealloc),
35 +       ATTR_LIST(max_dir_size),
36         NULL,
37  };
38  
39 diff -rupN linux-2.6.18-164.6.1_1//fs/ext4/ext4_sb.h linux-2.6.18-164.6.1_2//fs/ext4/ext4_sb.h
40 --- linux-2.6.18-164.6.1_1//fs/ext4/ext4.h      2010-03-31 17:42:50.000000000 +0530
41 +++ linux-2.6.18-164.6.1_2//fs/ext4/ext4.h      2010-03-31 17:43:22.000000000 +0530
42 @@ -119,6 +119,7 @@ struct ext4_sb_info {
43         /* where last allocation was done - for stream allocation */
44         unsigned long s_mb_last_group;
45         unsigned long s_mb_last_start;
46 +       unsigned long s_max_dir_size;
47  
48         /* history to debug policy */
49         struct ext4_mb_history *s_mb_history;