linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yongqiang Yang <xiaoqiangnk@gmail.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, Yongqiang Yang <xiaoqiangnk@gmail.com>
Subject: [PATCH] ext4: teach ext4_free_blocks to handle multi journalled data blocks
Date: Sat, 31 Dec 2011 09:35:39 +0800	[thread overview]
Message-ID: <1325295339-6268-1-git-send-email-xiaoqiangnk@gmail.com> (raw)

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(-)

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;
 		}
 	}
 
-- 
1.7.5.1


                 reply	other threads:[~2011-12-31  5:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325295339-6268-1-git-send-email-xiaoqiangnk@gmail.com \
    --to=xiaoqiangnk@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).