linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* remove ->revalidate_disk
@ 2020-09-14  7:03 Christoph Hellwig
  2020-09-14  7:03 ` [PATCH 1/3] paride/pd: " Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-09-14  7:03 UTC (permalink / raw)
  To: Jens Axboe, Tim Waugh; +Cc: linux-block

Hi Jens,

with the previously merged patches all real users of ->revalidate_disk
are gone.  This series removes the two remaining not actually required
instances and the method itself.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] paride/pd: remove ->revalidate_disk
  2020-09-14  7:03 remove ->revalidate_disk Christoph Hellwig
@ 2020-09-14  7:03 ` Christoph Hellwig
  2020-09-14  7:03 ` [PATCH 2/3] umem: " Christoph Hellwig
  2020-09-14  7:03 ` [PATCH 3/3] block: remove the revalidate_disk method Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-09-14  7:03 UTC (permalink / raw)
  To: Jens Axboe, Tim Waugh; +Cc: linux-block

->revalidate_disk is only called during add_disk for pd, but at that
point the driver has already set the capacity to the one returned from
Identify a little earlier, so this additional update is entirely
superflous.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/paride/pd.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index a7af4f27b7c3f1..022a7ea451307e 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -859,16 +859,6 @@ static unsigned int pd_check_events(struct gendisk *p, unsigned int clearing)
 	return r ? DISK_EVENT_MEDIA_CHANGE : 0;
 }
 
