linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Damien Le Moal <damien.lemoal@wdc.com>
Cc: linux-scsi@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <Bart.VanAssche@sandisk.com>
Subject: Re: [PATCH V2 1/2] scsi: sd: Fix sd_config_write_same()
Date: Thu, 31 Aug 2017 23:36:22 -0400	[thread overview]
Message-ID: <yq1tw0num2x.fsf@oracle.com> (raw)
In-Reply-To: <20170901010729.16524-2-damien.lemoal@wdc.com> (Damien Le Moal's message of "Fri, 1 Sep 2017 10:07:28 +0900")


Damien,

> +	if (sdkp->max_ws_blocks &&
> +	    sdkp->physical_block_size > logical_block_size) {
> +		/*
> +		 * Reporting a maximum number of blocks that is not aligned
> +		 * on the device physical size would cause a large write same
> +		 * request to be split into physically unaligned chunks by
> +		 * __blkdev_issue_write_zeroes() and __blkdev_issue_write_same()
> +		 * even if the caller of these functions took care to align the
> +		 * large request. So make sure the maximum reported is aligned
> +		 * to the device physical block size. This is only an optional
> +		 * optimization for regular disks, but this is mandatory to
> +		 * avoid failure of large write same requests directed at
> +		 * sequential write required zones of host-managed ZBC disks.
> +		 */
> +		sector_t phys_mask =
> +			bytes_to_logical(sdkp->device,
> +					 sdkp->physical_block_size) - 1;
> +
> +		sdkp->max_ws_blocks &= ~phys_mask;
> +	}
> +
>  out:
>  	blk_queue_max_write_same_sectors(q, sdkp->max_ws_blocks *
>  					 (logical_block_size >> 9));

ALIGN_DOWN(sdkp->max_ws_blocks, sdkp->physical_block_size)?

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2017-09-01  3:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  1:07 [PATCH V2 0/2] sd fixes and cleanup Damien Le Moal
2017-09-01  1:07 ` [PATCH V2 1/2] scsi: sd: Fix sd_config_write_same() Damien Le Moal
2017-09-01  3:36   ` Martin K. Petersen [this message]
2017-09-01  8:45     ` Damien Le Moal
2017-09-01  1:07 ` [PATCH V2 2/2] scsi: sd: Use sectors_to_logical() Damien Le Moal
2017-09-01  3:24   ` Martin K. Petersen

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=yq1tw0num2x.fsf@oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    /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).