From: Bart Van Assche <bvanassche@acm.org>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-block <linux-block@vger.kernel.org>,
Damien Le Moal <Damien.LeMoal@wdc.com>,
Keith Busch <kbusch@kernel.org>,
"linux-scsi @ vger . kernel . org" <linux-scsi@vger.kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"linux-fsdevel @ vger . kernel . org"
<linux-fsdevel@vger.kernel.org>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v8 04/11] block: Introduce REQ_OP_ZONE_APPEND
Date: Mon, 27 Apr 2020 22:20:33 -0700 [thread overview]
Message-ID: <b0b44bd9-3047-b9e8-9635-ec5837844263@acm.org> (raw)
In-Reply-To: <20200427113153.31246-5-johannes.thumshirn@wdc.com>
On 2020-04-27 04:31, Johannes Thumshirn wrote:
> +/*
> + * Check write append to a zoned block device.
> + */
> +static inline blk_status_t blk_check_zone_append(struct request_queue *q,
> + struct bio *bio)
> +{
> + sector_t pos = bio->bi_iter.bi_sector;
> + int nr_sectors = bio_sectors(bio);
> +
> + /* Only applicable to zoned block devices */
> + if (!blk_queue_is_zoned(q))
> + return BLK_STS_NOTSUPP;
> +
> + /* The bio sector must point to the start of a sequential zone */
> + if (pos & (blk_queue_zone_sectors(q) - 1) ||
> + !blk_queue_zone_is_seq(q, pos))
> + return BLK_STS_IOERR;
> +
> + /*
> + * Not allowed to cross zone boundaries. Otherwise, the BIO will be
> + * split and could result in non-contiguous sectors being written in
> + * different zones.
> + */
> + if (blk_queue_zone_no(q, pos) != blk_queue_zone_no(q, pos + nr_sectors))
> + return BLK_STS_IOERR;
> +
> + /* Make sure the BIO is small enough and will not get split */
> + if (nr_sectors > q->limits.max_zone_append_sectors)
> + return BLK_STS_IOERR;
> +
> + bio->bi_opf |= REQ_NOMERGE;
> +
> + return BLK_STS_OK;
> +}
Since the above function has not changed compared to v7, I will repeat
my question about this function. Since 'pos' refers to the start of a
zone, is the "blk_queue_zone_no(q, pos) != blk_queue_zone_no(q, pos +
nr_sectors)" check identical to nr_sectors < q->limits.chunk_sectors?
Since q->limits.max_zone_append_sectors is guaranteed to be less than or
equal to the size of a zone, does that mean that the check
"blk_queue_zone_no(q, pos) != blk_queue_zone_no(q, pos + nr_sectors)" is
superfluous?
Thanks,
Bart.
next prev parent reply other threads:[~2020-04-28 5:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-27 11:31 [PATCH v8 00/11] Introduce Zone Append for writing to zoned block devices Johannes Thumshirn
2020-04-27 11:31 ` [PATCH v8 01/11] scsi: free sgtables in case command setup fails Johannes Thumshirn
2020-04-27 11:52 ` Hannes Reinecke
2020-04-27 11:31 ` [PATCH v8 02/11] block: provide fallbacks for blk_queue_zone_is_seq and blk_queue_zone_no Johannes Thumshirn
2020-04-27 11:53 ` Hannes Reinecke
2020-04-27 11:31 ` [PATCH v8 03/11] block: rename __bio_add_pc_page to bio_add_hw_page Johannes Thumshirn
2020-04-27 12:24 ` Hannes Reinecke
2020-04-27 11:31 ` [PATCH v8 04/11] block: Introduce REQ_OP_ZONE_APPEND Johannes Thumshirn
2020-04-27 12:30 ` Hannes Reinecke
2020-04-28 5:20 ` Bart Van Assche [this message]
2020-04-28 5:42 ` Damien Le Moal
2020-04-27 11:31 ` [PATCH v8 05/11] block: introduce blk_req_zone_write_trylock Johannes Thumshirn
2020-04-27 12:52 ` Hannes Reinecke
2020-04-27 11:31 ` [PATCH v8 06/11] block: Modify revalidate zones Johannes Thumshirn
2020-04-27 12:52 ` Hannes Reinecke
2020-04-27 11:31 ` [PATCH v8 07/11] scsi: sd_zbc: factor out sanity checks for zoned commands Johannes Thumshirn
2020-04-27 12:53 ` Hannes Reinecke
2020-04-27 11:31 ` [PATCH v8 08/11] scsi: sd_zbc: emulate ZONE_APPEND commands Johannes Thumshirn
2020-04-27 11:31 ` [PATCH v8 09/11] null_blk: Support REQ_OP_ZONE_APPEND Johannes Thumshirn
2020-04-27 11:31 ` [PATCH v8 10/11] block: export bio_release_pages and bio_iov_iter_get_pages Johannes Thumshirn
2020-04-27 11:31 ` [PATCH v8 11/11] zonefs: use REQ_OP_ZONE_APPEND for sync DIO Johannes Thumshirn
2020-04-27 12:27 ` Damien Le Moal
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=b0b44bd9-3047-b9e8-9635-ec5837844263@acm.org \
--to=bvanassche@acm.org \
--cc=Damien.LeMoal@wdc.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).