From 6a399e1cf0efb44b7654c3e8d639a4c3c9023f5d Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Mon, 8 Sep 2008 23:09:17 -0400 Subject: [PATCH] --- yaml --- r: 112939 b: refs/heads/master c: 68629f29c6764c37ebdceec2f6bbef6637eaf420 h: refs/heads/master i: 112937: 8942de6cdd2f12f0ac5e58a32b2d42fa858f92bc 112935: 4da79e0b5f90e7cb7f42abf34f0d1a299f5598ae v: v3 --- [refs] | 2 +- trunk/fs/ext4/balloc.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 6e95d9fc6dc5..410b5fd8b049 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5c79161689aede2d487d707d5931a22eadf66120 +refs/heads/master: 68629f29c6764c37ebdceec2f6bbef6637eaf420 diff --git a/trunk/fs/ext4/balloc.c b/trunk/fs/ext4/balloc.c index a425e78c73eb..ae26c37e398e 100644 --- a/trunk/fs/ext4/balloc.c +++ b/trunk/fs/ext4/balloc.c @@ -1804,15 +1804,17 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode, goto io_error; free_blocks = le16_to_cpu(gdp->bg_free_blocks_count); - /* - * if there is not enough free blocks to make a new resevation - * turn off reservation for this allocation - */ - if (my_rsv && (free_blocks < windowsz) - && (rsv_is_empty(&my_rsv->rsv_window))) - my_rsv = NULL; if (free_blocks > 0) { + /* + * try to allocate with group target block + * in the goal group. If we have low free_blocks + * count turn off reservation + */ + if (my_rsv && (free_blocks < windowsz) + && (rsv_is_empty(&my_rsv->rsv_window))) + my_rsv = NULL; + bitmap_bh = ext4_read_block_bitmap(sb, group_no); if (!bitmap_bh) goto io_error; @@ -1845,7 +1847,7 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode, * free blocks is less than half of the reservation * window size. */ - if (free_blocks <= (windowsz/2)) + if (my_rsv && (free_blocks <= (windowsz/2))) continue; brelse(bitmap_bh);