Re: [PATCH v2 0/3] btrfs: btrfs_bio and btrfs_io_bio rename

Qu Wenruo
2021-09-14T22:20:39Z

On 2021/9/15 上午12:25, David Sterba wrote:
> On Tue, Sep 14, 2021 at 09:25:40AM +0800, Qu Wenruo wrote:
>> The branch can be fetched from github, and is the preferred way to grab
>> the code, as this patchset changed quite a lot of code.
>> https://github.com/adam900710/linux/tree/chunk_refactor
>>
>> There are two structure, btrfs_io_bio and btrfs_bio, which have very
>> similar names but completely different meanings.
>>
>> Btrfs_io_bio mostly works at logical bytenr layer (its
>> bio->bi_iter.bi_sector points to btrfs logical bytenr), and just
>> contains extra info like csum and mirror_num.
>>
>> And btrfs_io_bio is in fact the most utilized bio, as all data/metadata
>> IO is using btrfs_io_bio.
>>
>> While btrfs_bio is completely a helper structure for stripe IO
>> submission (RAID56 doesn't utilize it for IO submission).
>>
>> Such naming is completely anti-human.
>>
>> So this patchset will do the following renaming:
>>
>> - btrfs_bio -> btrfs_io_context
>> Since it's not really used by all bios (only mirrored profiles utilize
>> it), and it contains extra info for RAID56, it's not proper to name it
>> with _bio suffix.
>>
>> Later we can integrate btrfs_io_context pointer into the new
>> btrfs_bio.
>>
>> - btrfs_io_bio -> btrfs_bio
>> I originally plan to rename it to btrfs_logical_bio, but it's a little
>> too long for a lot of functions.
>
> This sounds all good. The only dangerous thing is that btrfs_bio now
> means something else, so that can become problem with backports or
> requiring to do a mental switch when reading before/after the version it
> appears.
>
So the original idea of btrfs_io_bio->btrfs_logical_bio would be better
in this particular case, right?

Thanks,
Qu