Re: [PATCH 04/19] floppy: 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 floppy_revalidate manually.  Given that floppy_revalidate only
> deals with media change events, 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/block/floppy.c | 8 +---
>  1 file changed, 5 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


Re: [PATCH 04/19] floppy: use bdev_check_media_change

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


[PATCH 04/19] floppy: 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 floppy_revalidate manually.  Given that floppy_revalidate only
deals with media change events, 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/block/floppy.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index a563b023458a8b..7df79ae6b0a1e1 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -561,6 +561,7 @@ static void floppy_release_irq_and_dma(void);
  * output_byte is automatically disabled when reset is set.
  */
 static void reset_fdc(void);
+static int floppy_revalidate(struct gendisk *disk);
 
 /*
  * These are global variables, as that's the easiest way to give
@@ -3275,7 +3276,8 @@ static int invalidate_drive(struct block_device *bdev)
/* invalidate the buffer track to force a reread */
set_bit((long)bdev->bd_disk->private_data, _change);
process_fd_request();
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
return 0;
 }
 
@@ -4123,7 +4125,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
drive_state[drive].last_checked = 0;
clear_bit(FD_OPEN_SHOULD_FAIL_BIT,
  _state[drive].flags);
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if (test_bit(FD_DISK_CHANGED_BIT, 
_state[drive].flags))
goto out;
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, 
_state[drive].flags))
@@ -4291,7 +4294,6 @@ static const struct block_device_operations floppy_fops = 
{
.ioctl  = fd_ioctl,
.getgeo = fd_getgeo,
.check_events   = floppy_check_events,
-   .revalidate_disk= floppy_revalidate,
 #ifdef CONFIG_COMPAT
.compat_ioctl   = fd_compat_ioctl,
 #endif
-- 
2.28.0



Re: [PATCH 04/19] floppy: use bdev_check_media_change

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


[PATCH 04/19] floppy: 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 floppy_revalidate manually.  Given that floppy_revalidate only
deals with media change events, 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/block/floppy.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index a563b023458a8b..7df79ae6b0a1e1 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -561,6 +561,7 @@ static void floppy_release_irq_and_dma(void);
  * output_byte is automatically disabled when reset is set.
  */
 static void reset_fdc(void);
+static int floppy_revalidate(struct gendisk *disk);
 
 /*
  * These are global variables, as that's the easiest way to give
@@ -3275,7 +3276,8 @@ static int invalidate_drive(struct block_device *bdev)
/* invalidate the buffer track to force a reread */
set_bit((long)bdev->bd_disk->private_data, _change);
process_fd_request();
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
return 0;
 }
 
@@ -4123,7 +4125,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
drive_state[drive].last_checked = 0;
clear_bit(FD_OPEN_SHOULD_FAIL_BIT,
  _state[drive].flags);
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if (test_bit(FD_DISK_CHANGED_BIT, 
_state[drive].flags))
goto out;
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, 
_state[drive].flags))
@@ -4291,7 +4294,6 @@ static const struct block_device_operations floppy_fops = 
{
.ioctl  = fd_ioctl,
.getgeo = fd_getgeo,
.check_events   = floppy_check_events,
-   .revalidate_disk= floppy_revalidate,
 #ifdef CONFIG_COMPAT
.compat_ioctl   = fd_compat_ioctl,
 #endif
-- 
2.28.0