Patchwork ext4: teach ext4_free_blocks to handle multi journalled data blocks

login
register
mail settings
Submitter Yongqiang Yang
Date Dec. 31, 2011, 1:35 a.m.
Message ID <1325295339-6268-1-git-send-email-xiaoqiangnk@gmail.com>
Download mbox | patch
Permalink /patch/133729/
State New
Headers show

Comments

Yongqiang Yang - Dec. 31, 2011, 1:35 a.m.
This patch makes ext4_free_blocks work well with multi journaled data blocks.
Consider that journal mode of a file is changed from ordered mode to
jounral mode, then ext4_free_blocks() should record data blocks in revoke table.
ext4 with journal mode also needs ext4_free_blocks() to record data blocks
in revoke table.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
 fs/ext4/mballoc.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Patch

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index cb990b2..46f5a24 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4562,19 +4562,17 @@  void ext4_free_blocks(handle_t *handle, struct inode *inode,
 	trace_ext4_free_blocks(inode, block, count, flags);
 
 	if (flags & EXT4_FREE_BLOCKS_FORGET) {
-		struct buffer_head *tbh = bh;
 		int i;
 
 		BUG_ON(bh && (count > 1));
 
 		for (i = 0; i < count; i++) {
 			if (!bh)
-				tbh = sb_find_get_block(inode->i_sb,
+				bh = sb_find_get_block(inode->i_sb,
 							block + i);
-			if (unlikely(!tbh))
-				continue;
 			ext4_forget(handle, flags & EXT4_FREE_BLOCKS_METADATA,
-				    inode, tbh, block + i);
+				    inode, bh, block + i);
+			bh = NULL;
 		}
 	}