Re: [PATCH 12/19] ide-cd: use bdev_check_media_changed

2020-09-09 Thread Hannes Reinecke
On 9/8/20 4:53 PM, Christoph Hellwig wrote:
> Switch to use bdev_check_media_changed instead of check_disk_change and
> call idecd_revalidate_disk manually.  Given that idecd_revalidate_disk
> only re-reads the TOC, and we already do the same at probe time, 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/ide/ide-cd.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 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 12/19] ide-cd: use bdev_check_media_changed

2020-09-08 Thread Christoph Hellwig
Switch to use bdev_check_media_changed instead of check_disk_change and
call idecd_revalidate_disk manually.  Given that idecd_revalidate_disk
only re-reads the TOC, and we already do the same at probe time, 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/ide/ide-cd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 212bb2d8bf346a..6a38cbc80aea0d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -56,6 +56,7 @@ static DEFINE_MUTEX(ide_cd_mutex);
 static DEFINE_MUTEX(idecd_ref_mutex);
 
 static void ide_cd_release(struct device *);
+static int idecd_revalidate_disk(struct gendisk *disk);
 
 static struct cdrom_info *ide_cd_get(struct gendisk *disk)
 {
@@ -1611,7 +1612,8 @@ static int idecd_open(struct block_device *bdev, fmode_t 
mode)
struct cdrom_info *info;
int rc = -ENXIO;
 
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   idecd_revalidate_disk(bdev->bd_disk);
 
mutex_lock(_cd_mutex);
info = ide_cd_get(bdev->bd_disk);
@@ -1770,7 +1772,6 @@ static const struct block_device_operations idecd_ops = {
.compat_ioctl   = IS_ENABLED(CONFIG_COMPAT) ?
  idecd_compat_ioctl : NULL,
.check_events   = idecd_check_events,
-   .revalidate_disk= idecd_revalidate_disk
 };
 
 /* module options */
-- 
2.28.0



Re: [PATCH 12/19] ide-cd: use bdev_check_media_changed

2020-09-02 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 


[PATCH 12/19] ide-cd: use bdev_check_media_changed

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_changed instead of check_disk_change and
call idecd_revalidate_disk manually.  Given that idecd_revalidate_disk
only re-reads the TOC, and we already do the same at probe time, 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/ide/ide-cd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 212bb2d8bf346a..6a38cbc80aea0d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -56,6 +56,7 @@ static DEFINE_MUTEX(ide_cd_mutex);
 static DEFINE_MUTEX(idecd_ref_mutex);
 
 static void ide_cd_release(struct device *);
+static int idecd_revalidate_disk(struct gendisk *disk);
 
 static struct cdrom_info *ide_cd_get(struct gendisk *disk)
 {
@@ -1611,7 +1612,8 @@ static int idecd_open(struct block_device *bdev, fmode_t 
mode)
struct cdrom_info *info;
int rc = -ENXIO;
 
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   idecd_revalidate_disk(bdev->bd_disk);
 
mutex_lock(_cd_mutex);
info = ide_cd_get(bdev->bd_disk);
@@ -1770,7 +1772,6 @@ static const struct block_device_operations idecd_ops = {
.compat_ioctl   = IS_ENABLED(CONFIG_COMPAT) ?
  idecd_compat_ioctl : NULL,
.check_events   = idecd_check_events,
-   .revalidate_disk= idecd_revalidate_disk
 };
 
 /* module options */
-- 
2.28.0