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

2020-09-09 Thread Sergei Shtylyov

On 08.09.2020 17:53, Christoph Hellwig wrote:


Switch to use bdev_check_media_change instead of check_disk_change and
call sd_revalidate_disk manually.  As sd also calls sd_revalidate_disk
manually during probe and open, , the extra call into ->revalidate_disk


   Too many commas. :-)


from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig 
Reviewed-by: Johannes Thumshirn 

[...]

MBR, Sergei


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

2020-09-09 Thread Hannes Reinecke
On 9/8/20 4:53 PM, Christoph Hellwig wrote:
> Switch to use bdev_check_media_change instead of check_disk_change and
> call sd_revalidate_disk manually.  As sd also calls sd_revalidate_disk
> 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 
> Reviewed-by: Johannes Thumshirn 
> ---
>  drivers/scsi/sd.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeKernel Storage Architect
h...@suse.de  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer


[PATCH 16/19] sd: use bdev_check_media_change

2020-09-08 Thread Christoph Hellwig
Switch to use bdev_check_media_change instead of check_disk_change and
call sd_revalidate_disk manually.  As sd also calls sd_revalidate_disk
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 
Reviewed-by: Johannes Thumshirn 
---
 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.
@@ -1843,7 +1845,6 @@ static const struct block_device_operations sd_fops = {
.compat_ioctl   = sd_compat_ioctl,
 #endif
.check_events   = sd_check_events,
-   .revalidate_disk= sd_revalidate_disk,
.unlock_native_capacity = sd_unlock_native_capacity,
.report_zones   = sd_zbc_report_zones,
.pr_ops = _pr_ops,
-- 
2.28.0



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

2020-09-02 Thread Sergei Shtylyov
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/?

> 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 
> ---
>  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


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

2020-09-02 Thread Johannes Thumshirn
On 02/09/2020 16:21, Christoph Hellwig wrote:
> call cd_revalidate_disk manually.  As sd also calls sd_revalidate_disk
^~ sd_revalidate_disk

Otherwise,
Reviewed-by: Johannes Thumshirn 


[PATCH 16/19] sd: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
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
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 
---
 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.
@@ -1843,7 +1845,6 @@ static const struct block_device_operations sd_fops = {
.compat_ioctl   = sd_compat_ioctl,
 #endif
.check_events   = sd_check_events,
-   .revalidate_disk= sd_revalidate_disk,
.unlock_native_capacity = sd_unlock_native_capacity,
.report_zones   = sd_zbc_report_zones,
.pr_ops = _pr_ops,
-- 
2.28.0