From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/3] btrfs-progs: convert: proper ext4 unwritten extents handling
Date: Mon, 3 Jun 2024 22:14:50 +0200 [thread overview]
Message-ID: <20240603201450.GD12376@twin.jikos.cz> (raw)
In-Reply-To: <cover.1715051693.git.wqu@suse.com>
On Tue, May 07, 2024 at 12:52:52PM +0930, Qu Wenruo wrote:
> [REPO]
> https://github.com/adam900710/btrfs-progs/tree/unwritten_extent
>
> There is a bug report that ext4 unwritten extents (extent with
> EXT2_EXTENT_FLAGS_UNINIT, acts the same as BTRFS_FILE_EXTENT_PREALLOC)
> would result a regular btrfs file extent.
>
> Instead of filling the range with zero, converted btrfs would read
> whatever from the disk, causing corruption.
>
> Although there are some attempts trying to fix the problem, the resulted
> patches are not meeting our standard, so I have to come up a fix by
> myself.
>
> The root cause is that, ext2fs_block_iterate2() won't report any extent
> info, thus it's more or less only useful for ext2 filesystems.
> For ext4 filesystems, inodes can have a feature called EXT4_EXTENTS_FL,
> allowing a proper extent based iteratioin.
>
> So this patch would keep the old ext2fs_block_iterate2() as fallback (as
> for older ext2 fses, they do not support fallocate anyway), while for
> newer ext4 fses, go with ect2fs_extent_*() APIs to iterate the file
> extents.
>
> The new APIs provides the extra extent.e_flags to indicate whether the
> extent is unwritten or not.
> For unwritten extents, we just puch it as a hole for now, since even if
> we create a correct preallocated file extent, the space can not be
> utlized as it's shared between the file extent and ext2 image.
>
> So just punching a hole would be the simplest workaround for now.
>
> Qu Wenruo (3):
> Revert "btrfs-progs: convert: add raid-stripe-tree to allowed
> features"
> btrfs-progs: convert: rework file extent iteration to handle unwritten
> extents
> btrfs-progs: tests/convert: add test case for ext4 unwritten extents
Added to devel, thanks.
prev parent reply other threads:[~2024-06-03 20:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 3:22 [PATCH 0/3] btrfs-progs: convert: proper ext4 unwritten extents handling Qu Wenruo
2024-05-07 3:22 ` [PATCH 1/3] Revert "btrfs-progs: convert: add raid-stripe-tree to allowed features" Qu Wenruo
2024-05-07 3:22 ` [PATCH 2/3] btrfs-progs: convert: rework file extent iteration to handle unwritten extents Qu Wenruo
2024-05-07 7:48 ` Yordan
2024-05-07 3:22 ` [PATCH 3/3] btrfs-progs: tests/convert: add test case for ext4 " Qu Wenruo
2024-06-03 20:14 ` David Sterba [this message]
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=20240603201450.GD12376@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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