1 diff -ru linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
2 --- linux-stage.orig/fs/ext4/ext4.h 2012-12-31 15:58:19.000000000 -0500
3 +++ linux-stage/fs/ext4/ext4.h 2012-12-31 15:58:42.000000000 -0500
8 -#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
9 +#define EXT4_MOUNT_NO_MBCACHE 0x00001 /* Disable mbcache */
10 +#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
11 #define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
12 #define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
13 #define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
14 diff -ru linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
15 --- linux-stage.orig/fs/ext4/super.c 2012-12-31 15:58:19.000000000 -0500
16 +++ linux-stage/fs/ext4/super.c 2012-12-31 15:59:19.000000000 -0500
18 Opt_dioread_nolock, Opt_dioread_lock,
19 Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
20 Opt_extents, Opt_noextents,
22 Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
26 {Opt_bigendian_extents, "bigendian_extents"},
27 {Opt_force_over_128tb, "force_over_128tb"},
28 {Opt_mballoc, "mballoc"},
29 + {Opt_no_mbcache, "no_mbcache"},
30 {Opt_extents, "extents"},
31 {Opt_noextents, "noextents"},
32 {Opt_discard, "discard"},
35 clear_opt(sb, EXTENTS);
37 + case Opt_no_mbcache:
38 + set_opt(sb, NO_MBCACHE);
41 ext4_msg(sb, KERN_ERR,
42 "Unrecognized mount option \"%s\" "
43 diff -ru linux-stage.orig/fs/ext4/xattr.c linux-stage/fs/ext4/xattr.c
44 --- linux-stage.orig/fs/ext4/xattr.c 2012-12-31 15:58:19.000000000 -0500
45 +++ linux-stage/fs/ext4/xattr.c 2012-12-31 16:46:21.000000000 -0500
47 # define ea_bdebug(f...)
50 -static void ext4_xattr_cache_insert(struct buffer_head *);
51 +static void ext4_xattr_cache_insert(struct super_block *,
52 + struct buffer_head *);
53 static struct buffer_head *ext4_xattr_cache_find(struct inode *,
54 struct ext4_xattr_header *,
55 struct mb_cache_entry **);
60 - ext4_xattr_cache_insert(bh);
61 + ext4_xattr_cache_insert(inode->i_sb, bh);
63 error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1,
69 - ext4_xattr_cache_insert(bh);
70 + ext4_xattr_cache_insert(inode->i_sb, bh);
71 error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size);
75 struct mb_cache_entry *ce = NULL;
78 - ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr);
79 + if (!test_opt(inode->i_sb, NO_MBCACHE))
80 + ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev,
82 error = ext4_journal_get_write_access(handle, bh);
86 #define header(x) ((struct ext4_xattr_header *)(x))
89 - ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
91 + if (!test_opt(inode->i_sb, NO_MBCACHE))
92 + ce = mb_cache_entry_get(ext4_xattr_cache,
95 error = ext4_journal_get_write_access(handle, bs->bh);
99 if (!IS_LAST_ENTRY(s->first))
100 ext4_xattr_rehash(header(s->base),
102 - ext4_xattr_cache_insert(bs->bh);
103 + ext4_xattr_cache_insert(sb, bs->bh);
105 unlock_buffer(bs->bh);
107 @@ -1090,7 +1095,8 @@
111 - mb_cache_entry_release(ce);
113 + mb_cache_entry_release(ce);
115 } else if (bs->bh && s->base == bs->bh->b_data) {
116 /* We were modifying this block in-place. */
117 @@ -1141,7 +1147,7 @@
118 memcpy(new_bh->b_data, s->base, new_bh->b_size);
119 set_buffer_uptodate(new_bh);
120 unlock_buffer(new_bh);
121 - ext4_xattr_cache_insert(new_bh);
122 + ext4_xattr_cache_insert(sb, new_bh);
123 error = ext4_handle_dirty_metadata(handle,
126 @@ -1761,12 +1767,15 @@
127 * Returns 0, or a negative error number on failure.
130 -ext4_xattr_cache_insert(struct buffer_head *bh)
131 +ext4_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh)
133 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash);
134 struct mb_cache_entry *ce;
137 + if (test_opt(sb, NO_MBCACHE))
140 ce = mb_cache_entry_alloc(ext4_xattr_cache, GFP_NOFS);
142 ea_bdebug(bh, "out of memory");
143 @@ -1839,6 +1848,8 @@
144 __u32 hash = le32_to_cpu(header->h_hash);
145 struct mb_cache_entry *ce;
147 + if (test_opt(inode->i_sb, NO_MBCACHE))
150 return NULL; /* never share */
151 ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);