Message ID | 20250115114637.2705887-4-yi.zhang@huaweicloud.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [RFC,v2,1/8] block: introduce BLK_FEAT_WRITE_ZEROES_UNMAP to queue limits features | expand |
On Wed, Jan 15, 2025 at 07:46:32PM +0800, Zhang Yi wrote: > From: Zhang Yi <yi.zhang@huawei.com> > > When the device supports the Write Zeroes command and the zeroing mode > is set to SD_ZERO_WS16_UNMAP or SD_ZERO_WS10_UNMAP, this means that the > device supports unmap Write Zeroes, so set the corresponding > BLK_FEAT_WRITE_ZEROES_UNMAP feature to the device's queue limit. Looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8947dab132d7..95e115c69286 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1122,6 +1122,11 @@ static void sd_config_write_same(struct scsi_disk *sdkp, else sdkp->zeroing_mode = SD_ZERO_WRITE; + if (sdkp->max_ws_blocks && + (sdkp->zeroing_mode == SD_ZERO_WS16_UNMAP || + sdkp->zeroing_mode == SD_ZERO_WS10_UNMAP)) + lim->features |= BLK_FEAT_WRITE_ZEROES_UNMAP; + if (sdkp->max_ws_blocks && sdkp->physical_block_size > logical_block_size) { /*