1 Index: linux-stage/fs/ext4/xattr.c
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/xattr.c
4 +++ linux-stage/fs/ext4/xattr.c
6 # define ea_bdebug(f...)
9 -static void ext4_xattr_cache_insert(struct buffer_head *);
10 +static void ext4_xattr_cache_insert(struct super_block *,
11 + struct buffer_head *);
12 static struct buffer_head *ext4_xattr_cache_find(struct inode *,
13 struct ext4_xattr_header *,
14 struct mb_cache_entry **);
15 @@ -233,7 +234,7 @@ bad_block: ext4_error(inode->i_sb, __fun
19 - ext4_xattr_cache_insert(bh);
20 + ext4_xattr_cache_insert(inode->i_sb, bh);
22 error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1);
24 @@ -375,7 +376,7 @@ ext4_xattr_block_list(struct inode *inod
28 - ext4_xattr_cache_insert(bh);
29 + ext4_xattr_cache_insert(inode->i_sb, bh);
30 error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
33 @@ -472,7 +473,9 @@ ext4_xattr_release_block(handle_t *handl
34 struct mb_cache_entry *ce = NULL;
37 - ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr);
38 + if (!test_opt(inode->i_sb, NO_MBCACHE))
39 + ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev,
41 error = ext4_journal_get_write_access(handle, bh);
44 @@ -700,8 +703,10 @@ ext4_xattr_block_set(handle_t *handle, s
45 if (i->value && i->value_len > sb->s_blocksize)
48 - ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
50 + if (!test_opt(inode->i_sb, NO_MBCACHE))
51 + ce = mb_cache_entry_get(ext4_xattr_cache,
54 error = ext4_journal_get_write_access(handle, bs->bh);
57 @@ -718,7 +723,7 @@ ext4_xattr_block_set(handle_t *handle, s
58 if (!IS_LAST_ENTRY(s->first))
59 ext4_xattr_rehash(header(s->base),
61 - ext4_xattr_cache_insert(bs->bh);
62 + ext4_xattr_cache_insert(sb, bs->bh);
64 unlock_buffer(bs->bh);
66 @@ -801,7 +806,8 @@ inserted:
70 - mb_cache_entry_release(ce);
72 + mb_cache_entry_release(ce);
74 } else if (bs->bh && s->base == bs->bh->b_data) {
75 /* We were modifying this block in-place. */
76 @@ -845,7 +851,7 @@ getblk_failed:
77 memcpy(new_bh->b_data, s->base, new_bh->b_size);
78 set_buffer_uptodate(new_bh);
79 unlock_buffer(new_bh);
80 - ext4_xattr_cache_insert(new_bh);
81 + ext4_xattr_cache_insert(sb, new_bh);
82 error = ext4_handle_dirty_metadata(handle,
85 @@ -1404,12 +1410,15 @@ ext4_xattr_put_super(struct super_block
86 * Returns 0, or a negative error number on failure.
89 -ext4_xattr_cache_insert(struct buffer_head *bh)
90 +ext4_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh)
92 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash);
93 struct mb_cache_entry *ce;
96 + if (test_opt(sb, NO_MBCACHE))
99 ce = mb_cache_entry_alloc(ext4_xattr_cache);
101 ea_bdebug(bh, "out of memory");
102 @@ -1483,6 +1492,8 @@ ext4_xattr_cache_find(struct inode *inod
103 __u32 hash = le32_to_cpu(header->h_hash);
104 struct mb_cache_entry *ce;
106 + if (test_opt(inode->i_sb, NO_MBCACHE))
109 return NULL; /* never share */
110 ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
111 Index: linux-stage/fs/ext4/super.c
112 ===================================================================
113 --- linux-stage.orig/fs/ext4/super.c
114 +++ linux-stage/fs/ext4/super.c
115 @@ -1481,6 +1481,7 @@ enum {
117 Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_bigendian_extents,
118 Opt_force_over_128tb,
122 static match_table_t tokens = {
123 @@ -1554,6 +1555,7 @@ static match_table_t tokens = {
124 {Opt_noauto_da_alloc, "noauto_da_alloc"},
125 {Opt_bigendian_extents, "bigendian_extents"},
126 {Opt_force_over_128tb, "force_over_128tb"},
127 + {Opt_no_mbcache, "no_mbcache"},
131 @@ -2030,6 +2032,9 @@ set_qf_format:
133 clear_opt(sbi->s_mount_opt, EXTENTS);
135 + case Opt_no_mbcache:
136 + set_opt(sbi->s_mount_opt, NO_MBCACHE);
139 ext4_msg(sb, KERN_ERR,
140 "Unrecognized mount option \"%s\" "
141 Index: linux-stage/fs/ext4/ext4.h
142 ===================================================================
143 --- linux-stage.orig/fs/ext4/ext4.h
144 +++ linux-stage/fs/ext4/ext4.h
145 @@ -715,7 +715,8 @@ struct ext4_inode_info {
149 -#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
150 +#define EXT4_MOUNT_NO_MBCACHE 0x00001 /* Disable mbcache */
151 +#define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
152 #define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
153 #define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
154 #define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */