Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 8/9] btrfs: convert zoned.c to use map->stripe_len
Date: Wed, 21 Oct 2026 08:46:58 +1030	[thread overview]
Message-ID: <8376153b-33cb-4ba0-abba-a4fdfdd93ec1@gmx.com> (raw)
In-Reply-To: <6bbc56c2-7853-408b-a5f1-7ae0de8b1444@wdc.com>



在 2026/10/20 21:37, Johannes Thumshirn 写道:
> On 19.10.26 08:40, Qu Wenruo wrote:
>> -        if (zone_info[i].alloc_offset & BTRFS_STRIPE_LEN_MASK)
>> +        if (zone_info[i].alloc_offset & (stripe_len - 1))
>>               break;
> 
> I think this would be a good opportunity for using IS_ALIGNED() here.

That's a good idea, I'll also update similar callsites in the series.

> 
>>       }
>>       stripe_nr = 0;
>> @@ -1619,8 +1621,8 @@ static int btrfs_load_block_group_raid0(struct 
>> btrfs_block_group *bg,
>>       if (last_alloc) {
>>           u32 factor = map->num_stripes;
>> -        stripe_nr = last_alloc >> BTRFS_STRIPE_LEN_SHIFT;
>> -        stripe_offset = last_alloc & BTRFS_STRIPE_LEN_MASK;
>> +        stripe_nr = last_alloc >> stripe_shift;
>> +        stripe_offset = last_alloc & (stripe_len - 1);
>>
> And ALIGN()?

ALIGN() is round_up(), which doesn't seem to fit here.

And considering IS_ALIGNED() is also using "(a) - 1" as the mask, I 
don't think there is a better way to generate a mask.

Thanks,
Qu

  reply	other threads:[~2026-10-20 22:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  6:39 [PATCH 0/9] btrfs: prepare for variable stripe_len Qu Wenruo
2026-10-19  6:39 ` [PATCH 1/9] btrfs: reduce the width of num_stripes and sub_stripes Qu Wenruo
2026-10-20  9:59   ` Johannes Thumshirn
2026-10-19  6:39 ` [PATCH 2/9] btrfs: load the on-disk btrfs_chunk::stripe_len Qu Wenruo
2026-10-20 10:01   ` Johannes Thumshirn
2026-10-19  6:39 ` [PATCH 3/9] btrfs: add btrfs_io_context::stripe_len and load it Qu Wenruo
2026-10-20 10:05   ` Johannes Thumshirn
2026-10-19  6:40 ` [PATCH 4/9] btrfs: change scrub to use stripe_len Qu Wenruo
2026-10-20 11:01   ` Johannes Thumshirn
2026-10-20 22:17     ` Qu Wenruo
2026-10-19  6:40 ` [PATCH 5/9] btrfs: add a new 'stripe_len' parameter to btrfs_stripe_nr_to_offset() Qu Wenruo
2026-10-19 21:52   ` kernel test robot
2026-10-19 22:05     ` Qu Wenruo
2026-10-19  6:40 ` [PATCH 6/9] btrfs: convert volumes.c and block-group.c to use map->stripe_len Qu Wenruo
2026-10-20 11:03   ` Johannes Thumshirn
2026-10-19  6:40 ` [PATCH 7/9] btrfs: convert raid56.c to use rbio->bioc->stripe_len Qu Wenruo
2026-10-19  6:40 ` [PATCH 8/9] btrfs: convert zoned.c to use map->stripe_len Qu Wenruo
2026-10-20 11:07   ` Johannes Thumshirn
2026-10-20 22:16     ` Qu Wenruo [this message]
2026-10-19  6:40 ` [PATCH 9/9] btrfs: introduce extra limits on btrfs_chunk::stripe_len Qu Wenruo
2026-10-20 11:23   ` Johannes Thumshirn
2026-10-19  7:45 ` [PATCH 0/9] btrfs: prepare for variable stripe_len Qu Wenruo

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=8376153b-33cb-4ba0-abba-a4fdfdd93ec1@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=johannes.thumshirn@wdc.com \
    --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