Skip to content

Commit b3491b0

Browse files
Christoph Hellwigaxboe
authored andcommitted
sd: simplify the ZBC case in provisioning_mode_store
Don't reset the discard settings to no-op over and over when a user writes to the provisioning attribute as that is already the default mode for ZBC devices. In hindsight we should have made writing to the attribute fail for ZBC devices, but the code has probably been around for far too long to change this now. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent a236346 commit b3491b0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/scsi/sd.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,13 @@ provisioning_mode_store(struct device *dev, struct device_attribute *attr,
461461
if (!capable(CAP_SYS_ADMIN))
462462
return -EACCES;
463463

464-
if (sd_is_zoned(sdkp)) {
465-
sd_config_discard(sdkp, SD_LBP_DISABLE);
466-
return count;
467-
}
468-
469464
if (sdp->type != TYPE_DISK)
470465
return -EINVAL;
471466

467+
/* ignore the provisioning mode for ZBC devices */
468+
if (sd_is_zoned(sdkp))
469+
return count;
470+
472471
mode = sysfs_match_string(lbp_mode, buf);
473472
if (mode < 0)
474473
return -EINVAL;

0 commit comments

Comments
 (0)