From patchwork Fri Dec 7 22:29:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 204616 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 C4E6F2C00A3 for ; Sat, 8 Dec 2012 09:29:29 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754257Ab2LGW32 (ORCPT ); Fri, 7 Dec 2012 17:29:28 -0500 Received: from li9-11.members.linode.com ([67.18.176.11]:37423 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751068Ab2LGW31 (ORCPT ); Fri, 7 Dec 2012 17:29:27 -0500 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.72) (envelope-from ) id 1Th6Px-00043E-Ae; Fri, 07 Dec 2012 22:29:13 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id 4777E240E87; Fri, 7 Dec 2012 17:29:22 -0500 (EST) Date: Fri, 7 Dec 2012 17:29:22 -0500 From: Theodore Ts'o To: Forrest Liu Cc: Ashish Sangwan , Eric Sandeen , ext4 development Subject: Re: [PATCH] ext4: fix extent tree corruption that incurred by hole punch Message-ID: <20121207222922.GI29435@thunk.org> References: <1354623069-8124-1-git-send-email-forrestl@synology.com> <50C0BDA2.4090203@redhat.com> <50C0BE40.5060003@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 Hi Forrest, Can you share an updated version of your patch (with Ashish's modification if you've tried testing that)? And also can you send us some automated way to create your test case? That might make it easier for us all to test the same thing and all be on the same page. I assume you have some C program which which is doing all of the punching? I started trying to create something via a script like this: touch testfile fallocate -l 1G testfile for i in $(seq 0 8192 1073741824) ; do fallocate -p -o $i -l 4k testfile ; done .. where fallocate is from contrib/fallocate.c in the e2fsprogs sources (not the fallocate from util-linux) with the attached patch to add support for the -p option to do the pnuching.... but then I decided it might be better if we all standardized on the same test case. Ideally, if the test case is small enough, we can put it in the commit message, or at very least we should look into getting it into xfstests, and Eric has suggested. Cheers, - Ted commit 2658b9616fe63d2fd9e2654676877ab014639a92 Author: Theodore Ts'o Date: Thu Dec 6 11:21:44 2012 -0500 contrib/fallocate: add support for punch functionality Also fix the -o option so it works correctly (instead of core dumping). 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/contrib/fallocate.c b/contrib/fallocate.c index 0e8319f..1436b70 100644 --- a/contrib/fallocate.c +++ b/contrib/fallocate.c @@ -35,6 +35,7 @@ // #include #define FALLOC_FL_KEEP_SIZE 0x01 +#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ void usage(void) { @@ -94,12 +95,17 @@ int main(int argc, char **argv) int error; int tflag = 0; - while ((opt = getopt(argc, argv, "nl:ot")) != -1) { + while ((opt = getopt(argc, argv, "npl:o:t")) != -1) { switch(opt) { case 'n': /* do not change filesize */ falloc_mode = FALLOC_FL_KEEP_SIZE; break; + case 'p': + /* punch mode */ + falloc_mode = (FALLOC_FL_PUNCH_HOLE | + FALLOC_FL_KEEP_SIZE); + break; case 'l': length = cvtnum(optarg); break;