-static int pd_revalidate(struct gendisk *p)
-{
-	struct pd_unit *disk = p->private_data;
-	if (pd_special_command(disk, pd_identify) == 0)
-		set_capacity(p, disk->capacity);
-	else
-		set_capacity(p, 0);
-	return 0;
-}
-
 static const struct block_device_operations pd_fops = {
 	.owner		= THIS_MODULE,
 	.open		= pd_open,
@@ -877,7 +867,6 @@ static const struct block_device_operations pd_fops = {
 	.compat_ioctl	= pd_ioctl,
 	.getgeo		= pd_getgeo,
 	.check_events	= pd_check_events,
-	.revalidate_disk= pd_revalidate
 };
 
 /* probing */
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] umem: remove ->revalidate_disk
  2020-09-14  7:03 remove ->revalidate_disk Christoph Hellwig
  2020-09-14  7:03 ` [PATCH 1/3] paride/pd: " Christoph Hellwig
@ 2020-09-14  7:03 ` Christoph Hellwig
  2020-09-14  7:03 ` [PATCH 3/3] block: remove the revalidate_disk method Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-09-14  7:03 UTC (permalink / raw)
  To: Jens Axboe, Tim Waugh; +Cc: linux-block

->revalidate_disk is only called during add_disk for pd, but at that
point the driver has already set the capacity to the same value a little
earlier, so this additional update is entirely superflous.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/umem.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 2b95d7b33b9186..58df81988d1207 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -746,21 +746,6 @@ static void del_battery_timer(void)
 	del_timer(&battery_timer);
 }
 
-/*
- * Note no locks taken out here.  In a worst case scenario, we could drop
- * a chunk of system memory.  But that should never happen, since validation
- * happens at open or mount time, when locks are held.
- *
- *	That's crap, since doing that while some partitions are opened
- * or mounted will give you really nasty results.
- */
-static int mm_revalidate(struct gendisk *disk)
-{
-	struct cardinfo *card = disk->private_data;
-	set_capacity(disk, card->mm_size << 1);
-	return 0;
-}
-
 static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 {
 	struct cardinfo *card = bdev->bd_disk->private_data;
@@ -781,7 +766,6 @@ static const struct block_device_operations mm_fops = {
 	.owner		= THIS_MODULE,
 	.submit_bio	= mm_submit_bio,
 	.getgeo		= mm_getgeo,
-	.revalidate_disk = mm_revalidate,
 };
 
 static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] block: remove the revalidate_disk method
  2020-09-14  7:03 remove ->revalidate_disk Christoph Hellwig
  2020-09-14  7:03 ` [PATCH 1/3] paride/pd: " Christoph Hellwig
  2020-09-14  7:03 ` [PATCH 2/3] umem: " Christoph Hellwig
@ 2020-09-14  7:03 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-09-14  7:03 UTC (permalink / raw)
  To: Jens Axboe, Tim Waugh; +Cc: linux-block

No implementations left.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 Documentation/filesystems/locking.rst |  2 --
 fs/block_dev.c                        | 12 ++++--------
 include/linux/blkdev.h                |  1 -
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst
index c0f2c7586531b0..28f611cad54f61 100644
--- a/Documentation/filesystems/locking.rst
+++ b/Documentation/filesystems/locking.rst
@@ -468,7 +468,6 @@ prototypes::
 	int (*direct_access) (struct block_device *, sector_t, void **,
 				unsigned long *);
 	void (*unlock_native_capacity) (struct gendisk *);
-	int (*revalidate_disk) (struct gendisk *);
 	int (*getgeo)(struct block_device *, struct hd_geometry *);
 	void (*swap_slot_free_notify) (struct block_device *, unsigned long);
 
@@ -483,7 +482,6 @@ ioctl:			no
 compat_ioctl:		no
 direct_access:		no
 unlock_native_capacity:	no
-revalidate_disk:	no
 getgeo:			no
 swap_slot_free_notify:	no	(see below)
 ======================= ===================
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 0b34955b9e360f..2e70585be7171b 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1400,14 +1400,10 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
 	 * below to get the sane behavior for most device while not breaking
 	 * userspace for this particular setup.
 	 */
-	if (invalidate) {
-		if (disk_part_scan_enabled(disk) ||
-		    !(disk->flags & GENHD_FL_REMOVABLE))
-			set_capacity(disk, 0);
-	} else {
-		if (disk->fops->revalidate_disk)
-			disk->fops->revalidate_disk(disk);
-	}
+	if (invalidate &&
+	    (disk_part_scan_enabled(disk) ||
+	     !(disk->flags & GENHD_FL_REMOVABLE)))
+		set_capacity(disk, 0);
 
 	check_disk_size_change(disk, bdev, !invalidate);
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5bd96fbab9b4c8..3d18bfbdb69b07 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1837,7 +1837,6 @@ struct block_device_operations {
 	unsigned int (*check_events) (struct gendisk *disk,
 				      unsigned int clearing);
 	void (*unlock_native_capacity) (struct gendisk *);
-	int (*revalidate_disk) (struct gendisk *);
 	int (*getgeo)(struct block_device *, struct hd_geometry *);
 	/* this callback is with swap_lock and sometimes page table lock held */
 	void (*swap_slot_free_notify) (struct block_device *, unsigned long);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] block: remove the revalidate_disk method
  2021-03-08  7:45 remove ->revalidate_disk (resend) Christoph Hellwig
@ 2021-03-08  7:45 ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-03-08  7:45 UTC (permalink / raw)
  To: Jens Axboe, Tim Waugh; +Cc: linux-block

No implementations left.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 Documentation/filesystems/locking.rst | 2 --
 fs/block_dev.c                        | 3 ---
 include/linux/blkdev.h                | 1 -
 3 files changed, 6 deletions(-)

diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst
index b7dcc86c92a45f..9774e92e449fbd 100644
--- a/Documentation/filesystems/locking.rst
+++ b/Documentation/filesystems/locking.rst
@@ -469,7 +469,6 @@ prototypes::
 	int (*direct_access) (struct block_device *, sector_t, void **,
 				unsigned long *);
 	void (*unlock_native_capacity) (struct gendisk *);
-	int (*revalidate_disk) (struct gendisk *);
 	int (*getgeo)(struct block_device *, struct hd_geometry *);
 	void (*swap_slot_free_notify) (struct block_device *, unsigned long);
 
@@ -484,7 +483,6 @@ ioctl:			no
 compat_ioctl:		no
 direct_access:		no
 unlock_native_capacity:	no
-revalidate_disk:	no
 getgeo:			no
 swap_slot_free_notify:	no	(see below)
 ======================= ===================
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4aa1f88d5bf8b3..422d088ac7dbaa 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1250,9 +1250,6 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
 		if (disk_part_scan_enabled(disk) ||
 		    !(disk->flags & GENHD_FL_REMOVABLE))
 			set_capacity(disk, 0);
-	} else {
-		if (disk->fops->revalidate_disk)
-			disk->fops->revalidate_disk(disk);
 	}
 
 	if (get_capacity(disk)) {
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bc6bc8383b434e..b4241f73f7a89c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1870,7 +1870,6 @@ struct block_device_operations {
 	unsigned int (*check_events) (struct gendisk *disk,
 				      unsigned int clearing);
 	void (*unlock_native_capacity) (struct gendisk *);
-	int (*revalidate_disk) (struct gendisk *);
 	int (*getgeo)(struct block_device *, struct hd_geometry *);
 	int (*set_read_only)(struct block_device *bdev, bool ro);
 	/* this callback is with swap_lock and sometimes page table lock held */
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-08  7:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  7:03 remove ->revalidate_disk Christoph Hellwig
2020-09-14  7:03 ` [PATCH 1/3] paride/pd: " Christoph Hellwig
2020-09-14  7:03 ` [PATCH 2/3] umem: " Christoph Hellwig
2020-09-14  7:03 ` [PATCH 3/3] block: remove the revalidate_disk method Christoph Hellwig
2021-03-08  7:45 remove ->revalidate_disk (resend) Christoph Hellwig
2021-03-08  7:45 ` [PATCH 3/3] block: remove the revalidate_disk method Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).