From patchwork Fri Apr 19 06:17:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 237852 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 CA2912C0214 for ; Fri, 19 Apr 2013 16:17:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756395Ab3DSGRb (ORCPT ); Fri, 19 Apr 2013 02:17:31 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:42790 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755309Ab3DSGRa (ORCPT ); Fri, 19 Apr 2013 02:17:30 -0400 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1UT4dm-0007bp-53; Fri, 19 Apr 2013 06:17:46 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id C44055823BB; Fri, 19 Apr 2013 02:17:27 -0400 (EDT) Date: Fri, 19 Apr 2013 02:17:27 -0400 From: Theodore Ts'o To: "Darrick J. Wong" Cc: Zheng Liu , Ext4 Developers List Subject: Re: [PATCH] ext4: disable defrag for metadata_csum file systems Message-ID: <20130419061727.GA10053@thunk.org> References: <1366322282-4673-1-git-send-email-tytso@mit.edu> <51707E06.2050105@gmail.com> <20130419054738.GA5617@blackbox.djwong.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130419054738.GA5617@blackbox.djwong.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Apr 18, 2013 at 10:47:38PM -0700, Darrick J. Wong wrote: > > I think this happens because mext_insert_extents() open-codes the metadata > dirtying and forgets to update the extent block header. It should call > ext4_ext_dirty() at the end, instead. :( Yes. The following patch seems to fix the problem. I'm wondering if we could significantly simplify the move_extent.c file by allocating two tmp_inodes and then using ext4_ext_insert_extent() the same way fs/ext4/migrate.c handles things. But that's a potential cleanup for later.... - Ted commit fa3a0fc57b3d3c885dd7354508c9f20fc0c4a184 Author: Theodore Ts'o Date: Fri Apr 19 02:14:18 2013 -0400 ext4: set the extent leaf checksum when processing EXT4_IOC_MOVE_EXT The EXT4_IOC_MOVE_EXT which is used by the e4defrag program was not properly setting the checksum in the extent leaf block. Fix this. Signed-off-by: "Theodore Ts'o" --- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 779d26b..269122e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2574,6 +2574,11 @@ extern int ext4_check_blockref(const char *, unsigned int, struct ext4_ext_path; struct ext4_extent; +#define ext4_ext_dirty(handle, inode, path) \ + ext4__ext_dirty(__func__, __LINE__, (handle), (inode), (path)) +extern int ext4__ext_dirty(const char *where, unsigned int line, + handle_t *handle, struct inode *inode, + struct ext4_ext_path *path); extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 6fcb375..ff019ed 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -157,11 +157,8 @@ static int ext4_ext_get_access(handle_t *handle, struct inode *inode, * - ENOMEM * - EIO */ -#define ext4_ext_dirty(handle, inode, path) \ - __ext4_ext_dirty(__func__, __LINE__, (handle), (inode), (path)) -static int __ext4_ext_dirty(const char *where, unsigned int line, - handle_t *handle, struct inode *inode, - struct ext4_ext_path *path) +int ext4__ext_dirty(const char *where, unsigned int line, handle_t *handle, + struct inode *inode, struct ext4_ext_path *path) { int err; if (path->p_bh) { diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 309ca89..a05a622 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -410,8 +410,7 @@ mext_insert_extents(handle_t *handle, struct inode *orig_inode, end_ext, eh, range_to_move); if (depth) { - ret = ext4_handle_dirty_metadata(handle, orig_inode, - orig_path->p_bh); + ret = ext4_ext_dirty(handle, orig_inode, orig_path); if (ret) return ret; } else {