From 9bcafeec81ab3d4bda4b7855f645e0078771e5d8 Mon Sep 17 00:00:00 2001 From: deshmukh Date: Wed, 7 Oct 2009 07:47:12 +0000 Subject: [PATCH] b=20672 i=adilger i=bzzz Details: The pre-allocation tracker "bb_prealloc_nr" was not descrimented even if pre-allocation was free. This problem is fixed with this patch. Also some cleanup. --- .../patches/ext4-mballoc-extra-checks-rhel5.patch | 22 ++++++++++++++-------- lustre/lvfs/fsfilt_ext3.c | 21 +++++++++------------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ldiskfs/kernel_patches/patches/ext4-mballoc-extra-checks-rhel5.patch b/ldiskfs/kernel_patches/patches/ext4-mballoc-extra-checks-rhel5.patch index 7a77781..7522be2 100644 --- a/ldiskfs/kernel_patches/patches/ext4-mballoc-extra-checks-rhel5.patch +++ b/ldiskfs/kernel_patches/patches/ext4-mballoc-extra-checks-rhel5.patch @@ -1,7 +1,6 @@ -Index: linux-2.6.18-128.1.6/fs/ext4/mballoc.c -=================================================================== ---- linux-2.6.18-128.1.6.orig/fs/ext4/mballoc.c -+++ linux-2.6.18-128.1.6/fs/ext4/mballoc.c +diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/mballoc.c linux-2.6.18-128.1.6_2//fs/ext4/mballoc.c +--- linux-2.6.18-128.1.6_1//fs/ext4/mballoc.c 2009-09-28 16:38:04.000000000 +0530 ++++ linux-2.6.18-128.1.6_2//fs/ext4/mballoc.c 2009-09-28 16:40:35.000000000 +0530 @@ -660,7 +660,7 @@ static void ext4_mb_mark_free_simple(str } } @@ -299,10 +298,17 @@ Index: linux-2.6.18-128.1.6/fs/ext4/mballoc.c list_del(&pa->pa_group_list); ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa, ac); ext4_unlock_group(sb, group); -Index: linux-2.6.18-128.1.6/fs/ext4/mballoc.h -=================================================================== ---- linux-2.6.18-128.1.6.orig/fs/ext4/mballoc.h -+++ linux-2.6.18-128.1.6/fs/ext4/mballoc.h +@@ -4394,6 +4472,7 @@ ext4_mb_discard_lg_preallocations(struct + } + ext4_lock_group(sb, group); + list_del(&pa->pa_group_list); ++ ext4_get_group_info(sb, group)->bb_prealloc_nr--; + ext4_mb_release_group_pa(&e4b, pa, ac); + ext4_unlock_group(sb, group); + +diff -rupN linux-2.6.18-128.1.6_1//fs/ext4/mballoc.h linux-2.6.18-128.1.6_2//fs/ext4/mballoc.h +--- linux-2.6.18-128.1.6_1//fs/ext4/mballoc.h 2009-09-28 16:38:04.000000000 +0530 ++++ linux-2.6.18-128.1.6_2//fs/ext4/mballoc.h 2009-09-28 16:38:43.000000000 +0530 @@ -119,6 +119,7 @@ struct ext4_group_info { unsigned short bb_free; unsigned short bb_fragments; diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 9fe0f70..8cfbd00 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -99,9 +99,6 @@ extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, #define FSFILT_SINGLEDATA_TRANS_BLOCKS(sb) EXT3_SINGLEDATA_TRANS_BLOCKS #endif -#define fsfilt_ext3_journal_start(inode, nblocks) ext3_journal_start(inode, nblocks) -#define fsfilt_ext3_journal_stop(handle) ext3_journal_stop(handle) - static cfs_mem_cache_t *fcb_cache; struct fsfilt_cb_data { @@ -325,7 +322,7 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private, journal_start: LASSERTF(nblocks > 0, "can't start %d credit transaction\n", nblocks); - handle = fsfilt_ext3_journal_start(inode, nblocks); + handle = ext3_journal_start(inode, nblocks); if (!IS_ERR(handle)) LASSERT(current->journal_info == handle); @@ -462,7 +459,7 @@ static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso, } LASSERTF(needed > 0, "can't start %d credit transaction\n", needed); - handle = fsfilt_ext3_journal_start(fso->fso_dentry->d_inode, needed); + handle = ext3_journal_start(fso->fso_dentry->d_inode, needed); if (IS_ERR(handle)) { CERROR("can't get handle for %d credits: rc = %ld\n", needed, PTR_ERR(handle)); @@ -502,7 +499,7 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync) if (force_sync) handle->h_sync = 1; /* recovery likes this */ - rc = fsfilt_ext3_journal_stop(handle); + rc = ext3_journal_stop(handle); return rc; } @@ -523,7 +520,7 @@ static int fsfilt_ext3_commit_async(struct inode *inode, void *h, tid = transaction->t_tid; /* we don't want to be blocked */ handle->h_sync = 0; - rc = fsfilt_ext3_journal_stop(handle); + rc = ext3_journal_stop(handle); if (rc) { CERROR("error while stopping transaction: %d\n", rc); return rc; @@ -998,7 +995,7 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base, count = ext3_ext_calc_credits_for_insert(base, path); fsfilt_up_truncate_sem(inode); - handle = fsfilt_ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1); + handle = ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1); if (IS_ERR(handle)) { fsfilt_down_truncate_sem(inode); return PTR_ERR(handle); @@ -1007,7 +1004,7 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base, fsfilt_down_truncate_sem(inode); if (tgen != EXT_GENERATION(base)) { /* the tree has changed. so path can be invalid at moment */ - fsfilt_ext3_journal_stop(handle); + ext3_journal_stop(handle); return EXT_REPEAT; } @@ -1045,7 +1042,7 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base, BUG_ON(le32_to_cpu(nex.ee_block) != cex->ec_block); out: - fsfilt_ext3_journal_stop(handle); + ext3_journal_stop(handle); map: if (err >= 0) { /* map blocks */ @@ -1347,7 +1344,7 @@ static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize, block_count = (*offs & (blocksize - 1)) + bufsize; block_count = (block_count + blocksize - 1) >> inode->i_blkbits; - handle = fsfilt_ext3_journal_start(inode, + handle = ext3_journal_start(inode, block_count * FSFILT_DATA_TRANS_BLOCKS(inode->i_sb) + 2); if (IS_ERR(handle)) { CERROR("can't start transaction for %d blocks (%d bytes)\n", @@ -1360,7 +1357,7 @@ static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize, if (!err && force_sync) handle->h_sync = 1; /* recovery likes this */ - fsfilt_ext3_journal_stop(handle); + ext3_journal_stop(handle); return err; } -- 1.8.3.1