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