From patchwork Sat Dec 31 01:35:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqiang Yang X-Patchwork-Id: 133729 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DDF16B6FA1 for ; Sat, 31 Dec 2011 16:17:23 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750709Ab1LaFRL (ORCPT ); Sat, 31 Dec 2011 00:17:11 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:45317 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705Ab1LaFRK (ORCPT ); Sat, 31 Dec 2011 00:17:10 -0500 Received: by iaeh11 with SMTP id h11so26286334iae.19 for ; Fri, 30 Dec 2011 21:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=xwJqVkYD3/t35W8CvUBhXACHIK8lgC32GS9HPPoA5ik=; b=PQOYDFwUhiUa/EgIb/59EMV2R+Gci3a5ngw3tOA7yboujK/MeMaJeH9p2UYGJTxcb1 WeOfx3aUK6vps5arE+EwxW+b/Y0pXVg8DbMcJip5OlmeHKR/HCHVmkWonE6fR4Hdxul4 6kNqt/NhUu/LeZ60BkU8WNc07O1I2oXN/IC98= Received: by 10.50.47.228 with SMTP id g4mr49256228ign.14.1325308629992; Fri, 30 Dec 2011 21:17:09 -0800 (PST) Received: from localhost.localdomain ([159.226.43.44]) by mx.google.com with ESMTPS id rc7sm89932572igb.0.2011.12.30.21.17.07 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Dec 2011 21:17:09 -0800 (PST) From: Yongqiang Yang To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Yongqiang Yang Subject: [PATCH] ext4: teach ext4_free_blocks to handle multi journalled data blocks Date: Sat, 31 Dec 2011 09:35:39 +0800 Message-Id: <1325295339-6268-1-git-send-email-xiaoqiangnk@gmail.com> X-Mailer: git-send-email 1.7.5.1 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- 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; } }