Re: [PATCH 16/19] sd: use bdev_check_media_change

From
Sergei Shtylyov <hidden>
Date
2020-09-02 16:19:34
Also in
linux-block, linux-fsdevel, linux-ide, linux-m68k, linux-scsi, lkml
Reply to
Christoph Hellwig, 2020-09-02
On 9/2/20 5:12 PM, Christoph Hellwig wrote:
Switch to use bdev_check_media_change instead of check_disk_change and
call cd_revalidate_disk manually.  As sd also calls sd_revalidate_disk
   s/cd/sd/?
quoted hunk ↗ jump to hunk
manually during probe and open, , the extra call into ->revalidate_disk
from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/sd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 2bec8cd526164d..d020639c28c6ca 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1381,8 +1381,10 @@ static int sd_open(struct block_device *bdev, fmode_t mode)
 	if (!scsi_block_when_processing_errors(sdev))
 		goto error_out;
 
-	if (sdev->removable || sdkp->write_prot)
-		check_disk_change(bdev);
+	if (sdev->removable || sdkp->write_prot) {
+		if (bdev_check_media_change(bdev))
+			sd_revalidate_disk(bdev->bd_disk);
+	}
 
 	/*
 	 * If the drive is empty, just let the open fail.
[...]

MBR, Sergei
Thread (45 messages) 45 messages, 6 authors, last reply 2020-09-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help