Re: [PATCH 03/19] ataflop: 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 
> Reviewed-by: Johannes Thumshirn 
> ---
>  drivers/block/ataflop.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 03/19] ataflop: 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 
Reviewed-by: Johannes Thumshirn 
---
 drivers/block/ataflop.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index a50e13af030526..3e881fdb06e0ad 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1732,7 +1732,8 @@ static int fd_locked_ioctl(struct block_device *bdev, 
fmode_t mode,
/* invalidate the buffer track to force a reread */
BufferDrive = -1;
set_bit(drive, &fake_change);
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
return 0;
default:
return -EINVAL;
@@ -1909,7 +1910,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
return 0;
 
if (mode & (FMODE_READ|FMODE_WRITE)) {
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if (mode & FMODE_WRITE) {
if (p->wpstat) {
if (p->ref < 0)
@@ -1953,7 +1955,6 @@ static const struct block_device_operations floppy_fops = 
{
.release= floppy_release,
.ioctl  = fd_ioctl,
.check_events   = floppy_check_events,
-   .revalidate_disk= floppy_revalidate,
 };
 
 static const struct blk_mq_ops ataflop_mq_ops = {
-- 
2.28.0



Re: [PATCH 03/19] ataflop: use bdev_check_media_change

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


[PATCH 03/19] ataflop: 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/ataflop.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index a50e13af030526..3e881fdb06e0ad 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1732,7 +1732,8 @@ static int fd_locked_ioctl(struct block_device *bdev, 
fmode_t mode,
/* invalidate the buffer track to force a reread */
BufferDrive = -1;
set_bit(drive, &fake_change);
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
return 0;
default:
return -EINVAL;
@@ -1909,7 +1910,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
return 0;
 
if (mode & (FMODE_READ|FMODE_WRITE)) {
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if (mode & FMODE_WRITE) {
if (p->wpstat) {
if (p->ref < 0)
@@ -1953,7 +1955,6 @@ static const struct block_device_operations floppy_fops = 
{
.release= floppy_release,
.ioctl  = fd_ioctl,
.check_events   = floppy_check_events,
-   .revalidate_disk= floppy_revalidate,
 };
 
 static const struct blk_mq_ops ataflop_mq_ops = {
-- 
2.28.0