linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Forrest Liu <forrestl@synology.com>
Cc: Ashish Sangwan <ashishsangwan2@gmail.com>,
	Eric Sandeen <sandeen@redhat.com>,
	ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: fix extent tree corruption that incurred by hole punch
Date: Fri, 7 Dec 2012 17:29:22 -0500	[thread overview]
Message-ID: <20121207222922.GI29435@thunk.org> (raw)
In-Reply-To: <CAJSVwFOkH3MzdJTVm9M1fFycNqWr4oy+zUNaDUy0LPnXk=YZMg@mail.gmail.com>

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 <tytso@mit.edu>
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" <tytso@mit.edu>

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 <linux/falloc.h>
 #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;

  parent reply	other threads:[~2012-12-07 22:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04 12:11 [PATCH] ext4: fix extent tree corruption that incurred by hole punch Forrest Liu
2012-12-04 12:29 ` forrest
2012-12-05  6:13   ` Forrest Liu
2012-12-05  7:53     ` Ashish Sangwan
2012-12-05  8:09       ` Ashish Sangwan
2012-12-06 11:35         ` Forrest Liu
2012-12-06 13:16           ` Ashish Sangwan
2012-12-06 14:36             ` Forrest Liu
2012-12-07  5:11               ` Ashish Sangwan
2012-12-07 12:13                 ` Forrest Liu
2012-12-10  6:22                   ` Ashish Sangwan
2012-12-08 17:31   ` Eric Sandeen
2012-12-08 18:56     ` Forrest Liu
2012-12-06 15:45 ` Eric Sandeen
2012-12-06 15:48   ` Eric Sandeen
2012-12-07  5:53     ` Ashish Sangwan
2012-12-07 12:26       ` Forrest Liu
2012-12-07 22:17         ` Eric Sandeen
2012-12-08 19:01           ` Forrest Liu
2012-12-07 22:29         ` Theodore Ts'o [this message]
2012-12-08 19:29           ` Forrest Liu
  -- strict thread matches above, loose matches on Subject: below --
2012-12-04 11:32 Forrest Liu

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=20121207222922.GI29435@thunk.org \
    --to=tytso@mit.edu \
    --cc=ashishsangwan2@gmail.com \
    --cc=forrestl@synology.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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).