linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: linux-ext4 <linux-ext4@vger.kernel.org>
Subject: fiemap bugs on sparse files.
Date: Tue, 22 Feb 2011 16:18:53 -0500	[thread overview]
Message-ID: <1298409435-sup-2565@think> (raw)

[ resend, sorry if this is a dup ]

Hi everyone,

We've had reports on btrfs that cp is giving us files full of zeros
instead of actually copying them.  It was tracked down to a bug with
the btrfs fiemap implementation where it was returning holes for
delalloc ranges.

Newer versions of cp are trusting fiemap to tell it where the holes
are, which does seem like a pretty neat trick.

I decided to give xfs and ext4 a shot with a few tests cases too, xfs
passed with all the ones btrfs was getting wrong, and ext4 got the basic
delalloc case right.

# mkfs.ext4 /dev/xxx
# mount /dev/xxx /mnt
# dd if=/dev/zero of=/mnt/foo bs=1M count=1
# fiemap-test foo
ext:   0 logical: [       0..     255] phys:        0..     255 flags: 0x007 tot: 256

Horray!  But once we throw a hole in, things go bad:

# mkfs.ext4 /dev/xxx
# mount /dev/xxx /mnt
# dd if=/dev/zero of=/mnt/foo bs=1M count=1 seek=1
# fiemap-test foo
< no output >

We've got a delalloc extent after the hole and ext4 fiemap didn't find
it.  If I run sync to kick the delalloc out:

# sync
# fiemap-test foo
ext:   0 logical: [     256..     511] phys:    34048..   34303 flags: 0x001 tot: 256

fiemap-test is sitting in my /usr/local/bin, and I have no idea how it
got there.  It's full of pretty comments so I know it isn't mine, but
you can grab it here:

http://oss.oracle.com/~mason/fiemap-test.c

xfsqa has a fiemap program too.

-chris

             reply	other threads:[~2011-02-22 21:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 21:18 Chris Mason [this message]
2011-02-23  8:59 ` fiemap bugs on sparse files Yongqiang Yang
2011-02-23  9:34   ` Yongqiang Yang
2011-02-23 15:34     ` Eric Sandeen

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=1298409435-sup-2565@think \
    --to=chris.mason@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    /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).