From patchwork Mon Dec 24 07:55:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC, 1/9, v1] ext4: fixup metadata reserve block warning when bigalloc and delalloc are enabled Date: Sun, 23 Dec 2012 21:55:34 -0000 From: Zheng Liu X-Patchwork-Id: 208031 Message-Id: <1356335742-11793-2-git-send-email-wenqing.lz@taobao.com> To: linux-ext4@vger.kernel.org Cc: Zheng Liu From: Zheng Liu When bigalloc and delalloc are enabled, some stress tests (e.g. xfstest #13) will trigger this warning because all metadata reserved spaces will be released after dirty pages are written out. But we still needs to allocate one block, such as growing the extent tree. So *DO NOT* release these metadata blocks when bigalloc and delaloc are enabled. Signed-off-by: Zheng Liu --- fs/ext4/inode.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index cb1c1ab..91542be 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -375,10 +375,16 @@ void ext4_da_update_reserve_space(struct inode *inode, * We can release all of the reserved metadata blocks * only when we have written all of the delayed * allocation blocks. + * When bigalloc and delalloc are enabled, we couldn't release + * all of reserved metadata blocks, although all delay blocks + * are written out, because it still has some metadata blocks + * which are allocated. */ - percpu_counter_sub(&sbi->s_dirtyclusters_counter, - ei->i_reserved_meta_blocks); - ei->i_reserved_meta_blocks = 0; + if (sbi->s_cluster_ratio == 1) { + percpu_counter_sub(&sbi->s_dirtyclusters_counter, + ei->i_reserved_meta_blocks); + ei->i_reserved_meta_blocks = 0; + } ei->i_da_metadata_calc_len = 0; } spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);