Re: [PATCH 05/19] swim: use bdev_check_media_change
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/swim.c | 6 -- > 1 file changed, 4 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 05/19] swim: use bdev_check_media_change
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/swim.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/swim.c b/drivers/block/swim.c index dd34504382e533..d4565c555b289f 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -217,6 +217,8 @@ extern int swim_read_sector_header(struct swim __iomem *base, extern int swim_read_sector_data(struct swim __iomem *base, unsigned char *data); +static int floppy_revalidate(struct gendisk *disk); + static DEFINE_MUTEX(swim_mutex); static inline void set_swim_mode(struct swim __iomem *base, int enable) { @@ -638,7 +640,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) && fs->write_protected) { err = -EROFS; goto out; @@ -760,7 +763,6 @@ static const struct block_device_operations floppy_fops = { .ioctl = floppy_ioctl, .getgeo = floppy_getgeo, .check_events= floppy_check_events, - .revalidate_disk = floppy_revalidate, }; static struct kobject *floppy_find(dev_t dev, int *part, void *data) -- 2.28.0
Re: [PATCH 05/19] swim: use bdev_check_media_change
Looks good, Reviewed-by: Johannes Thumshirn > +static int floppy_revalidate(struct gendisk *disk); Completely unrelated to this series but, this is the 3rd floppy driver in the series defining it's own floppy_revalidate() and naming it floppy_revalidate(). This makes grepping and reviewing a pain.
Re: [PATCH 05/19] swim: use bdev_check_media_change
On Wed, Sep 02, 2020 at 03:30:14PM +, Johannes Thumshirn wrote: > Looks good, > Reviewed-by: Johannes Thumshirn > > > +static int floppy_revalidate(struct gendisk *disk); > > Completely unrelated to this series but, this is the 3rd floppy > driver in the series defining it's own floppy_revalidate() and > naming it floppy_revalidate(). > > This makes grepping and reviewing a pain. Yes, I noticed it as well. They also use the floppy_ prefix for various other methods. > ---end quoted text---
[PATCH 05/19] swim: use bdev_check_media_change
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/swim.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/swim.c b/drivers/block/swim.c index dd34504382e533..d4565c555b289f 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -217,6 +217,8 @@ extern int swim_read_sector_header(struct swim __iomem *base, extern int swim_read_sector_data(struct swim __iomem *base, unsigned char *data); +static int floppy_revalidate(struct gendisk *disk); + static DEFINE_MUTEX(swim_mutex); static inline void set_swim_mode(struct swim __iomem *base, int enable) { @@ -638,7 +640,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) && fs->write_protected) { err = -EROFS; goto out; @@ -760,7 +763,6 @@ static const struct block_device_operations floppy_fops = { .ioctl = floppy_ioctl, .getgeo = floppy_getgeo, .check_events= floppy_check_events, - .revalidate_disk = floppy_revalidate, }; static struct kobject *floppy_find(dev_t dev, int *part, void *data) -- 2.28.0