public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@infradead.org>,
	Naohiro Aota <naohiro.aota@wdc.com>
Cc: linux-btrfs@vger.kernel.org, axboe@kernel.dk,
	linux-block@vger.kernel.org
Subject: Re: [PATCH 1/2] block: introduce zone capacity helper
Date: Wed, 12 Mar 2025 15:55:31 +0900	[thread overview]
Message-ID: <dfa516c7-2a4f-45c5-a184-0b0e64336c38@kernel.org> (raw)
In-Reply-To: <Z9EbSZh-OtLGttoB@infradead.org>

On 3/12/25 14:27, Christoph Hellwig wrote:
> On Wed, Mar 12, 2025 at 10:31:03AM +0900, Naohiro Aota wrote:
>> +#ifdef CONFIG_BLK_DEV_ZONED
>> +static inline unsigned int disk_zone_capacity(struct gendisk *disk, sector_t pos)
> 
> Overly long line.
> 
>> +{
>> +	sector_t zone_sectors = disk->queue->limits.chunk_sectors;
>> +
>> +	if (pos + zone_sectors >= get_capacity(disk))
>> +		return disk->last_zone_capacity;
>> +	return disk->zone_capacity;
> 
> But I also don't understand how pos plays in here.  Maybe add a
> kerneldoc comment describing what the function is supposed to do?

The last zone can be smaller than all other zones, hence we have
disk->zone_capacity and disk->last_zone_capacity. Pos is a sector used to
indicate the zone for which you want the capacity.

But yes, agreed, a kernel doc would be nice to clarify that.


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2025-03-12  6:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12  1:31 [PATCH 0/2] btrfs: zoned: skip reporting zone for new block group Naohiro Aota
2025-03-12  1:31 ` [PATCH 1/2] block: introduce zone capacity helper Naohiro Aota
2025-03-12  1:39   ` Damien Le Moal
2025-03-12  2:07     ` Naohiro Aota
2025-03-12  5:27   ` Christoph Hellwig
2025-03-12  6:55     ` Damien Le Moal [this message]
2025-03-12  7:00       ` Christoph Hellwig
2025-03-12  7:11         ` Damien Le Moal
2025-03-12  1:31 ` [PATCH 2/2] btrfs: zoned: skip reporting zone for new block group Naohiro Aota
2025-03-12  1:42   ` Damien Le Moal
2025-03-13  2:24     ` Shinichiro Kawasaki

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=dfa516c7-2a4f-45c5-a184-0b0e64336c38@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.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