From: Qu Wenruo <wqu@suse.com>
To: Anand Jain <anand.jain@oracle.com>,
linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH RFC 4/4] btrfs-progs: convert: support ext2 unwritten file data extents
Date: Sat, 4 May 2024 09:36:33 +0930 [thread overview]
Message-ID: <eb812b45-e28d-430d-a7a3-5b73edcc8057@suse.com> (raw)
In-Reply-To: <7a33ff31-e570-4775-b82f-1c6413656699@oracle.com>
在 2024/5/4 08:57, Anand Jain 写道:
>
>
> On 5/4/24 06:23, Qu Wenruo wrote:
>>
>>
>> 在 2024/5/3 21:55, Anand Jain 写道:
>> [...]
>>>>> +int find_prealloc(struct blk_iterate_data *data, int index, bool
>>>>> *prealloc)
>>>>
>>>> This function is called for every file extent we're going to create.
>>>> I'm not a big fan of doing so many lookup.
>>>>
>>>> My question is, is this the only way to determine the flag of the
>>>> data extent?
>>>>
>>>> My instinct says there should be a straight forward way to determine
>>>> if a file extent is preallocated or not, just like what we do in our
>>>> file extent items.
>>>
>>>
>>>> Thus during the ext2fs_block_iterate2(), there should be some way to
>>>> tell if a block is preallocated or not.
>>>
>>> Unfortunately, the callback doesn't provide the extent flags. Unless,
>>> I miss something?
>>
>> You're right, the iterator interface does not provide any extra info.
>>
>> And I also checked the kernel implementation, they have extra
>> ext4_map_blocks() to do the resolve, and then ext4_es_lookup_extent()
>> to determine if it's unwritten.
>>
>> So I'm afraid we have to go this solution.
>>
>>
>> Meanwhile related to the implementation, can we put the prealloc flat
>> into blk_iterate_data?
>> So that we can handle different fses' preallocated extents in a more
>> common way.
>>
>
> I initially thought so, but is blk_iterate_data::num_blocks always
> equal to extent::e_len in all file data extent situations mixed
> with hole and unwritten combinations? If not, then the flag might
> not be appropriate there, as it doesn't apply to the entirety of
> blk_iterate_data::num_blocks.
I do not think we need @num_blocks to match extent_len.
We're already doing some kind of merge inside block_iterate_proc(), and
if we find previous extent flag doesn't match the current one, we just
need to submit the previous one.
Although I also believe we need some better abstraction for the common code.
The current one doesn't explain everything well for things parameters
like disk_block/file_block.
Thanks,
Qu
>
> Thanks, Anand
>
>> Thanks,
>> Qu
prev parent reply other threads:[~2024-05-04 0:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 9:08 [PATCH 0/4] btrfs-progs: add support ext4 unwritten file extent Anand Jain
2024-05-03 9:08 ` [PATCH 1/4] btrfs-progs: convert: refactor ext2_create_file_extents add argument ext2_inode Anand Jain
2024-05-03 9:08 ` [PATCH 2/4] btrfs-progs: convert: struct blk_iterate_data, add ext2-specific file inode pointers Anand Jain
2024-05-03 11:49 ` David Sterba
2024-05-03 13:09 ` Anand Jain
2024-05-03 9:08 ` [PATCH 3/4] btrfs-progs: convert: refactor __btrfs_record_file_extent to add a prealloc flag Anand Jain
2024-05-03 11:50 ` David Sterba
2024-05-03 13:10 ` Anand Jain
2024-05-03 9:08 ` [PATCH RFC 4/4] btrfs-progs: convert: support ext2 unwritten file data extents Anand Jain
2024-05-03 9:37 ` Qu Wenruo
2024-05-03 12:25 ` Anand Jain
2024-05-03 22:23 ` Qu Wenruo
2024-05-03 23:27 ` Anand Jain
2024-05-04 0:06 ` Qu Wenruo [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=eb812b45-e28d-430d-a7a3-5b73edcc8057@suse.com \
--to=wqu@suse.com \
--cc=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--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).