Skip to content

Commit 84dca0f

Browse files
zhangyi089kawasaki
authored andcommitted
scsi: sd: set BLK_FEAT_WRITE_ZEROES_UNMAP if device supports unmap zeroing mode
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. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent aae87d2 commit 84dca0f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/scsi/sd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,11 @@ static void sd_config_write_same(struct scsi_disk *sdkp,
11181118
else
11191119
sdkp->zeroing_mode = SD_ZERO_WRITE;
11201120

1121+
if (sdkp->max_ws_blocks &&
1122+
(sdkp->zeroing_mode == SD_ZERO_WS16_UNMAP ||
1123+
sdkp->zeroing_mode == SD_ZERO_WS10_UNMAP))
1124+
lim->features |= BLK_FEAT_WRITE_ZEROES_UNMAP;
1125+
11211126
if (sdkp->max_ws_blocks &&
11221127
sdkp->physical_block_size > logical_block_size) {
11231128
/*

0 commit comments

Comments
 (0)