From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Coly Li <colyli@suse.de>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"hare@suse.com" <hare@suse.com>, "hch@lst.de" <hch@lst.de>,
"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-bcache@vger.kernel.org" <linux-bcache@vger.kernel.org>,
"kbusch@kernel.org" <kbusch@kernel.org>,
Hannes Reinecke <hare@suse.de>, Jens Axboe <axboe@fb.com>,
Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Shaun Tancheff <shaun.tancheff@seagate.com>
Subject: Re: [RFC PATCH v2 1/4] block: change REQ_OP_ZONE_RESET from 6 to 13
Date: Mon, 18 May 2020 00:33:21 +0000 [thread overview]
Message-ID: <BY5PR04MB69005621AE920061F7FD383CE7B80@BY5PR04MB6900.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200516035434.82809-2-colyli@suse.de
On 2020/05/16 12:55, Coly Li wrote:
> For a zoned device, e.g. host managed SMR hard drive, REQ_OP_ZONE_RESET
> is to reset the LBA of a zone's write pointer back to the start LBA of
> this zone. After the write point is reset, all previously stored data
> in this zone is invalid and unaccessible anymore. Therefore, this op
> code changes on disk data, belongs to a WRITE request op code.
>
> Current REQ_OP_ZONE_RESET is defined as number 6, but the convention of
> the op code is, READ requests are even numbers, and WRITE requests are
> odd numbers. See how op_is_write defined,
>
> 397 static inline bool op_is_write(unsigned int op)
> 398 {
> 399 return (op & 1);
> 400 }
>
> When create bcache device on top of the zoned SMR drive, bcache driver
> has to handle the REQ_OP_ZONE_RESET bio by invalidate all cached data
> belongs to the LBA range of the restting zone. A wrong op code value
> will make the this zone management bio goes into bcache' read requests
> code path and causes undefined result.
>
> This patch changes REQ_OP_ZONE_RESET value from 6 to 13, the new odd
> number will make bcache driver handle this zone management bio properly
> in write requests code path.
>
> Fixes: 87374179c535 ("block: add a proper block layer data direction encoding")
> Signed-off-by: Coly Li <colyli@suse.de>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Damien Le Moal <damien.lemoal@wdc.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Jens Axboe <axboe@fb.com>
> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Cc: Keith Busch <kbusch@kernel.org>
> Cc: Shaun Tancheff <shaun.tancheff@seagate.com>
> ---
> include/linux/blk_types.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index 31eb92876be7..8f7bc15a6de3 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -282,8 +282,6 @@ enum req_opf {
> REQ_OP_DISCARD = 3,
> /* securely erase sectors */
> REQ_OP_SECURE_ERASE = 5,
> - /* reset a zone write pointer */
> - REQ_OP_ZONE_RESET = 6,
> /* write the same sector many times */
> REQ_OP_WRITE_SAME = 7,
> /* reset all the zone present on the device */
> @@ -296,6 +294,8 @@ enum req_opf {
> REQ_OP_ZONE_CLOSE = 11,
> /* Transition a zone to full */
> REQ_OP_ZONE_FINISH = 12,
> + /* reset a zone write pointer */
> + REQ_OP_ZONE_RESET = 13,
As Chaitanya pointed out, this is already used. Please rebase on Jens
block/for-5.8/block branch.
I do not see any problem with this change, but as Christoph commented, since
zone reset does not transfer any data, I do not really see the necessity for
this. Zone reset is indeed data-destructive, but it is not a "write" command.
But following DISCARD and having the op number as an odd number is OK I think.
>
> /* SCSI passthrough using struct scsi_request */
> REQ_OP_SCSI_IN = 32,
>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2020-05-18 0:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-16 3:54 [RFC PATCH v2 0/4] block layer change necessary for bcache zoned device support Coly Li
2020-05-16 3:54 ` [RFC PATCH v2 1/4] block: change REQ_OP_ZONE_RESET from 6 to 13 Coly Li
2020-05-16 4:06 ` Chaitanya Kulkarni
2020-05-16 9:33 ` Coly Li
2020-05-16 12:38 ` Christoph Hellwig
2020-05-16 12:44 ` Coly Li
2020-05-16 12:50 ` Christoph Hellwig
2020-05-16 13:05 ` Coly Li
2020-05-16 15:36 ` Christoph Hellwig
2020-05-17 5:30 ` Coly Li
2020-05-18 6:53 ` Hannes Reinecke
2020-05-18 6:56 ` Damien Le Moal
2020-05-18 0:33 ` Damien Le Moal [this message]
2020-05-18 5:09 ` Chaitanya Kulkarni
2020-05-16 3:54 ` [RFC PATCH v2 2/4] block: block: change REQ_OP_ZONE_RESET_ALL from 8 to 15 Coly Li
2020-05-18 0:36 ` Damien Le Moal
2020-05-16 3:54 ` [RFC PATCH v2 3/4] block: remove queue_is_mq restriction from blk_revalidate_disk_zones() Coly Li
2020-05-16 12:40 ` Christoph Hellwig
2020-05-16 13:13 ` Coly Li
2020-05-16 15:35 ` Christoph Hellwig
2020-05-18 1:07 ` Damien Le Moal
2020-05-18 0:39 ` Damien Le Moal
2020-05-16 3:54 ` [RFC PATCH v2 4/4] block: set bi_size to REQ_OP_ZONE_RESET bio Coly Li
2020-05-16 12:53 ` Christoph Hellwig
2020-05-18 0:59 ` Damien Le Moal
2020-05-18 2:32 ` Coly Li
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=BY5PR04MB69005621AE920061F7FD383CE7B80@BY5PR04MB6900.namprd04.prod.outlook.com \
--to=damien.lemoal@wdc.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=axboe@fb.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=hare@suse.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=shaun.tancheff@seagate.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).