Skip to content

Commit 6dffe07

Browse files
zhangyi089brauner
authored andcommitted
scsi: sd: set max_hw_wzeroes_unmap_sectors if device supports SD_ZERO_*_UNMAP
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 max_hw_write_zeroes_unmap_sectors to max_write_zeroes_sectors on the device's queue limit. Signed-off-by: Zhang Yi <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: "Martin K. Petersen" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 5063436 commit 6dffe07

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/scsi/sd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,11 @@ static void sd_config_write_same(struct scsi_disk *sdkp,
11411141
out:
11421142
lim->max_write_zeroes_sectors =
11431143
sdkp->max_ws_blocks * (logical_block_size >> SECTOR_SHIFT);
1144+
1145+
if (sdkp->zeroing_mode == SD_ZERO_WS16_UNMAP ||
1146+
sdkp->zeroing_mode == SD_ZERO_WS10_UNMAP)
1147+
lim->max_hw_wzeroes_unmap_sectors =
1148+
lim->max_write_zeroes_sectors;
11441149
}
11451150

11461151
static blk_status_t sd_setup_flush_cmnd(struct scsi_cmnd *cmd)

0 commit comments

Comments
 (0)