summaryrefslogtreecommitdiff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-16 15:56:55 +0100
committerJens Axboe <axboe@kernel.dk>2020-11-16 08:34:14 -0700
commitb200e38c493b2a5acff4f86d40a3e45d546c664c (patch)
tree5c0a1fa77c5cc9d1d10ddd061cc962a119ce0905 /drivers/scsi/sd.c
parent5dd55749b79cdf471ca0966ad91541daebac3e2f (diff)
sd: update the bdev size in sd_revalidate_disk
This avoids the extra call to revalidate_disk_size in sd_rescan and is otherwise a no-op because the size did not change, or we are in the probe path. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 106a9cda0eb7..e9b898a1a480 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1748,10 +1748,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
static void sd_rescan(struct device *dev)
{
struct scsi_disk *sdkp = dev_get_drvdata(dev);
- int ret;
- ret = sd_revalidate_disk(sdkp->disk);
- revalidate_disk_size(sdkp->disk, ret == 0);
+ sd_revalidate_disk(sdkp->disk);
}
static int sd_ioctl(struct block_device *bdev, fmode_t mode,
@@ -3264,7 +3262,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
sdkp->first_scan = 0;
set_capacity_revalidate_and_notify(disk,
- logical_to_sectors(sdp, sdkp->capacity), false);
+ logical_to_sectors(sdp, sdkp->capacity), true);
sd_config_write_same(sdkp);
kfree(buffer);
@@ -3274,7 +3272,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
* capacity to 0.
*/
if (sd_zbc_revalidate_zones(sdkp))
- set_capacity_revalidate_and_notify(disk, 0, false);
+ set_capacity_revalidate_and_notify(disk, 0, true);
out:
return 0;