1 Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/ext4.h
4 +++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
5 @@ -873,7 +873,8 @@ struct ext4_inode_info {
9 -#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
10 +#define EXT4_MOUNT_NO_MBCACHE 0x00001 /* Disable mbcache */
11 +#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
12 #define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
13 #define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
14 #define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
15 Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
16 ===================================================================
17 --- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/super.c
18 +++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
19 @@ -1252,6 +1252,7 @@ enum {
20 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
21 Opt_block_validity, Opt_noblock_validity,
22 Opt_inode_readahead_blks, Opt_journal_ioprio,
24 Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
27 @@ -1320,6 +1321,7 @@ static const match_table_t tokens = {
28 {Opt_auto_da_alloc, "auto_da_alloc=%u"},
29 {Opt_auto_da_alloc, "auto_da_alloc"},
30 {Opt_noauto_da_alloc, "noauto_da_alloc"},
31 + {Opt_no_mbcache, "no_mbcache"},
32 {Opt_discard, "discard"},
33 {Opt_nodiscard, "nodiscard"},
34 {Opt_init_itable, "init_itable=%u"},
35 @@ -1780,6 +1782,9 @@ set_qf_format:
36 case Opt_noinit_itable:
37 clear_opt(sbi->s_mount_opt, INIT_INODE_TABLE);
39 + case Opt_no_mbcache:
40 + set_opt(sbi->s_mount_opt, NO_MBCACHE);
43 ext4_msg(sb, KERN_ERR,
44 "Unrecognized mount option \"%s\" "
45 Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/xattr.c
46 ===================================================================
47 --- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/xattr.c
48 +++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/xattr.c
50 # define ea_bdebug(f...)
53 -static void ext4_xattr_cache_insert(struct buffer_head *);
54 +static void ext4_xattr_cache_insert(struct super_block *,
55 + struct buffer_head *);
56 static struct buffer_head *ext4_xattr_cache_find(struct inode *,
57 struct ext4_xattr_header *,
58 struct mb_cache_entry **);
59 @@ -333,7 +334,7 @@ bad_block:
63 - ext4_xattr_cache_insert(bh);
64 + ext4_xattr_cache_insert(inode->i_sb, bh);
66 error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1,
68 @@ -492,7 +493,7 @@ ext4_xattr_block_list(struct inode *inod
72 - ext4_xattr_cache_insert(bh);
73 + ext4_xattr_cache_insert(inode->i_sb, bh);
74 error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
77 @@ -589,7 +590,9 @@ ext4_xattr_release_block(handle_t *handl
78 struct mb_cache_entry *ce = NULL;
81 - ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr);
82 + if (!test_opt(inode->i_sb, NO_MBCACHE))
83 + ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev,
85 error = ext4_journal_get_write_access(handle, bh);
88 @@ -988,8 +991,10 @@ ext4_xattr_block_set(handle_t *handle, s
89 #define header(x) ((struct ext4_xattr_header *)(x))
92 - ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
94 + if (!test_opt(inode->i_sb, NO_MBCACHE))
95 + ce = mb_cache_entry_get(ext4_xattr_cache,
98 error = ext4_journal_get_write_access(handle, bs->bh);
101 @@ -1006,7 +1011,7 @@ ext4_xattr_block_set(handle_t *handle, s
102 if (!IS_LAST_ENTRY(s->first))
103 ext4_xattr_rehash(header(s->base),
105 - ext4_xattr_cache_insert(bs->bh);
106 + ext4_xattr_cache_insert(sb, bs->bh);
108 unlock_buffer(bs->bh);
110 @@ -1089,7 +1094,8 @@ inserted:
114 - mb_cache_entry_release(ce);
116 + mb_cache_entry_release(ce);
118 } else if (bs->bh && s->base == bs->bh->b_data) {
119 /* We were modifying this block in-place. */
120 @@ -1140,7 +1146,7 @@ getblk_failed:
121 memcpy(new_bh->b_data, s->base, new_bh->b_size);
122 set_buffer_uptodate(new_bh);
123 unlock_buffer(new_bh);
124 - ext4_xattr_cache_insert(new_bh);
125 + ext4_xattr_cache_insert(sb, new_bh);
126 error = ext4_handle_dirty_metadata(handle,
129 @@ -1857,12 +1863,15 @@ ext4_xattr_put_super(struct super_block
130 * Returns 0, or a negative error number on failure.
133 -ext4_xattr_cache_insert(struct buffer_head *bh)
134 +ext4_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh)
136 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash);
137 struct mb_cache_entry *ce;
140 + if (test_opt(sb, NO_MBCACHE))
143 ce = mb_cache_entry_alloc(ext4_xattr_cache, GFP_NOFS);
145 ea_bdebug(bh, "out of memory");
146 @@ -1935,6 +1944,8 @@ ext4_xattr_cache_find(struct inode *inod
147 __u32 hash = le32_to_cpu(header->h_hash);
148 struct mb_cache_entry *ce;
150 + if (test_opt(inode->i_sb, NO_MBCACHE))
153 return NULL; /* never share */
154 ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);