From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Cc: wqu@suse.com, dsterba@suse.com, y16267966@gmail.com
Subject: Re: [PATCH v2 4/4] btrfs-progs: convert: support ext2 unwritten file data extents
Date: Tue, 7 May 2024 10:55:30 +0930 [thread overview]
Message-ID: <5da145c8-802d-4fd2-a52d-9a4c6fe37ea5@gmx.com> (raw)
In-Reply-To: <91f25251b1d57ee972179d707d13b453f43b5614.1714963428.git.anand.jain@oracle.com>
在 2024/5/6 12:34, Anand Jain 写道:
[...]
> 18619b678a5c207a971a0aa931604f48162e307c57ecdec450d5f095fe9f32c7 /mnt/test/foo
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v2:
>
> . Remove RFC
Nope, you didn't even test the patch using the selftests.
(Despite the RST introduced failure, the first ext2 is enough to expose
your bug).
Not to mention the lack of functionality to handle part written part
unwritten extents.
This is NOT acceptable at all.
> + if (ext2fs_extent_open2(src->ext2_fs, src->ext2_ino,
> + src->ext2_inode, &handle)) {
> + error("ext2fs_extent_open2 failed, inode %d", src->ext2_ino);
> + return -EINVAL;
> + }
Have you tried ext2?
ext2fs_extent_open()/open2() all needs the inode to have EXT4_EXTENTS_FL
flag, or it would immediately return error.
> +
> + if (ext2fs_extent_goto2(handle, 0, index)) {
> + error("ext2fs_extent_goto2 failed, inode %d num_blocks %llu",
> + src->ext2_ino, data->num_blocks);
> + ext2fs_extent_free(handle);
> + return -EINVAL;
> + }
> +
> + memset(&extent, 0, sizeof(struct ext2fs_extent));
> + if (ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent)) {
> + error("ext2fs_extent_get EXT2_EXTENT_CURRENT failed inode %d",
> + src->ext2_ino);
> + ext2fs_extent_free(handle);
> + return -EINVAL;
> + }
> +
> + if (extent.e_pblk != data->disk_block) {
> + error("inode %d index %d found wrong extent e_pblk %llu wanted disk_block %llu",
> + src->ext2_ino, index, extent.e_pblk, data->disk_block);
> + ext2fs_extent_free(handle);
> + return -EINVAL;
> + }
> +
> + if (extent.e_len != data->num_blocks) {
> + error("inode %d index %d: identified unsupported merged block length %u wanted %llu",
> + src->ext2_ino, index, extent.e_len, data->num_blocks);
> + ext2fs_extent_free(handle);
> + return -EINVAL;
> + }
You didn't handle the halfwritten extent correctly.
And it looks like you didn't even understand how to properly iterate
through all the extents.
In fact, if you really spent your time to check how debugfs
"dump_extents" command works, it would be clear that we can easily
iterate the split extents.
I strongly doubt if you're handling the case correctly or with any
responsibly.
I already have a small patch to properly handle all the legacy and newer
EXTENTS_FL features, and handle the uninit extents correctly.
I'll do cleanup the RST test case first, run the full convert tests at
least, with proper test case for it.
I appreciate your effort so far, but this is really below our standard.
Thanks,
Qu
next prev parent reply other threads:[~2024-05-07 1:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 3:04 [PATCH v2 0/4] btrfs-progs: add support ext4 unwritten file extent Anand Jain
2024-05-06 3:04 ` [PATCH v2 1/4] btrfs-progs: convert: refactor ext2_create_file_extents add argument ext2_inode Anand Jain
2024-05-06 3:04 ` [PATCH v2 2/4] btrfs-progs: convert: struct blk_iterate_data, add ext2-specific file inode pointers Anand Jain
2024-05-06 3:04 ` [PATCH v2 3/4] btrfs-progs: convert: refactor __btrfs_record_file_extent to add a prealloc flag Anand Jain
2024-05-06 3:04 ` [PATCH v2 4/4] btrfs-progs: convert: support ext2 unwritten file data extents Anand Jain
2024-05-06 5:41 ` Qu Wenruo
2024-05-06 5:59 ` Qu Wenruo
2024-05-06 9:56 ` Anand Jain
2024-05-06 10:25 ` Qu Wenruo
2024-05-07 1:25 ` Qu Wenruo [this message]
2024-05-09 9:17 ` Anand Jain
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=5da145c8-802d-4fd2-a52d-9a4c6fe37ea5@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
--cc=y16267966@gmail.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