1 Index: linux-stage/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4.h 2011-03-14 16:16:45.000000000 +0800
4 +++ linux-stage/fs/ext4/ext4.h 2011-03-14 16:17:08.732676431 +0800
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-stage/fs/ext4/super.c
16 ===================================================================
17 --- linux-stage.orig/fs/ext4/super.c 2011-03-14 16:16:45.000000000 +0800
18 +++ linux-stage/fs/ext4/super.c 2011-03-14 16:18:13.831956469 +0800
20 Opt_inode_readahead_blks, Opt_journal_ioprio,
21 Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
22 Opt_extents, Opt_noextents,
24 Opt_discard, Opt_nodiscard,
25 Opt_init_inode_table, Opt_noinit_inode_table,
28 {Opt_noauto_da_alloc, "noauto_da_alloc"},
29 {Opt_bigendian_extents, "bigendian_extents"},
30 {Opt_mballoc, "mballoc"},
31 + {Opt_no_mbcache, "no_mbcache"},
32 {Opt_extents, "extents"},
33 {Opt_noextents, "noextents"},
34 {Opt_discard, "discard"},
37 clear_opt(sbi->s_mount_opt, EXTENTS);
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-stage/fs/ext4/xattr.c
46 ===================================================================
47 --- linux-stage.orig/fs/ext4/xattr.c 2011-03-14 16:16:43.000000000 +0800
48 +++ linux-stage/fs/ext4/xattr.c 2011-03-14 16:17:08.806677883 +0800
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 **);
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);
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);
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);
89 if (i->value && i->value_len > sb->s_blocksize)
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);
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);
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. */
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 @@ -1403,12 +1409,15 @@
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 @@ -1482,6 +1491,8 @@
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);