Whamcloud - gitweb
LU-2479 ldiskfs: fix max_dir_size checking
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel6.3 / ext4-max-dir-size.patch
1 Index: linux-2.6.32-el6-beta/fs/ext4/namei.c
2 ===================================================================
3 --- linux-2.6.32-el6-beta/fs/ext4/namei.c
4 +++ linux-2.6.32-el6-beta/fs/ext4/namei.c
5 @@ -59,6 +59,14 @@ static struct buffer_head *ext4_append(h
6         * have to be serialized -bzzz */
7         down(&ei->i_append_sem);
8  
9 +       if (unlikely(EXT4_SB(inode->i_sb)->s_max_dir_size &&
10 +                    (inode->i_size >=
11 +                    EXT4_SB(inode->i_sb)->s_max_dir_size))) {
12 +               *err = -ENOSPC;
13 +               up(&ei->i_append_sem);
14 +               return NULL;
15 +       }
16 +
17         *block = inode->i_size >> inode->i_sb->s_blocksize_bits;
18  
19         bh = ext4_bread(handle, inode, *block, 1, err);
20 Index: linux-2.6.32-el6-beta/fs/ext4/super.c
21 ===================================================================
22 --- linux-2.6.32-el6-beta.orig/fs/ext4/super.c
23 +++ linux-2.6.32-el6-beta/fs/ext4/super.c
24 @@ -999,6 +999,9 @@ static int ext4_show_options(struct seq_
25                 seq_printf(seq, ",init_itable=%u",
26                            (unsigned) sbi->s_li_wait_mult);
27  
28 +       if (sbi->s_max_dir_size)
29 +               seq_printf(seq, "max_dir_size=%lu", sbi->s_max_dir_size);
30 +
31         ext4_show_quota_options(seq, sb);
32  
33         return 0;
34 @@ -2373,6 +2384,7 @@ EXT4_RO_ATTR(lifetime_write_kbytes);
35  EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show,
36                  inode_readahead_blks_store, s_inode_readahead_blks);
37  EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
38 +EXT4_RW_ATTR_SBI_UI(max_dir_size, s_max_dir_size);
39  EXT4_RW_ATTR_SBI_UI(mb_stats, s_mb_stats);
40  EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
41  EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
42 @@ -2388,6 +2400,7 @@ static struct attribute *ext4_attrs[] = 
43         ATTR_LIST(lifetime_write_kbytes),
44         ATTR_LIST(inode_readahead_blks),
45         ATTR_LIST(inode_goal),
46 +       ATTR_LIST(max_dir_size),
47         ATTR_LIST(mb_stats),
48         ATTR_LIST(mb_max_to_scan),
49         ATTR_LIST(mb_min_to_scan),
50 @@ -2877,6 +2890,7 @@ static int ext4_fill_super(struct super_
51         }
52         sb->s_fs_info = sbi;
53         sbi->s_mount_opt = 0;
54 +       sbi->s_max_dir_size = 0;
55         sbi->s_resuid = EXT4_DEF_RESUID;
56         sbi->s_resgid = EXT4_DEF_RESGID;
57         sbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;
58 Index: linux-2.6.32-el6-beta/fs/ext4/ext4.h
59 ===================================================================
60 --- linux-2.6.32-el6-beta.orig/fs/ext4/ext4.h
61 +++ linux-2.6.32-el6-beta/fs/ext4/ext4.h
62 @@ -1113,6 +1113,7 @@ struct ext4_sb_info {
63         unsigned long s_mb_prealloc_table_size;
64         unsigned int s_mb_group_prealloc;
65         unsigned int s_max_writeback_mb_bump;
66 +       unsigned long s_max_dir_size;
67         /* where last allocation was done - for stream allocation */
68         unsigned long s_mb_last_group;
69         unsigned long s_mb_last_start;