All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/2] btrfs: btrfs_dec_test_*_ordered_extent() refactor
Date: Tue, 22 Dec 2020 13:37:36 +0800	[thread overview]
Message-ID: <adc81f87-58e2-7a63-d697-a789708a26ad@gmx.com> (raw)
In-Reply-To: <a612e52b-9c1d-880d-0056-762bbdac60ce@gmx.com>



On 2020/12/19 上午8:26, Qu Wenruo wrote:
>
>
> On 2020/12/18 下午11:57, David Sterba wrote:
>> On Fri, Dec 18, 2020 at 01:16:59PM +0800, Qu Wenruo wrote:
>>> This small patchset is btrfs_dec_test_*_ordered_extent() refactor during
>>> subpage RW support development.
>>>
>>> This is mostly to make btrfs_dev_test_* functions more human readable
>>> and prepare it for calling btrfs_dec_test_first_ordered_extent() in
>>> btrfs_writepage_endio_finish_ordered() where we can have one or more
>>> ordered extents for one bvec.
>>>
>>> Qu Wenruo (2):
>>>    btrfs: make btrfs_dio_private::bytes to be u32
>>>    btrfs: refactor btrfs_dec_test_* functions for ordered extents
>>
>> The idea makes sense but the patches are IMO in wrong order and still
>> leave some u64/u32, eg. in btrfs_dec_test_first_ordered_pending the
>> io_size is still u64 while for btrfs_dec_test_ordered_pending it
>> switches type to u32 (as expected).
>
> That u64 is left there and the reason is explained in the 2nd patch.
>
> Mostly due to iomap requirement.
>
> But I totally get your point.

After digging more, I prefer to give up the width reduction, but just
focus on the other cleanups in the patch.

The width reduction really needs more concern, especially when iomap is
involved.

Thanks,
Qu
>
> Thanks,
> Qu
>
>>
>> The type cleanup should be done bottom-up, from the leaf functions
>> upwards. After that, the structure type can be safely switched.
>>
>> I'm not sure what to do with __endio_write_update_ordered, it can take
>> u32 for bytes but internally uses u64 for ordered_bytes, that should be
>> u32 as well. But
>>
>>   7711                 if (ordered_offset < offset + bytes) {
>>   7712                         ordered_bytes = offset + bytes -
>> ordered_offset;
>>   7713                         ordered = NULL;
>>   7714                 }
>>
>> expression on line 7712 would need a temporary variable for the u64
>> calculation and then reassign. Maybe such conversions are inevitable so
>> we have clean function API and not pass u64 just because.
>>
>> I like that the hole btrfs_dio_private gets removed so the cleanups are
>> worthwhile, but maybe not trivial.
>>

      reply	other threads:[~2020-12-22  5:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  5:16 [PATCH 0/2] btrfs: btrfs_dec_test_*_ordered_extent() refactor Qu Wenruo
2020-12-18  5:17 ` [PATCH 1/2] btrfs: make btrfs_dio_private::bytes to be u32 Qu Wenruo
2020-12-18  5:17 ` [PATCH 2/2] btrfs: refactor btrfs_dec_test_* functions for ordered extents Qu Wenruo
2020-12-18 15:57 ` [PATCH 0/2] btrfs: btrfs_dec_test_*_ordered_extent() refactor David Sterba
2020-12-19  0:26   ` Qu Wenruo
2020-12-22  5:37     ` 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=adc81f87-58e2-7a63-d697-a789708a26ad@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=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 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.