Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
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 v10 6/9] scsi: sd_zbc: emulate ZONE_APPEND commands
Date: Wed, 6 May 2020 20:18:04 +0200	[thread overview]
Message-ID: <f031f491-620a-6b72-f16a-3702239b01c6@suse.de> (raw)
In-Reply-To: <20200506161145.9841-7-johannes.thumshirn@wdc.com>

On 5/6/20 6:11 PM, Johannes Thumshirn wrote:
> Emulate ZONE_APPEND for SCSI disks using a regular WRITE(16) command
> with a start LBA set to the target zone write pointer position.
> 
> In order to always know the write pointer position of a sequential write
> zone, the write pointer of all zones is tracked using an array of 32bits
> zone write pointer offset attached to the scsi disk structure. Each
> entry of the array indicate a zone write pointer position relative to
> the zone start sector. The write pointer offsets are maintained in sync
> with the device as follows:
> 1) the write pointer offset of a zone is reset to 0 when a
>     REQ_OP_ZONE_RESET command completes.
> 2) the write pointer offset of a zone is set to the zone size when a
>     REQ_OP_ZONE_FINISH command completes.
> 3) the write pointer offset of a zone is incremented by the number of
>     512B sectors written when a write, write same or a zone append
>     command completes.
> 4) the write pointer offset of all zones is reset to 0 when a
>     REQ_OP_ZONE_RESET_ALL command completes.
> 
> Since the block layer does not write lock zones for zone append
> commands, to ensure a sequential ordering of the regular write commands
> used for the emulation, the target zone of a zone append command is
> locked when the function sd_zbc_prepare_zone_append() is called from
> sd_setup_read_write_cmnd(). If the zone write lock cannot be obtained
> (e.g. a zone append is in-flight or a regular write has already locked
> the zone), the zone append command dispatching is delayed by returning
> BLK_STS_ZONE_RESOURCE.
> 
> To avoid the need for write locking all zones for REQ_OP_ZONE_RESET_ALL
> requests, use a spinlock to protect accesses and modifications of the
> zone write pointer offsets. This spinlock is initialized from sd_probe()
> using the new function sd_zbc_init().
> 
> Co-developed-by: Damien Le Moal <Damien.LeMoal@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>   drivers/scsi/sd.c     |  16 +-
>   drivers/scsi/sd.h     |  43 ++++-
>   drivers/scsi/sd_zbc.c | 363 +++++++++++++++++++++++++++++++++++++++---
>   3 files changed, 392 insertions(+), 30 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

  reply	other threads:[~2020-05-06 18:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 16:11 [PATCH v10 0/9] Introduce Zone Append for writing to zoned block devices Johannes Thumshirn
2020-05-06 16:11 ` [PATCH v10 1/9] block: rename __bio_add_pc_page to bio_add_hw_page Johannes Thumshirn
2020-05-06 18:16   ` Hannes Reinecke
2020-05-06 16:11 ` [PATCH v10 2/9] block: Introduce REQ_OP_ZONE_APPEND Johannes Thumshirn
2020-05-06 16:11 ` [PATCH v10 3/9] block: introduce blk_req_zone_write_trylock Johannes Thumshirn
2020-05-06 16:11 ` [PATCH v10 4/9] block: Modify revalidate zones Johannes Thumshirn
2020-05-06 16:11 ` [PATCH v10 5/9] scsi: sd_zbc: factor out sanity checks for zoned commands Johannes Thumshirn
2020-05-06 16:11 ` [PATCH v10 6/9] scsi: sd_zbc: emulate ZONE_APPEND commands Johannes Thumshirn
2020-05-06 18:18   ` Hannes Reinecke [this message]
2020-05-06 16:11 ` [PATCH v10 7/9] null_blk: Support REQ_OP_ZONE_APPEND Johannes Thumshirn
2020-05-06 16:11 ` [PATCH v10 8/9] block: export bio_release_pages and bio_iov_iter_get_pages Johannes Thumshirn
2020-05-06 16:11 ` [PATCH v10 9/9] zonefs: use REQ_OP_ZONE_APPEND for sync DIO Johannes Thumshirn

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=f031f491-620a-6b72-f16a-3702239b01c6@suse.de \
    --to=hare@suse.de \
    --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 \
    --subject='Re: [PATCH v10 6/9] scsi: sd_zbc: emulate ZONE_APPEND commands' \
    /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

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).