From patchwork Tue May 3 13:35:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 93790 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 B1C4EB6F3E for ; Tue, 3 May 2011 23:35:23 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752613Ab1ECNfP (ORCPT ); Tue, 3 May 2011 09:35:15 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:36008 "EHLO test.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752512Ab1ECNfM (ORCPT ); Tue, 3 May 2011 09:35:12 -0400 Received: from root (helo=tytso-glaptop) by test.thunk.org with local-esmtp (Exim 4.69) (envelope-from ) id 1QHFks-0005uR-TF; Tue, 03 May 2011 13:35:11 +0000 Received: from tytso by tytso-glaptop with local (Exim 4.71) (envelope-from ) id 1QHFkr-0002VI-7D; Tue, 03 May 2011 09:35:09 -0400 Date: Tue, 3 May 2011 09:35:08 -0400 From: Ted Ts'o To: Peter Uchno Cc: linux-ext4@vger.kernel.org Subject: Re: Strange behavior when attempting to convert a file to extents using chattr Message-ID: <20110503133508.GA6462@thunk.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on test.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 28, 2011 at 04:14:59PM -0400, Peter Uchno wrote: > I recently converted an ext3 filesystem to ext4 in the hopes of > performance increases. However, I ran into a snag: > > In theory, chattr can be used to convert a file to extents using > "chattr +e foo". However, on my system (Archlinux, kernel 2.6.37.4), > the behavior of this command is unexpected. Given a file baz created > when the filesystem was still ext3 (and thus not using extents), > "chattr +e baz" returns zero but "lsattr baz" reveals the file is not > using extents. I found the problem; we were failing to set the extents flag at the conclusion of the migration run. The following patch should fix things. Thanks for reporting the problem, and my apologies for not catching this further. (/me makes a mental note to create an xfstests test for this case.) - Ted From 74e4e6db38918620bdf8a46e94982ead2b228d43 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 3 May 2011 09:34:42 -0400 Subject: [PATCH] ext4: set extents flag when migrating file to use extents Fix a typo that was introduced in commit 07a038245b (in 2.6.36) which caused the extents flag not to be set at the conclusion of converting an inode to use extents. Reported-by: Peter Uchno Signed-off-by: "Theodore Ts'o" --- fs/ext4/migrate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 92816b4..b57b98f 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -376,7 +376,7 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, * We have the extent map build with the tmp inode. * Now copy the i_data across */ - ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS); + ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS); memcpy(ei->i_data, tmp_ei->i_data, sizeof(ei->i_data)); /*