1 Index: linux-stage/fs/ext3/xattr.c
2 ===================================================================
3 --- linux-stage.orig/fs/ext3/xattr.c
4 +++ linux-stage/fs/ext3/xattr.c
6 # define ea_bdebug(f...)
9 -static void ext3_xattr_cache_insert(struct buffer_head *);
10 +static void ext3_xattr_cache_insert(struct super_block *,
11 + struct buffer_head *);
12 static struct buffer_head *ext3_xattr_cache_find(struct inode *,
13 struct ext3_xattr_header *,
14 struct mb_cache_entry **);
15 @@ -238,7 +239,7 @@ bad_block: ext3_error(inode->i_sb, __FUN
19 - ext3_xattr_cache_insert(bh);
20 + ext3_xattr_cache_insert(inode->i_sb, bh);
22 error = ext3_xattr_find_entry(&entry, name_index, name, bh->b_size, 1);
24 @@ -380,7 +381,7 @@ ext3_xattr_block_list(struct inode *inod
28 - ext3_xattr_cache_insert(bh);
29 + ext3_xattr_cache_insert(inode->i_sb, bh);
30 error = ext3_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
33 @@ -479,7 +480,9 @@ ext3_xattr_release_block(handle_t *handl
35 struct mb_cache_entry *ce = NULL;
37 - ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev, bh->b_blocknr);
38 + if (!test_opt(inode->i_sb, NO_MBCACHE))
39 + ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev,
41 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) {
42 ea_bdebug(bh, "refcount now=0; freeing");
44 @@ -699,8 +702,10 @@ ext3_xattr_block_set(handle_t *handle, s
45 if (i->value && i->value_len > sb->s_blocksize)
48 - ce = mb_cache_entry_get(ext3_xattr_cache, bs->bh->b_bdev,
50 + if (!test_opt(inode->i_sb, NO_MBCACHE))
51 + ce = mb_cache_entry_get(ext3_xattr_cache,
54 if (header(s->base)->h_refcount == cpu_to_le32(1)) {
56 mb_cache_entry_free(ce);
57 @@ -716,7 +721,7 @@ ext3_xattr_block_set(handle_t *handle, s
58 if (!IS_LAST_ENTRY(s->first))
59 ext3_xattr_rehash(header(s->base),
61 - ext3_xattr_cache_insert(bs->bh);
62 + ext3_xattr_cache_insert(sb, bs->bh);
64 unlock_buffer(bs->bh);
66 @@ -797,7 +802,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 @@ -832,7 +838,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 - ext3_xattr_cache_insert(new_bh);
81 + ext3_xattr_cache_insert(sb, new_bh);
82 error = ext3_journal_dirty_metadata(handle, new_bh);
85 @@ -1387,12 +1393,15 @@ ext3_xattr_put_super(struct super_block
86 * Returns 0, or a negative error number on failure.
89 -ext3_xattr_cache_insert(struct buffer_head *bh)
90 +ext3_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(ext3_xattr_cache);
101 ea_bdebug(bh, "out of memory");
102 @@ -1466,6 +1475,8 @@ ext3_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/ext3/super.c
112 ===================================================================
113 --- linux-stage.orig/fs/ext3/super.c
114 +++ linux-stage/fs/ext3/super.c
115 @@ -722,6 +722,7 @@ enum {
117 Opt_extents, Opt_noextents, Opt_bigendian_extents, Opt_extdebug,
118 Opt_mballoc, Opt_nomballoc, Opt_stripe, Opt_maxdirsize, Opt_force_over_8tb,
122 static match_table_t tokens = {
123 @@ -788,6 +789,7 @@ static match_table_t tokens = {
124 {Opt_force_over_8tb, "force_over_8tb"},
125 {Opt_resize, "resize"},
126 {Opt_maxdirsize, "maxdirsize=%u"},
127 + {Opt_no_mbcache, "no_mbcache"},
131 @@ -1175,6 +1177,9 @@ clear_qf_name:
132 case Opt_force_over_8tb:
135 + case Opt_no_mbcache:
136 + set_opt(sbi->s_mount_opt, NO_MBCACHE);
140 "EXT3-fs: Unrecognized mount option \"%s\" "
141 Index: linux-stage/include/linux/ext3_fs.h
142 ===================================================================
143 --- linux-stage.orig/include/linux/ext3_fs.h
144 +++ linux-stage/include/linux/ext3_fs.h
145 @@ -483,6 +483,8 @@ do { \
146 #define EXT3_MOUNT_JOURNAL_ASYNC_COMMIT 0x20000000 /* Journal Async Commit */
149 +#define EXT3_MOUNT_NO_MBCACHE 0x40000000 /* Disable mbcache */
151 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
153 #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt