All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: 8001@debbugs.gnu.org, BTRFS MAILING LIST <linux-btrfs@vger.kernel.org>
Subject: Re: bug#8001: cp (8.10) sparse handling fails on compressed btrfs (cp/fiemap-2)
Date: Wed, 09 Feb 2011 10:57:14 +0000	[thread overview]
Message-ID: <4D52730A.2080008@draigBrady.com> (raw)
In-Reply-To: <201102072253.34476.vapier@gentoo.org>

On 08/02/11 03:53, Mike Frysinger wrote:
> after upgrading from coreutils 8.9 to 8.10, the sparse handling in cp=
 is=20
> silently breaking on btrfs filesystems with the compressed option ena=
bled. =20
> using --sparse=3Dnever works fine, but "auto" or "always" tend to fai=
l.  the=20
> cp/fiemap-2 test catches the issue nicely.
>=20
> to reproduce (i'm using linux-2.6.37):
> file=3Dbtrfs.img
> mntp=3D/mnt/tmp/
> dd if=3D/dev/zero of=3D$file bs=3D1M count=3D0 seek=3D1024
> mkfs.btrfs $file=20
> mount -t btrfs -o compress $file $mntp
> cd $mntp
> tar xf ~/coreutils-8.10.tar.xz
> cd coreutils-8.10/tests
> ./cp/fiemap-2
>=20
> and this last test shows:
> Filesystem    Type   1K-blocks      Used Available Use% Mounted on
> /dev/loop0   btrfs     1048576     20420    377028   6% /mnt/tmp
> 0+0 records in
> 0+0 records out
> 0 bytes (0 B) copied, 2.7598e-05 s, 0.0 kB/s
> k k2 differ: byte 1, line 1

Eek.

That doesn't trigger here (2.6.35.10-72.fc14.i686)
because I guess this kernel doesn't honor the compress attribute:

dd if=3D/dev/zero of=3Dtest.size count=3D1000
# du -B512 test.size
1000    test.size

But on a general note, we may read more (or possibly less)
than is stored in the extent. So how to detect that?
I suppose one could use lseek() to get the current position
and see if it's ext_start + ext_length, otherwise adjust accordingly.
That would add a little overhead though.
I also notice the FIEMAP_EXTENT_DATA_ENCRYPTED and FIEMAP_EXTENT_ENCODE=
D
flags, which could mean we only need to handle these extents specially.
Does `filefrag -v` show those for you? I see nothing here.

I don't suppose there is any facility to read the raw data
to also avoid decompressing and compressing again (sendfile, mmap?).

cheers,
P=E1draig.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

       reply	other threads:[~2011-02-09 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201102072253.34476.vapier@gentoo.org>
2011-02-09 10:57 ` Pádraig Brady [this message]
2011-02-19 18:28   ` bug#8001: cp (8.10) sparse handling fails on compressed btrfs (cp/fiemap-2) Mike Frysinger
2011-02-19 23:22     ` Pádraig Brady
2011-02-20  0:39       ` Pádraig Brady
2011-02-20  0:53       ` Mike Frysinger
2011-02-23  3:31         ` Chris Mason
2011-02-23  9:49           ` Pádraig Brady

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=4D52730A.2080008@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=8001@debbugs.gnu.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=vapier@gentoo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.