public inbox for [email protected]
 help / color / mirror / Atom feed
From: Hannes Reinecke <[email protected]>
To: John Garry <[email protected]>,
	[email protected], [email protected], [email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected]
Cc: [email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], [email protected],
	[email protected]
Subject: Re: [Patch v9 08/10] scsi: sd: Atomic write support
Date: Fri, 21 Jun 2024 08:15:14 +0200	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 6/20/24 14:53, John Garry wrote:
> Support is divided into two main areas:
> - reading VPD pages and setting sdev request_queue limits
> - support WRITE ATOMIC (16) command and tracing
> 
> The relevant block limits VPD page need to be read to allow the block layer
> request_queue atomic write limits to be set. These VPD page limits are
> described in sbc4r22 section 6.6.4 - Block limits VPD page.
> 
> There are five limits of interest:
> - MAXIMUM ATOMIC TRANSFER LENGTH
> - ATOMIC ALIGNMENT
> - ATOMIC TRANSFER LENGTH GRANULARITY
> - MAXIMUM ATOMIC TRANSFER LENGTH WITH BOUNDARY
> - MAXIMUM ATOMIC BOUNDARY SIZE
> 
> MAXIMUM ATOMIC TRANSFER LENGTH is the maximum length for a WRITE ATOMIC
> (16) command. It will not be greater than the device MAXIMUM TRANSFER
> LENGTH.
> 
> ATOMIC ALIGNMENT and ATOMIC TRANSFER LENGTH GRANULARITY are the minimum
> alignment and length values for an atomic write in terms of logical blocks.
> 
> Unlike NVMe, SCSI does not specify an LBA space boundary, but does specify
> a per-IO boundary granularity. The maximum boundary size is specified in
> MAXIMUM ATOMIC BOUNDARY SIZE. When used, this boundary value is set in the
> WRITE ATOMIC (16) ATOMIC BOUNDARY field - layout for the WRITE_ATOMIC_16
> command can be found in sbc4r22 section 5.48. This boundary value is the
> granularity size at which the device may atomically write the data. A value
> of zero in WRITE ATOMIC (16) ATOMIC BOUNDARY field means that all data must
> be atomically written together.
> 
> MAXIMUM ATOMIC TRANSFER LENGTH WITH BOUNDARY is the maximum atomic write
> length if a non-zero boundary value is set.
> 
> For atomic write support, the WRITE ATOMIC (16) boundary is not of much
> interest, as the block layer expects each request submitted to be executed
> atomically. However, the SCSI spec does leave itself open to a quirky
> scenario where MAXIMUM ATOMIC TRANSFER LENGTH is zero, yet MAXIMUM ATOMIC
> TRANSFER LENGTH WITH BOUNDARY and MAXIMUM ATOMIC BOUNDARY SIZE are both
> non-zero. This case will be supported.
> 
> To set the block layer request_queue atomic write capabilities, sanitize
> the VPD page limits and set limits as follows:
> - atomic_write_unit_min is derived from granularity and alignment values.
>    If no granularity value is not set, use physical block size
> - atomic_write_unit_max is derived from MAXIMUM ATOMIC TRANSFER LENGTH. In
>    the scenario where MAXIMUM ATOMIC TRANSFER LENGTH is zero and boundary
>    limits are non-zero, use MAXIMUM ATOMIC BOUNDARY SIZE for
>    atomic_write_unit_max. New flag scsi_disk.use_atomic_write_boundary is
>    set for this scenario.
> - atomic_write_boundary_bytes is set to zero always
> 
> SCSI also supports a WRITE ATOMIC (32) command, which is for type 2
> protection enabled. This is not going to be supported now, so check for
> T10_PI_TYPE2_PROTECTION when setting any request_queue limits.
> 
> To handle an atomic write request, add support for WRITE ATOMIC (16)
> command in handler sd_setup_atomic_cmnd(). Flag use_atomic_write_boundary
> is checked here for encoding ATOMIC BOUNDARY field.
> 
> Trace info is also added for WRITE_ATOMIC_16 command.
> 
> Reviewed-by: Martin K. Petersen <[email protected]>
> Signed-off-by: John Garry <[email protected]>
> ---
>   drivers/scsi/scsi_trace.c   | 22 +++++++++
>   drivers/scsi/sd.c           | 93 ++++++++++++++++++++++++++++++++++++-
>   drivers/scsi/sd.h           |  8 ++++
>   include/scsi/scsi_proto.h   |  1 +
>   include/trace/events/scsi.h |  1 +
>   5 files changed, 124 insertions(+), 1 deletion(-)
> 
Reviewed-by: Hannes Reinecke <[email protected]>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich


  reply	other threads:[~2024-06-21  6:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 12:53 [Patch v9 00/10] block atomic writes John Garry
2024-06-20 12:53 ` [Patch v9 01/10] block: Pass blk_queue_get_max_sectors() a request pointer John Garry
2024-06-20 14:12   ` Hannes Reinecke
2024-06-20 12:53 ` [Patch v9 02/10] block: Generalize chunk_sectors support as boundary support John Garry
2024-06-20 14:14   ` Hannes Reinecke
2024-06-20 12:53 ` [Patch v9 03/10] fs: Initial atomic write support John Garry
2024-06-21  5:56   ` Hannes Reinecke
2024-06-20 12:53 ` [Patch v9 04/10] fs: Add initial atomic write support info to statx John Garry
2024-06-21  5:57   ` Hannes Reinecke
2024-06-20 12:53 ` [Patch v9 05/10] block: Add core atomic write support John Garry
2024-06-20 19:34   ` Keith Busch
2024-06-21  6:09   ` Hannes Reinecke
2024-06-21  7:41     ` John Garry
2024-06-20 12:53 ` [Patch v9 06/10] block: Add atomic write support for statx John Garry
2024-06-20 19:46   ` Keith Busch
2024-06-21  6:10   ` Hannes Reinecke
2024-06-20 12:53 ` [Patch v9 07/10] block: Add fops atomic write support John Garry
2024-06-20 19:46   ` Keith Busch
2024-06-21  6:13   ` Hannes Reinecke
2024-06-21 12:02     ` John Garry
2024-06-21 21:23       ` Darrick J. Wong
2024-06-21  9:41   ` Kanchan Joshi
2024-06-20 12:53 ` [Patch v9 08/10] scsi: sd: Atomic " John Garry
2024-06-21  6:15   ` Hannes Reinecke [this message]
2024-06-20 12:53 ` [Patch v9 09/10] scsi: scsi_debug: " John Garry
2024-06-21  6:15   ` Hannes Reinecke
2024-06-20 12:53 ` [Patch v9 10/10] nvme: " John Garry
2024-06-20 20:36   ` Keith Busch
2024-06-21  6:17   ` Hannes Reinecke
2024-06-21  9:40   ` Kanchan Joshi
2024-06-20 21:23 ` [Patch v9 00/10] block atomic writes Jens Axboe
2024-06-21  7:59   ` John Garry
2024-06-21 14:28     ` Jens Axboe
2024-06-21 14:41       ` John Garry

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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