From: Girish Shilamkar Date: Thu, 8 Jul 2010 18:34:52 +0000 (+0530) Subject: b=22771 Patches to disable mb_cache X-Git-Tag: v1_8_4_RC1~8 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b70db78bbb0463584a4129c23f028e3b73c8115a;p=fs%2Flustre-release.git b=22771 Patches to disable mb_cache i=adilger --- diff --git a/ldiskfs/kernel_patches/patches/ext3-disable-mb-cache.patch b/ldiskfs/kernel_patches/patches/ext3-disable-mb-cache.patch new file mode 100644 index 0000000..28b3758 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext3-disable-mb-cache.patch @@ -0,0 +1,153 @@ +Index: linux-stage/fs/ext3/xattr.c +=================================================================== +--- linux-stage.orig/fs/ext3/xattr.c ++++ linux-stage/fs/ext3/xattr.c +@@ -93,7 +93,8 @@ + # define ea_bdebug(f...) + #endif + +-static void ext3_xattr_cache_insert(struct buffer_head *); ++static void ext3_xattr_cache_insert(struct super_block *, ++ struct buffer_head *); + static struct buffer_head *ext3_xattr_cache_find(struct inode *, + struct ext3_xattr_header *, + struct mb_cache_entry **); +@@ -238,7 +239,7 @@ bad_block: ext3_error(inode->i_sb, __FUN + error = -EIO; + goto cleanup; + } +- ext3_xattr_cache_insert(bh); ++ ext3_xattr_cache_insert(inode->i_sb, bh); + entry = BFIRST(bh); + error = ext3_xattr_find_entry(&entry, name_index, name, bh->b_size, 1); + if (error == -EIO) +@@ -380,7 +381,7 @@ ext3_xattr_block_list(struct inode *inod + error = -EIO; + goto cleanup; + } +- ext3_xattr_cache_insert(bh); ++ ext3_xattr_cache_insert(inode->i_sb, bh); + error = ext3_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size); + + cleanup: +@@ -479,7 +480,9 @@ ext3_xattr_release_block(handle_t *handl + { + struct mb_cache_entry *ce = NULL; + +- ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev, bh->b_blocknr); ++ if (!test_opt(inode->i_sb, NO_MBCACHE)) ++ ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev, ++ bh->b_blocknr); + if (BHDR(bh)->h_refcount == cpu_to_le32(1)) { + ea_bdebug(bh, "refcount now=0; freeing"); + if (ce) +@@ -699,8 +702,10 @@ ext3_xattr_block_set(handle_t *handle, s + if (i->value && i->value_len > sb->s_blocksize) + return -ENOSPC; + if (s->base) { +- ce = mb_cache_entry_get(ext3_xattr_cache, bs->bh->b_bdev, +- bs->bh->b_blocknr); ++ if (!test_opt(inode->i_sb, NO_MBCACHE)) ++ ce = mb_cache_entry_get(ext3_xattr_cache, ++ bs->bh->b_bdev, ++ bs->bh->b_blocknr); + if (header(s->base)->h_refcount == cpu_to_le32(1)) { + if (ce) { + mb_cache_entry_free(ce); +@@ -716,7 +721,7 @@ ext3_xattr_block_set(handle_t *handle, s + if (!IS_LAST_ENTRY(s->first)) + ext3_xattr_rehash(header(s->base), + s->here); +- ext3_xattr_cache_insert(bs->bh); ++ ext3_xattr_cache_insert(sb, bs->bh); + } + unlock_buffer(bs->bh); + if (error == -EIO) +@@ -797,7 +802,8 @@ inserted: + if (error) + goto cleanup_dquot; + } +- mb_cache_entry_release(ce); ++ if (ce) ++ mb_cache_entry_release(ce); + ce = NULL; + } else if (bs->bh && s->base == bs->bh->b_data) { + /* We were modifying this block in-place. */ +@@ -832,7 +838,7 @@ getblk_failed: + memcpy(new_bh->b_data, s->base, new_bh->b_size); + set_buffer_uptodate(new_bh); + unlock_buffer(new_bh); +- ext3_xattr_cache_insert(new_bh); ++ ext3_xattr_cache_insert(sb, new_bh); + error = ext3_journal_dirty_metadata(handle, new_bh); + if (error) + goto cleanup; +@@ -1387,12 +1393,15 @@ ext3_xattr_put_super(struct super_block + * Returns 0, or a negative error number on failure. + */ + static void +-ext3_xattr_cache_insert(struct buffer_head *bh) ++ext3_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh) + { + __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); + struct mb_cache_entry *ce; + int error; + ++ if (test_opt(sb, NO_MBCACHE)) ++ return; ++ + ce = mb_cache_entry_alloc(ext3_xattr_cache); + if (!ce) { + ea_bdebug(bh, "out of memory"); +@@ -1466,6 +1475,8 @@ ext3_xattr_cache_find(struct inode *inod + __u32 hash = le32_to_cpu(header->h_hash); + struct mb_cache_entry *ce; + ++ if (test_opt(inode->i_sb, NO_MBCACHE)) ++ return NULL; + if (!header->h_hash) + return NULL; /* never share */ + ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); +Index: linux-stage/fs/ext3/super.c +=================================================================== +--- linux-stage.orig/fs/ext3/super.c ++++ linux-stage/fs/ext3/super.c +@@ -722,6 +722,7 @@ enum { + Opt_grpquota, + Opt_extents, Opt_noextents, Opt_bigendian_extents, Opt_extdebug, + Opt_mballoc, Opt_nomballoc, Opt_stripe, Opt_maxdirsize, Opt_force_over_8tb, ++ Opt_no_mbcache, + }; + + static match_table_t tokens = { +@@ -788,6 +789,7 @@ static match_table_t tokens = { + {Opt_force_over_8tb, "force_over_8tb"}, + {Opt_resize, "resize"}, + {Opt_maxdirsize, "maxdirsize=%u"}, ++ {Opt_no_mbcache, "no_mbcache"}, + {Opt_err, NULL} + }; + +@@ -1175,6 +1177,9 @@ clear_qf_name: + case Opt_force_over_8tb: + force_over_8tb = 1; + break; ++ case Opt_no_mbcache: ++ set_opt(sbi->s_mount_opt, NO_MBCACHE); ++ break; + default: + printk (KERN_ERR + "EXT3-fs: Unrecognized mount option \"%s\" " +Index: linux-stage/include/linux/ext3_fs.h +=================================================================== +--- linux-stage.orig/include/linux/ext3_fs.h ++++ linux-stage/include/linux/ext3_fs.h +@@ -483,6 +483,8 @@ do { \ + #define EXT3_MOUNT_JOURNAL_ASYNC_COMMIT 0x20000000 /* Journal Async Commit */ + #endif + ++#define EXT3_MOUNT_NO_MBCACHE 0x40000000 /* Disable mbcache */ ++ + /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ + #ifndef clear_opt + #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt diff --git a/ldiskfs/kernel_patches/patches/ext4-disable-mb-cache-rhel5.patch b/ldiskfs/kernel_patches/patches/ext4-disable-mb-cache-rhel5.patch new file mode 100644 index 0000000..09289d6 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext4-disable-mb-cache-rhel5.patch @@ -0,0 +1,152 @@ +Index: linux-stage/fs/ext4/xattr.c +=================================================================== +--- linux-stage.orig/fs/ext4/xattr.c ++++ linux-stage/fs/ext4/xattr.c +@@ -86,7 +86,8 @@ + # define ea_bdebug(f...) + #endif + +-static void ext4_xattr_cache_insert(struct buffer_head *); ++static void ext4_xattr_cache_insert(struct super_block *, ++ struct buffer_head *); + static struct buffer_head *ext4_xattr_cache_find(struct inode *, + struct ext4_xattr_header *, + struct mb_cache_entry **); +@@ -233,7 +234,7 @@ bad_block: ext4_error(inode->i_sb, __fun + error = -EIO; + goto cleanup; + } +- ext4_xattr_cache_insert(bh); ++ ext4_xattr_cache_insert(inode->i_sb, bh); + entry = BFIRST(bh); + error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1); + if (error == -EIO) +@@ -375,7 +376,7 @@ ext4_xattr_block_list(struct inode *inod + error = -EIO; + goto cleanup; + } +- ext4_xattr_cache_insert(bh); ++ ext4_xattr_cache_insert(inode->i_sb, bh); + error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size); + + cleanup: +@@ -472,7 +473,9 @@ ext4_xattr_release_block(handle_t *handl + struct mb_cache_entry *ce = NULL; + int error = 0; + +- ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr); ++ if (!test_opt(inode->i_sb, NO_MBCACHE)) ++ ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, ++ bh->b_blocknr); + error = ext4_journal_get_write_access(handle, bh); + if (error) + goto out; +@@ -700,8 +703,10 @@ ext4_xattr_block_set(handle_t *handle, s + if (i->value && i->value_len > sb->s_blocksize) + return -ENOSPC; + if (s->base) { +- ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev, +- bs->bh->b_blocknr); ++ if (!test_opt(inode->i_sb, NO_MBCACHE)) ++ ce = mb_cache_entry_get(ext4_xattr_cache, ++ bs->bh->b_bdev, ++ bs->bh->b_blocknr); + error = ext4_journal_get_write_access(handle, bs->bh); + if (error) + goto cleanup; +@@ -718,7 +723,7 @@ ext4_xattr_block_set(handle_t *handle, s + if (!IS_LAST_ENTRY(s->first)) + ext4_xattr_rehash(header(s->base), + s->here); +- ext4_xattr_cache_insert(bs->bh); ++ ext4_xattr_cache_insert(sb, bs->bh); + } + unlock_buffer(bs->bh); + if (error == -EIO) +@@ -801,7 +806,8 @@ inserted: + if (error) + goto cleanup_dquot; + } +- mb_cache_entry_release(ce); ++ if (ce) ++ mb_cache_entry_release(ce); + ce = NULL; + } else if (bs->bh && s->base == bs->bh->b_data) { + /* We were modifying this block in-place. */ +@@ -834,7 +840,7 @@ getblk_failed: + memcpy(new_bh->b_data, s->base, new_bh->b_size); + set_buffer_uptodate(new_bh); + unlock_buffer(new_bh); +- ext4_xattr_cache_insert(new_bh); ++ ext4_xattr_cache_insert(sb, new_bh); + error = ext4_handle_dirty_metadata(handle, + inode, new_bh); + if (error) +@@ -1393,12 +1399,15 @@ ext4_xattr_put_super(struct super_block + * Returns 0, or a negative error number on failure. + */ + static void +-ext4_xattr_cache_insert(struct buffer_head *bh) ++ext4_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh) + { + __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); + struct mb_cache_entry *ce; + int error; + ++ if (test_opt(sb, NO_MBCACHE)) ++ return; ++ + ce = mb_cache_entry_alloc(ext4_xattr_cache); + if (!ce) { + ea_bdebug(bh, "out of memory"); +@@ -1472,6 +1481,8 @@ ext4_xattr_cache_find(struct inode *inod + __u32 hash = le32_to_cpu(header->h_hash); + struct mb_cache_entry *ce; + ++ if (test_opt(inode->i_sb, NO_MBCACHE)) ++ return NULL; + if (!header->h_hash) + return NULL; /* never share */ + ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); +Index: linux-stage/fs/ext4/super.c +=================================================================== +--- linux-stage.orig/fs/ext4/super.c ++++ linux-stage/fs/ext4/super.c +@@ -1352,6 +1352,7 @@ enum { + Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_bigendian_extents, + Opt_force_over_16tb, + Opt_extents, Opt_noextents, ++ Opt_no_mbcache, + }; + + static match_table_t tokens = { +@@ -1422,6 +1423,7 @@ static match_table_t tokens = { + {Opt_force_over_16tb, "force_over_16tb"}, + {Opt_extents, "extents"}, + {Opt_noextents, "noextents"}, ++ {Opt_no_mbcache, "no_mbcache"}, + {Opt_err, NULL}, + }; + +@@ -1880,6 +1882,9 @@ set_qf_format: + } + clear_opt(sbi->s_mount_opt, EXTENTS); + break; ++ case Opt_no_mbcache: ++ set_opt(sbi->s_mount_opt, NO_MBCACHE); ++ break; + default: + printk(KERN_ERR + "EXT4-fs: Unrecognized mount option \"%s\" " +Index: linux-stage/fs/ext4/ext4.h +=================================================================== +--- linux-stage.orig/fs/ext4/ext4.h ++++ linux-stage/fs/ext4/ext4.h +@@ -548,6 +548,7 @@ do { \ + #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ + #define EXT4_MOUNT_IOPEN 0x20000000 /* Allow access via iopen */ + #define EXT4_MOUNT_IOPEN_NOPRIV 0x40000000 /* Make iopen world-readable */ ++#define EXT4_MOUNT_NO_MBCACHE 0x80000000 /* Disable mbcache */ + + /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ + #ifndef clear_opt diff --git a/ldiskfs/kernel_patches/patches/ext4-disable-mb-cache-sles11.patch b/ldiskfs/kernel_patches/patches/ext4-disable-mb-cache-sles11.patch new file mode 100644 index 0000000..6482929 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext4-disable-mb-cache-sles11.patch @@ -0,0 +1,152 @@ +Index: linux-stage/fs/ext4/xattr.c +=================================================================== +--- linux-stage.orig/fs/ext4/xattr.c ++++ linux-stage/fs/ext4/xattr.c +@@ -86,7 +86,8 @@ + # define ea_bdebug(f...) + #endif + +-static void ext4_xattr_cache_insert(struct buffer_head *); ++static void ext4_xattr_cache_insert(struct super_block *, ++ struct buffer_head *); + static struct buffer_head *ext4_xattr_cache_find(struct inode *, + struct ext4_xattr_header *, + struct mb_cache_entry **); +@@ -233,7 +234,7 @@ bad_block: ext4_error(inode->i_sb, __fun + error = -EIO; + goto cleanup; + } +- ext4_xattr_cache_insert(bh); ++ ext4_xattr_cache_insert(inode->i_sb, bh); + entry = BFIRST(bh); + error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1); + if (error == -EIO) +@@ -375,7 +376,7 @@ ext4_xattr_block_list(struct inode *inod + error = -EIO; + goto cleanup; + } +- ext4_xattr_cache_insert(bh); ++ ext4_xattr_cache_insert(inode->i_sb, bh); + error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size); + + cleanup: +@@ -472,7 +473,9 @@ ext4_xattr_release_block(handle_t *handl + struct mb_cache_entry *ce = NULL; + int error = 0; + +- ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr); ++ if (!test_opt(inode->i_sb, NO_MBCACHE)) ++ ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, ++ bh->b_blocknr); + error = ext4_journal_get_write_access(handle, bh); + if (error) + goto out; +@@ -700,8 +703,10 @@ ext4_xattr_block_set(handle_t *handle, s + if (i->value && i->value_len > sb->s_blocksize) + return -ENOSPC; + if (s->base) { +- ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev, +- bs->bh->b_blocknr); ++ if (!test_opt(inode->i_sb, NO_MBCACHE)) ++ ce = mb_cache_entry_get(ext4_xattr_cache, ++ bs->bh->b_bdev, ++ bs->bh->b_blocknr); + error = ext4_journal_get_write_access(handle, bs->bh); + if (error) + goto cleanup; +@@ -718,7 +723,7 @@ ext4_xattr_block_set(handle_t *handle, s + if (!IS_LAST_ENTRY(s->first)) + ext4_xattr_rehash(header(s->base), + s->here); +- ext4_xattr_cache_insert(bs->bh); ++ ext4_xattr_cache_insert(sb, bs->bh); + } + unlock_buffer(bs->bh); + if (error == -EIO) +@@ -799,7 +804,8 @@ inserted: + if (error) + goto cleanup_dquot; + } +- mb_cache_entry_release(ce); ++ if (ce) ++ mb_cache_entry_release(ce); + ce = NULL; + } else if (bs->bh && s->base == bs->bh->b_data) { + /* We were modifying this block in-place. */ +@@ -832,7 +838,7 @@ getblk_failed: + memcpy(new_bh->b_data, s->base, new_bh->b_size); + set_buffer_uptodate(new_bh); + unlock_buffer(new_bh); +- ext4_xattr_cache_insert(new_bh); ++ ext4_xattr_cache_insert(sb, new_bh); + error = ext4_journal_dirty_metadata(handle, new_bh); + if (error) + goto cleanup; +@@ -1390,12 +1396,15 @@ ext4_xattr_put_super(struct super_block + * Returns 0, or a negative error number on failure. + */ + static void +-ext4_xattr_cache_insert(struct buffer_head *bh) ++ext4_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh) + { + __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); + struct mb_cache_entry *ce; + int error; + ++ if (test_opt(sb, NO_MBCACHE)) ++ return; ++ + ce = mb_cache_entry_alloc(ext4_xattr_cache, GFP_NOFS); + if (!ce) { + ea_bdebug(bh, "out of memory"); +@@ -1469,6 +1478,8 @@ ext4_xattr_cache_find(struct inode *inod + __u32 hash = le32_to_cpu(header->h_hash); + struct mb_cache_entry *ce; + ++ if (test_opt(inode->i_sb, NO_MBCACHE)) ++ return NULL; + if (!header->h_hash) + return NULL; /* never share */ + ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); +Index: linux-stage/fs/ext4/ext4.h +=================================================================== +--- linux-stage.orig/fs/ext4/ext4.h ++++ linux-stage/fs/ext4/ext4.h +@@ -550,6 +550,7 @@ do { \ + #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ + #define EXT4_MOUNT_IOPEN 0x10000000 /* Allow access via iopen */ + #define EXT4_MOUNT_IOPEN_NOPRIV 0x20000000 /* Make iopen world-readable */ ++#define EXT4_MOUNT_NO_MBCACHE 0x40000000 /* Disable mbcache */ + /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ + #ifndef clear_opt + #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt +Index: linux-stage/fs/ext4/super.c +=================================================================== +--- linux-stage.orig/fs/ext4/super.c ++++ linux-stage/fs/ext4/super.c +@@ -1333,6 +1333,7 @@ enum { + Opt_stripe, Opt_delalloc, Opt_nodelalloc, + Opt_inode_readahead_blks, Opt_bigendian_extents, + Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, ++ Opt_no_mbcache, + }; + + static match_table_t tokens = { +@@ -1396,6 +1397,7 @@ static match_table_t tokens = { + {Opt_nodelalloc, "nodelalloc"}, + {Opt_inode_readahead_blks, "inode_readahead_blks=%u"}, + {Opt_bigendian_extents, "bigendian_extents"}, ++ {Opt_no_mbcache, "no_mbcache"}, + {Opt_err, NULL}, + }; + +@@ -1819,6 +1821,9 @@ set_qf_format: + case Opt_force_over_8tb: + force_over_8tb = 1; + break; ++ case Opt_no_mbcache: ++ set_opt(sbi->s_mount_opt, NO_MBCACHE); ++ break; + default: + printk(KERN_ERR + "EXT4-fs: Unrecognized mount option \"%s\" " diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series index 038fe5f..bf03552e 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series @@ -29,3 +29,4 @@ ext4-extents-mount-option-rhel5.patch ext4-fiemap-2.6-rhel5.patch ext4-mballoc-skip-grps.patch ext4-back-dquot-to-rhel54.patch +ext4-disable-mb-cache-rhel5.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series index d75da9f..528b1e8 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series @@ -36,3 +36,4 @@ ext3-corrupted-orphans-2.6.patch ext3-kill-dx_root.patch ext3_data_in_dirent.patch ext3-fiemap-2.6-rhel5.patch +ext3-disable-mb-cache.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series index bc9d8be..23a2d31 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series @@ -39,3 +39,4 @@ ext3-dynlocks-common.patch ext3-dynlocks-2.6-rhel5.patch ext3-hash-indexed-dir-dotdot-update.patch ext3-corrupted-orphans-2.6.patch +ext3-disable-mb-cache.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series index dd8237d..4e0ec45 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series @@ -34,3 +34,4 @@ ext4-dynlocks-2.6.patch ext4-hash-indexed-dir-dotdot-update.patch ext4-disable-write-bar-by-default.patch ext4-mballoc-skip-grps.patch +ext4-disable-mb-cache-sles11.patch