linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cleanup updating the size of block devices
@ 2020-11-06 19:03 Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 01/24] block: remove the call to __invalidate_device in check_disk_size_change Christoph Hellwig
                   ` (24 more replies)
  0 siblings, 25 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Hi Jens,

this series builds on top of the work that went into the last merge window,
and make sure we have a single coherent interfac for updating the size of a
block device.

Diffstat:
 block/genhd.c                  |   16 +++----
 drivers/block/aoe/aoecmd.c     |   15 +-----
 drivers/block/drbd/drbd_main.c |    6 --
 drivers/block/loop.c           |   36 ++--------------
 drivers/block/nbd.c            |   88 +++++++++++++----------------------------
 drivers/block/pktcdvd.c        |    3 -
 drivers/block/rbd.c            |    3 -
 drivers/block/rnbd/rnbd-clt.c  |    3 -
 drivers/block/virtio_blk.c     |    3 -
 drivers/block/xen-blkfront.c   |    2 
 drivers/block/zram/zram_drv.c  |    7 ---
 drivers/md/dm-raid.c           |    3 -
 drivers/md/dm.c                |    3 -
 drivers/md/md-cluster.c        |    8 ---
 drivers/md/md-linear.c         |    3 -
 drivers/md/md.c                |   24 ++++-------
 drivers/nvme/host/core.c       |   18 --------
 drivers/scsi/sd.c              |    9 +---
 fs/block_dev.c                 |    7 ---
 include/linux/genhd.h          |    3 -
 20 files changed, 76 insertions(+), 184 deletions(-)

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

* [PATCH 01/24] block: remove the call to __invalidate_device in check_disk_size_change
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 02/24] loop: remove loop_set_size Christoph Hellwig
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

__invalidate_device without the kill_dirty parameter just invalidates
various clean entries in caches, which doesn't really help us with
anything, but can cause all kinds of horrible lock orders due to how
it calls into the file system.  The only reason this hasn't been a
major issue is because so many people use partitions, for which no
invalidation was performed anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/block_dev.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9e84b1928b9401..66ebf594c97f47 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1334,12 +1334,6 @@ static void check_disk_size_change(struct gendisk *disk,
 		i_size_write(bdev->bd_inode, disk_size);
 	}
 	spin_unlock(&bdev->bd_size_lock);
-
-	if (bdev_size > disk_size) {
-		if (__invalidate_device(bdev, false))
-			pr_warn("VFS: busy inodes on resized disk %s\n",
-				disk->disk_name);
-	}
 }
 
 /**
-- 
2.28.0


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

* [PATCH 02/24] loop: remove loop_set_size
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 01/24] block: remove the call to __invalidate_device in check_disk_size_change Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size Christoph Hellwig
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Just use set_capacity_revalidate_and_notify directly, as this function
can update the block device size as well when the last parameter is set
to true.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index cb1191d6e945f2..86eb7e0691eef5 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -241,23 +241,6 @@ loop_validate_block_size(unsigned short bsize)
 	return 0;
 }
 
-/**
- * loop_set_size() - sets device size and notifies userspace
- * @lo: struct loop_device to set the size for
- * @size: new size of the loop device
- *
- * Callers must validate that the size passed into this function fits into
- * a sector_t, eg using loop_validate_size()
- */
-static void loop_set_size(struct loop_device *lo, loff_t size)
-{
-	struct block_device *bdev = lo->lo_device;
-
-	bd_set_nr_sectors(bdev, size);
-
-	set_capacity_revalidate_and_notify(lo->lo_disk, size, false);
-}
-
 static inline int
 lo_do_transfer(struct loop_device *lo, int cmd,
 	       struct page *rpage, unsigned roffs,
@@ -1076,7 +1059,6 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
 	struct address_space *mapping;
 	struct block_device *claimed_bdev = NULL;
 	int		error;
-	loff_t		size;
 	bool		partscan;
 	unsigned short  bsize;
 
@@ -1164,9 +1146,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
 	loop_update_dio(lo);
 	loop_sysfs_init(lo);
 
-	size = get_loop_size(lo, file);
-	loop_set_size(lo, size);
-
+	set_capacity_revalidate_and_notify(lo->lo_disk, get_loop_size(lo, file),
+			true);
 	set_blocksize(bdev, S_ISBLK(inode->i_mode) ?
 		      block_size(inode->i_bdev) : PAGE_SIZE);
 
@@ -1402,9 +1383,9 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 	lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
 
 	if (size_changed) {
-		loff_t new_size = get_size(lo->lo_offset, lo->lo_sizelimit,
-					   lo->lo_backing_file);
-		loop_set_size(lo, new_size);
+		set_capacity_revalidate_and_notify(lo->lo_disk,
+				get_size(lo->lo_offset, lo->lo_sizelimit,
+					 lo->lo_backing_file), true);
 	}
 
 	loop_config_discard(lo);
@@ -1580,14 +1561,10 @@ loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {
 
 static int loop_set_capacity(struct loop_device *lo)
 {
-	loff_t size;
-
 	if (unlikely(lo->lo_state != Lo_bound))
 		return -ENXIO;
-
-	size = get_loop_size(lo, lo->lo_backing_file);
-	loop_set_size(lo, size);
-
+	set_capacity_revalidate_and_notify(lo->lo_disk,
+			get_loop_size(lo, lo->lo_backing_file), true);
 	return 0;
 }
 
-- 
2.28.0


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

* [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 01/24] block: remove the call to __invalidate_device in check_disk_size_change Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 02/24] loop: remove loop_set_size Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-09  7:53   ` Hannes Reinecke
  2020-11-06 19:03 ` [PATCH 04/24] sd: update the bdev size in sd_revalidate_disk Christoph Hellwig
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

There is no good reason to call revalidate_disk_size separately.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 376096bfc54a83..4e86c9aafd88a7 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2053,7 +2053,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
 			capacity = 0;
 	}
 
-	set_capacity_revalidate_and_notify(disk, capacity, false);
+	set_capacity_revalidate_and_notify(disk, capacity, true);
 
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
@@ -2136,7 +2136,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
 		blk_stack_limits(&ns->head->disk->queue->limits,
 				 &ns->queue->limits, 0);
 		blk_queue_update_readahead(ns->head->disk->queue);
-		nvme_update_bdev_size(ns->head->disk);
 		blk_mq_unfreeze_queue(ns->head->disk->queue);
 	}
 #endif
@@ -3965,8 +3964,6 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids)
 	 */
 	if (ret && ret != -ENOMEM && !(ret > 0 && !(ret & NVME_SC_DNR)))
 		nvme_ns_remove(ns);
-	else
-		revalidate_disk_size(ns->disk, true);
 }
 
 static void nvme_validate_or_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
-- 
2.28.0


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

* [PATCH 04/24] sd: update the bdev size in sd_revalidate_disk
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (2 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-11  4:18   ` Martin K. Petersen
  2020-11-06 19:03 ` [PATCH 05/24] block: remove the update_bdev parameter from set_capacity_revalidate_and_notify Christoph Hellwig
                   ` (20 subsequent siblings)
  24 siblings, 1 reply; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

This avoids the extra call to revalidate_disk_size in sd_rescan and
is otherwise a no-op because the size did not change, or we are in
the probe path.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/sd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 656bcf4940d6d1..4a34dd5b153196 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1750,10 +1750,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
 static void sd_rescan(struct device *dev)
 {
 	struct scsi_disk *sdkp = dev_get_drvdata(dev);
-	int ret;
 
-	ret = sd_revalidate_disk(sdkp->disk);
-	revalidate_disk_size(sdkp->disk, ret == 0);
+	sd_revalidate_disk(sdkp->disk);
 }
 
 static int sd_ioctl(struct block_device *bdev, fmode_t mode,
@@ -3266,7 +3264,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
 	sdkp->first_scan = 0;
 
 	set_capacity_revalidate_and_notify(disk,
-		logical_to_sectors(sdp, sdkp->capacity), false);
+		logical_to_sectors(sdp, sdkp->capacity), true);
 	sd_config_write_same(sdkp);
 	kfree(buffer);
 
@@ -3276,7 +3274,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
 	 * capacity to 0.
 	 */
 	if (sd_zbc_revalidate_zones(sdkp))
-		set_capacity_revalidate_and_notify(disk, 0, false);
+		set_capacity_revalidate_and_notify(disk, 0, true);
 
  out:
 	return 0;
-- 
2.28.0


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

* [PATCH 05/24] block: remove the update_bdev parameter from set_capacity_revalidate_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (3 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 04/24] sd: update the bdev size in sd_revalidate_disk Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 06/24] block: add a return value to set_capacity_and_notify Christoph Hellwig
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

The update_bdev argument is always set to true, so remove it.  Also
rename the function to the slighly less verbose set_capacity_and_notify,
as propagating the disk size to the block device isn't really
revalidation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c                | 13 +++++--------
 drivers/block/loop.c         | 11 +++++------
 drivers/block/virtio_blk.c   |  2 +-
 drivers/block/xen-blkfront.c |  2 +-
 drivers/nvme/host/core.c     |  2 +-
 drivers/scsi/sd.c            |  5 ++---
 include/linux/genhd.h        |  3 +--
 7 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 0a273211fec283..d8d9d6c1c916e1 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -46,17 +46,15 @@ static void disk_del_events(struct gendisk *disk);
 static void disk_release_events(struct gendisk *disk);
 
 /*
- * Set disk capacity and notify if the size is not currently
- * zero and will not be set to zero
+ * Set disk capacity and notify if the size is not currently zero and will not
+ * be set to zero.
  */
-void set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
-					bool update_bdev)
+void set_capacity_and_notify(struct gendisk *disk, sector_t size)
 {
 	sector_t capacity = get_capacity(disk);
 
 	set_capacity(disk, size);
-	if (update_bdev)
-		revalidate_disk_size(disk, true);
+	revalidate_disk_size(disk, true);
 
 	if (capacity != size && capacity != 0 && size != 0) {
 		char *envp[] = { "RESIZE=1", NULL };
@@ -64,8 +62,7 @@ void set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
 		kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp);
 	}
 }
-
-EXPORT_SYMBOL_GPL(set_capacity_revalidate_and_notify);
+EXPORT_SYMBOL_GPL(set_capacity_and_notify);
 
 /*
  * Format the device name of the indicated disk into the supplied buffer and
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 86eb7e0691eef5..77937b760ee0fc 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1146,8 +1146,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
 	loop_update_dio(lo);
 	loop_sysfs_init(lo);
 
-	set_capacity_revalidate_and_notify(lo->lo_disk, get_loop_size(lo, file),
-			true);
+	set_capacity_and_notify(lo->lo_disk, get_loop_size(lo, file));
 	set_blocksize(bdev, S_ISBLK(inode->i_mode) ?
 		      block_size(inode->i_bdev) : PAGE_SIZE);
 
@@ -1383,9 +1382,9 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 	lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
 
 	if (size_changed) {
-		set_capacity_revalidate_and_notify(lo->lo_disk,
+		set_capacity_and_notify(lo->lo_disk,
 				get_size(lo->lo_offset, lo->lo_sizelimit,
-					 lo->lo_backing_file), true);
+					 lo->lo_backing_file));
 	}
 
 	loop_config_discard(lo);
@@ -1563,8 +1562,8 @@ static int loop_set_capacity(struct loop_device *lo)
 {
 	if (unlikely(lo->lo_state != Lo_bound))
 		return -ENXIO;
-	set_capacity_revalidate_and_notify(lo->lo_disk,
-			get_loop_size(lo, lo->lo_backing_file), true);
+	set_capacity_and_notify(lo->lo_disk,
+			get_loop_size(lo, lo->lo_backing_file));
 	return 0;
 }
 
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index a314b9382442b6..3e812b4c32e669 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -470,7 +470,7 @@ static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
 		   cap_str_10,
 		   cap_str_2);
 
-	set_capacity_revalidate_and_notify(vblk->disk, capacity, true);
+	set_capacity_and_notify(vblk->disk, capacity);
 }
 
 static void virtblk_config_changed_work(struct work_struct *work)
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 48629d3433b4c3..79521e33d30ed5 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2370,7 +2370,7 @@ static void blkfront_connect(struct blkfront_info *info)
 			return;
 		printk(KERN_INFO "Setting capacity to %Lu\n",
 		       sectors);
-		set_capacity_revalidate_and_notify(info->gd, sectors, true);
+		set_capacity_and_notify(info->gd, sectors);
 
 		return;
 	case BLKIF_STATE_SUSPENDED:
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4e86c9aafd88a7..aa6e27c2eec945 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2053,7 +2053,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
 			capacity = 0;
 	}
 
-	set_capacity_revalidate_and_notify(disk, capacity, true);
+	set_capacity_and_notify(disk, capacity);
 
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 4a34dd5b153196..a2a4f385833d6c 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3263,8 +3263,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
 
 	sdkp->first_scan = 0;
 
-	set_capacity_revalidate_and_notify(disk,
-		logical_to_sectors(sdp, sdkp->capacity), true);
+	set_capacity_and_notify(disk, logical_to_sectors(sdp, sdkp->capacity));
 	sd_config_write_same(sdkp);
 	kfree(buffer);
 
@@ -3274,7 +3273,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
 	 * capacity to 0.
 	 */
 	if (sd_zbc_revalidate_zones(sdkp))
-		set_capacity_revalidate_and_notify(disk, 0, true);
+		set_capacity_and_notify(disk, 0);
 
  out:
 	return 0;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 38f23d75701379..596f31b5a3e133 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -315,8 +315,7 @@ static inline int get_disk_ro(struct gendisk *disk)
 extern void disk_block_events(struct gendisk *disk);
 extern void disk_unblock_events(struct gendisk *disk);
 extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
-void set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
-		bool update_bdev);
+void set_capacity_and_notify(struct gendisk *disk, sector_t size);
 
 /* drivers/char/random.c */
 extern void add_disk_randomness(struct gendisk *disk) __latent_entropy;
-- 
2.28.0


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

* [PATCH 06/24] block: add a return value to set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (4 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 05/24] block: remove the update_bdev parameter from set_capacity_revalidate_and_notify Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 07/24] nbd: remove the call to set_blocksize Christoph Hellwig
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Return if the function ended up sending an uevent or not.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c         | 7 +++++--
 include/linux/genhd.h | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index d8d9d6c1c916e1..8c350fecfe8bfe 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -47,9 +47,9 @@ static void disk_release_events(struct gendisk *disk);
 
 /*
  * Set disk capacity and notify if the size is not currently zero and will not
- * be set to zero.
+ * be set to zero.  Returns true if a uevent was sent, otherwise false.
  */
-void set_capacity_and_notify(struct gendisk *disk, sector_t size)
+bool set_capacity_and_notify(struct gendisk *disk, sector_t size)
 {
 	sector_t capacity = get_capacity(disk);
 
@@ -60,7 +60,10 @@ void set_capacity_and_notify(struct gendisk *disk, sector_t size)
 		char *envp[] = { "RESIZE=1", NULL };
 
 		kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp);
+		return true;
 	}
+
+	return false;
 }
 EXPORT_SYMBOL_GPL(set_capacity_and_notify);
 
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 596f31b5a3e133..4b22bfd9336e1a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -315,7 +315,7 @@ static inline int get_disk_ro(struct gendisk *disk)
 extern void disk_block_events(struct gendisk *disk);
 extern void disk_unblock_events(struct gendisk *disk);
 extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
-void set_capacity_and_notify(struct gendisk *disk, sector_t size);
+bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
 
 /* drivers/char/random.c */
 extern void add_disk_randomness(struct gendisk *disk) __latent_entropy;
-- 
2.28.0


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

* [PATCH 07/24] nbd: remove the call to set_blocksize
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (5 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 06/24] block: add a return value to set_capacity_and_notify Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 08/24] nbd: move the task_recv check into nbd_size_update Christoph Hellwig
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Block driver have no business setting the file system concept of a
block size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index c4f9ccf5cc2ac5..f618688a196654 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -296,7 +296,7 @@ static void nbd_size_clear(struct nbd_device *nbd)
 	}
 }
 
-static void nbd_size_update(struct nbd_device *nbd, bool start)
+static void nbd_size_update(struct nbd_device *nbd)
 {
 	struct nbd_config *config = nbd->config;
 	struct block_device *bdev = bdget_disk(nbd->disk, 0);
@@ -311,11 +311,9 @@ static void nbd_size_update(struct nbd_device *nbd, bool start)
 	blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
 	set_capacity(nbd->disk, nr_sectors);
 	if (bdev) {
-		if (bdev->bd_disk) {
+		if (bdev->bd_disk)
 			bd_set_nr_sectors(bdev, nr_sectors);
-			if (start)
-				set_blocksize(bdev, config->blksize);
-		} else
+		else
 			set_bit(GD_NEED_PART_SCAN, &nbd->disk->state);
 		bdput(bdev);
 	}
@@ -329,7 +327,7 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
 	config->blksize = blocksize;
 	config->bytesize = blocksize * nr_blocks;
 	if (nbd->task_recv != NULL)
-		nbd_size_update(nbd, false);
+		nbd_size_update(nbd);
 }
 
 static void nbd_complete_rq(struct request *req)
@@ -1309,7 +1307,7 @@ static int nbd_start_device(struct nbd_device *nbd)
 		args->index = i;
 		queue_work(nbd->recv_workq, &args->work);
 	}
-	nbd_size_update(nbd, true);
+	nbd_size_update(nbd);
 	return error;
 }
 
-- 
2.28.0


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

* [PATCH 08/24] nbd: move the task_recv check into nbd_size_update
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (6 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 07/24] nbd: remove the call to set_blocksize Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 09/24] nbd: refactor size updates Christoph Hellwig
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

nbd_size_update is about to acquire a few more callers, so lift the check
into the function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index f618688a196654..58b7090dcbd832 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -299,8 +299,11 @@ static void nbd_size_clear(struct nbd_device *nbd)
 static void nbd_size_update(struct nbd_device *nbd)
 {
 	struct nbd_config *config = nbd->config;
-	struct block_device *bdev = bdget_disk(nbd->disk, 0);
 	sector_t nr_sectors = config->bytesize >> 9;
+	struct block_device *bdev;
+
+	if (!nbd->task_recv)
+		return;
 
 	if (config->flags & NBD_FLAG_SEND_TRIM) {
 		nbd->disk->queue->limits.discard_granularity = config->blksize;
@@ -309,7 +312,9 @@ static void nbd_size_update(struct nbd_device *nbd)
 	}
 	blk_queue_logical_block_size(nbd->disk->queue, config->blksize);
 	blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
+
 	set_capacity(nbd->disk, nr_sectors);
+	bdev = bdget_disk(nbd->disk, 0);
 	if (bdev) {
 		if (bdev->bd_disk)
 			bd_set_nr_sectors(bdev, nr_sectors);
@@ -326,8 +331,7 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
 	struct nbd_config *config = nbd->config;
 	config->blksize = blocksize;
 	config->bytesize = blocksize * nr_blocks;
-	if (nbd->task_recv != NULL)
-		nbd_size_update(nbd);
+	nbd_size_update(nbd);
 }
 
 static void nbd_complete_rq(struct request *req)
-- 
2.28.0


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

* [PATCH 09/24] nbd: refactor size updates
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (7 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 08/24] nbd: move the task_recv check into nbd_size_update Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 10/24] nbd: validate the block size in nbd_set_size Christoph Hellwig
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Merge nbd_size_set and nbd_size_update into a single function that also
updates the nbd_config fields.  This new function takes the device size
in bytes as the first argument, and the blocksize as the second argument,
simplifying the calculations required in most callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 44 ++++++++++++++++++--------------------------
 1 file changed, 18 insertions(+), 26 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 58b7090dcbd832..eb8a5da48ad75a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -296,28 +296,30 @@ static void nbd_size_clear(struct nbd_device *nbd)
 	}
 }
 
-static void nbd_size_update(struct nbd_device *nbd)
+static void nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
+		loff_t blksize)
 {
-	struct nbd_config *config = nbd->config;
-	sector_t nr_sectors = config->bytesize >> 9;
 	struct block_device *bdev;
 
+	nbd->config->bytesize = bytesize;
+	nbd->config->blksize = blksize;
+
 	if (!nbd->task_recv)
 		return;
 
-	if (config->flags & NBD_FLAG_SEND_TRIM) {
-		nbd->disk->queue->limits.discard_granularity = config->blksize;
-		nbd->disk->queue->limits.discard_alignment = config->blksize;
+	if (nbd->config->flags & NBD_FLAG_SEND_TRIM) {
+		nbd->disk->queue->limits.discard_granularity = blksize;
+		nbd->disk->queue->limits.discard_alignment = blksize;
 		blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX);
 	}
-	blk_queue_logical_block_size(nbd->disk->queue, config->blksize);
-	blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
+	blk_queue_logical_block_size(nbd->disk->queue, blksize);
+	blk_queue_physical_block_size(nbd->disk->queue, blksize);
 
-	set_capacity(nbd->disk, nr_sectors);
+	set_capacity(nbd->disk, bytesize >> 9);
 	bdev = bdget_disk(nbd->disk, 0);
 	if (bdev) {
 		if (bdev->bd_disk)
-			bd_set_nr_sectors(bdev, nr_sectors);
+			bd_set_nr_sectors(bdev, bytesize >> 9);
 		else
 			set_bit(GD_NEED_PART_SCAN, &nbd->disk->state);
 		bdput(bdev);
@@ -325,15 +327,6 @@ static void nbd_size_update(struct nbd_device *nbd)
 	kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
 }
 
-static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
-			 loff_t nr_blocks)
-{
-	struct nbd_config *config = nbd->config;
-	config->blksize = blocksize;
-	config->bytesize = blocksize * nr_blocks;
-	nbd_size_update(nbd);
-}
-
 static void nbd_complete_rq(struct request *req)
 {
 	struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req);
@@ -1311,7 +1304,7 @@ static int nbd_start_device(struct nbd_device *nbd)
 		args->index = i;
 		queue_work(nbd->recv_workq, &args->work);
 	}
-	nbd_size_update(nbd);
+	nbd_set_size(nbd, config->bytesize, config->blksize);
 	return error;
 }
 
@@ -1390,15 +1383,14 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 			arg = NBD_DEF_BLKSIZE;
 		if (!nbd_is_valid_blksize(arg))
 			return -EINVAL;
-		nbd_size_set(nbd, arg,
-			     div_s64(config->bytesize, arg));
+		nbd_set_size(nbd, config->bytesize, arg);
 		return 0;
 	case NBD_SET_SIZE:
-		nbd_size_set(nbd, config->blksize,
-			     div_s64(arg, config->blksize));
+		nbd_set_size(nbd, arg, config->blksize);
 		return 0;
 	case NBD_SET_SIZE_BLOCKS:
-		nbd_size_set(nbd, config->blksize, arg);
+		nbd_set_size(nbd, arg * config->blksize,
+			     config->blksize);
 		return 0;
 	case NBD_SET_TIMEOUT:
 		nbd_set_cmd_timeout(nbd, arg);
@@ -1827,7 +1819,7 @@ static int nbd_genl_size_set(struct genl_info *info, struct nbd_device *nbd)
 	}
 
 	if (bytes != config->bytesize || bsize != config->blksize)
-		nbd_size_set(nbd, bsize, div64_u64(bytes, bsize));
+		nbd_set_size(nbd, bytes, bsize);
 	return 0;
 }
 
-- 
2.28.0


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

* [PATCH 10/24] nbd: validate the block size in nbd_set_size
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (8 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 09/24] nbd: refactor size updates Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 11/24] nbd: use set_capacity_and_notify Christoph Hellwig
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Move the validation of the block from the callers into nbd_set_size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 47 +++++++++++++++------------------------------
 1 file changed, 15 insertions(+), 32 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index eb8a5da48ad75a..327060e01ad58e 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -296,16 +296,21 @@ static void nbd_size_clear(struct nbd_device *nbd)
 	}
 }
 
-static void nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
+static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 		loff_t blksize)
 {
 	struct block_device *bdev;
 
+	if (!blksize)
+		blksize = NBD_DEF_BLKSIZE;
+	if (blksize < 512 || blksize > PAGE_SIZE || !is_power_of_2(blksize))
+		return -EINVAL;
+
 	nbd->config->bytesize = bytesize;
 	nbd->config->blksize = blksize;
 
 	if (!nbd->task_recv)
-		return;
+		return 0;
 
 	if (nbd->config->flags & NBD_FLAG_SEND_TRIM) {
 		nbd->disk->queue->limits.discard_granularity = blksize;
@@ -325,6 +330,7 @@ static void nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 		bdput(bdev);
 	}
 	kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
+	return 0;
 }
 
 static void nbd_complete_rq(struct request *req)
@@ -1304,8 +1310,7 @@ static int nbd_start_device(struct nbd_device *nbd)
 		args->index = i;
 		queue_work(nbd->recv_workq, &args->work);
 	}
-	nbd_set_size(nbd, config->bytesize, config->blksize);
-	return error;
+	return nbd_set_size(nbd, config->bytesize, config->blksize);
 }
 
 static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *bdev)
@@ -1347,14 +1352,6 @@ static void nbd_clear_sock_ioctl(struct nbd_device *nbd,
 		nbd_config_put(nbd);
 }
 
-static bool nbd_is_valid_blksize(unsigned long blksize)
-{
-	if (!blksize || !is_power_of_2(blksize) || blksize < 512 ||
-	    blksize > PAGE_SIZE)
-		return false;
-	return true;
-}
-
 static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout)
 {
 	nbd->tag_set.timeout = timeout * HZ;
@@ -1379,19 +1376,12 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 	case NBD_SET_SOCK:
 		return nbd_add_socket(nbd, arg, false);
 	case NBD_SET_BLKSIZE:
-		if (!arg)
-			arg = NBD_DEF_BLKSIZE;
-		if (!nbd_is_valid_blksize(arg))
-			return -EINVAL;
-		nbd_set_size(nbd, config->bytesize, arg);
-		return 0;
+		return nbd_set_size(nbd, config->bytesize, arg);
 	case NBD_SET_SIZE:
-		nbd_set_size(nbd, arg, config->blksize);
-		return 0;
+		return nbd_set_size(nbd, arg, config->blksize);
 	case NBD_SET_SIZE_BLOCKS:
-		nbd_set_size(nbd, arg * config->blksize,
-			     config->blksize);
-		return 0;
+		return nbd_set_size(nbd, arg * config->blksize,
+				    config->blksize);
 	case NBD_SET_TIMEOUT:
 		nbd_set_cmd_timeout(nbd, arg);
 		return 0;
@@ -1808,18 +1798,11 @@ static int nbd_genl_size_set(struct genl_info *info, struct nbd_device *nbd)
 	if (info->attrs[NBD_ATTR_SIZE_BYTES])
 		bytes = nla_get_u64(info->attrs[NBD_ATTR_SIZE_BYTES]);
 
-	if (info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES]) {
+	if (info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES])
 		bsize = nla_get_u64(info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES]);
-		if (!bsize)
-			bsize = NBD_DEF_BLKSIZE;
-		if (!nbd_is_valid_blksize(bsize)) {
-			printk(KERN_ERR "Invalid block size %llu\n", bsize);
-			return -EINVAL;
-		}
-	}
 
 	if (bytes != config->bytesize || bsize != config->blksize)
-		nbd_set_size(nbd, bytes, bsize);
+		return nbd_set_size(nbd, bytes, bsize);
 	return 0;
 }
 
-- 
2.28.0


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

* [PATCH 11/24] nbd: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (9 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 10/24] nbd: validate the block size in nbd_set_size Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 12/24] aoe: don't call set_capacity from irq context Christoph Hellwig
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to update the disk and block device sizes and
send a RESIZE uevent to userspace.  Note that blktests relies on uevents
being sent also for updates that did not change the device size, so the
explicit kobject_uevent remains for that case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 327060e01ad58e..a6f51934391edb 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -299,8 +299,6 @@ static void nbd_size_clear(struct nbd_device *nbd)
 static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 		loff_t blksize)
 {
-	struct block_device *bdev;
-
 	if (!blksize)
 		blksize = NBD_DEF_BLKSIZE;
 	if (blksize < 512 || blksize > PAGE_SIZE || !is_power_of_2(blksize))
@@ -320,16 +318,9 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 	blk_queue_logical_block_size(nbd->disk->queue, blksize);
 	blk_queue_physical_block_size(nbd->disk->queue, blksize);
 
-	set_capacity(nbd->disk, bytesize >> 9);
-	bdev = bdget_disk(nbd->disk, 0);
-	if (bdev) {
-		if (bdev->bd_disk)
-			bd_set_nr_sectors(bdev, bytesize >> 9);
-		else
-			set_bit(GD_NEED_PART_SCAN, &nbd->disk->state);
-		bdput(bdev);
-	}
-	kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
+	set_bit(GD_NEED_PART_SCAN, &nbd->disk->state);
+	if (!set_capacity_and_notify(nbd->disk, bytesize >> 9))
+		kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
 	return 0;
 }
 
-- 
2.28.0


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

* [PATCH 12/24] aoe: don't call set_capacity from irq context
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (10 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 11/24] nbd: use set_capacity_and_notify Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 13/24] dm: use set_capacity_and_notify Christoph Hellwig
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Updating the block device size from irq context can lead to torn
writes of the 64-bit value, and prevents us from using normal
process context locking primitives to serialize access to the 64-bit
nr_sectors value.  Defer the set_capacity to the already existing
workqueue handler, where it can be merged with the update of the
block device size by using set_capacity_and_notify.  As an extra
bonus this also adds proper uevent notifications for the resize.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/aoe/aoecmd.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 313f0b946fe2b3..ac720bdcd983e7 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -890,19 +890,13 @@ void
 aoecmd_sleepwork(struct work_struct *work)
 {
 	struct aoedev *d = container_of(work, struct aoedev, work);
-	struct block_device *bd;
-	u64 ssize;
 
 	if (d->flags & DEVFL_GDALLOC)
 		aoeblk_gdalloc(d);
 
 	if (d->flags & DEVFL_NEWSIZE) {
-		ssize = get_capacity(d->gd);
-		bd = bdget_disk(d->gd, 0);
-		if (bd) {
-			bd_set_nr_sectors(bd, ssize);
-			bdput(bd);
-		}
+		set_capacity_and_notify(d->gd, d->ssize);
+
 		spin_lock_irq(&d->lock);
 		d->flags |= DEVFL_UP;
 		d->flags &= ~DEVFL_NEWSIZE;
@@ -971,10 +965,9 @@ ataid_complete(struct aoedev *d, struct aoetgt *t, unsigned char *id)
 	d->geo.start = 0;
 	if (d->flags & (DEVFL_GDALLOC|DEVFL_NEWSIZE))
 		return;
-	if (d->gd != NULL) {
-		set_capacity(d->gd, ssize);
+	if (d->gd != NULL)
 		d->flags |= DEVFL_NEWSIZE;
-	} else
+	else
 		d->flags |= DEVFL_GDALLOC;
 	schedule_work(&d->work);
 }
-- 
2.28.0


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

* [PATCH 13/24] dm: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (11 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 12/24] aoe: don't call set_capacity from irq context Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 14/24] pktcdvd: " Christoph Hellwig
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index c18fc25485186d..62ad44925e73ec 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1971,8 +1971,7 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
 	if (size != dm_get_size(md))
 		memset(&md->geometry, 0, sizeof(md->geometry));
 
-	set_capacity(md->disk, size);
-	bd_set_nr_sectors(md->bdev, size);
+	set_capacity_and_notify(md->disk, size);
 
 	dm_table_event_callback(t, event_callback, md);
 
-- 
2.28.0


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

* [PATCH 14/24] pktcdvd: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (12 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 13/24] dm: use set_capacity_and_notify Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 15/24] nvme: use set_capacity_and_notify in nvme_set_queue_dying Christoph Hellwig
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/pktcdvd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 467dbd06b7cdb1..4326401cede445 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2130,8 +2130,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)
 	}
 
 	set_capacity(pd->disk, lba << 2);
-	set_capacity(pd->bdev->bd_disk, lba << 2);
-	bd_set_nr_sectors(pd->bdev, lba << 2);
+	set_capacity_and_notify(pd->bdev->bd_disk, lba << 2);
 
 	q = bdev_get_queue(pd->bdev);
 	if (write) {
-- 
2.28.0


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

* [PATCH 15/24] nvme: use set_capacity_and_notify in nvme_set_queue_dying
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (13 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 14/24] pktcdvd: " Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 16/24] drbd: use set_capacity_and_notify Christoph Hellwig
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use the block layer helper to update both the disk and block device
sizes.  Contrary to the name no notification is sent in this case,
as a size 0 is special cased.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index aa6e27c2eec945..223c681d774a6f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -93,16 +93,6 @@ static void nvme_put_subsystem(struct nvme_subsystem *subsys);
 static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
 					   unsigned nsid);
 
-static void nvme_update_bdev_size(struct gendisk *disk)
-{
-	struct block_device *bdev = bdget_disk(disk, 0);
-
-	if (bdev) {
-		bd_set_nr_sectors(bdev, get_capacity(disk));
-		bdput(bdev);
-	}
-}
-
 /*
  * Prepare a queue for teardown.
  *
@@ -119,8 +109,7 @@ static void nvme_set_queue_dying(struct nvme_ns *ns)
 	blk_set_queue_dying(ns->queue);
 	blk_mq_unquiesce_queue(ns->queue);
 
-	set_capacity(ns->disk, 0);
-	nvme_update_bdev_size(ns->disk);
+	set_capacity_and_notify(ns->disk, 0);
 }
 
 static void nvme_queue_scan(struct nvme_ctrl *ctrl)
-- 
2.28.0


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

* [PATCH 16/24] drbd: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (14 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 15/24] nvme: use set_capacity_and_notify in nvme_set_queue_dying Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 17/24] rbd: " Christoph Hellwig
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/drbd/drbd_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 65b95aef8dbc95..1c8c18b2a25f33 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2036,8 +2036,7 @@ void drbd_set_my_capacity(struct drbd_device *device, sector_t size)
 {
 	char ppb[10];
 
-	set_capacity(device->vdisk, size);
-	revalidate_disk_size(device->vdisk, false);
+	set_capacity_and_notify(device->vdisk, size);
 
 	drbd_info(device, "size = %s (%llu KB)\n",
 		ppsize(ppb, size>>1), (unsigned long long)size>>1);
@@ -2068,8 +2067,7 @@ void drbd_device_cleanup(struct drbd_device *device)
 	}
 	D_ASSERT(device, first_peer_device(device)->connection->net_conf == NULL);
 
-	set_capacity(device->vdisk, 0);
-	revalidate_disk_size(device->vdisk, false);
+	set_capacity_and_notify(device->vdisk, 0);
 	if (device->bitmap) {
 		/* maybe never allocated. */
 		drbd_bm_resize(device, 0, 1);
-- 
2.28.0


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

* [PATCH 17/24] rbd: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (15 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 16/24] drbd: use set_capacity_and_notify Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-09 13:52   ` Ilya Dryomov
  2020-11-06 19:03 ` [PATCH 18/24] rnbd: " Christoph Hellwig
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/rbd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index f84128abade319..b7a194ffda55b4 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4920,8 +4920,7 @@ static void rbd_dev_update_size(struct rbd_device *rbd_dev)
 	    !test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) {
 		size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE;
 		dout("setting size to %llu sectors", (unsigned long long)size);
-		set_capacity(rbd_dev->disk, size);
-		revalidate_disk_size(rbd_dev->disk, true);
+		set_capacity_and_notify(rbd_dev->disk, size);
 	}
 }
 
-- 
2.28.0


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

* [PATCH 18/24] rnbd: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (16 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 17/24] rbd: " Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-09  6:56   ` Jinpu Wang
  2020-11-06 19:03 ` [PATCH 19/24] zram: " Christoph Hellwig
                   ` (6 subsequent siblings)
  24 siblings, 1 reply; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/rnbd/rnbd-clt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index 8b2411ccbda97c..bb13d7dd195a08 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -100,8 +100,7 @@ static int rnbd_clt_change_capacity(struct rnbd_clt_dev *dev,
 	rnbd_clt_info(dev, "Device size changed from %zu to %zu sectors\n",
 		       dev->nsectors, new_nsectors);
 	dev->nsectors = new_nsectors;
-	set_capacity(dev->gd, dev->nsectors);
-	revalidate_disk_size(dev->gd, true);
+	set_capacity_and_notify(dev->gd, dev->nsectors);
 	return 0;
 }
 
-- 
2.28.0


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

* [PATCH 19/24] zram: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (17 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 18/24] rnbd: " Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 20/24] dm-raid: " Christoph Hellwig
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/zram/zram_drv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1b697208d66157..6d15d51cee2b7e 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1695,7 +1695,7 @@ static void zram_reset_device(struct zram *zram)
 	disksize = zram->disksize;
 	zram->disksize = 0;
 
-	set_capacity(zram->disk, 0);
+	set_capacity_and_notify(zram->disk, 0);
 	part_stat_set_all(&zram->disk->part0, 0);
 
 	up_write(&zram->init_lock);
@@ -1741,9 +1741,7 @@ static ssize_t disksize_store(struct device *dev,
 
 	zram->comp = comp;
 	zram->disksize = disksize;
-	set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
-
-	revalidate_disk_size(zram->disk, true);
+	set_capacity_and_notify(zram->disk, zram->disksize >> SECTOR_SHIFT);
 	up_write(&zram->init_lock);
 
 	return len;
@@ -1790,7 +1788,6 @@ static ssize_t reset_store(struct device *dev,
 	/* Make sure all the pending I/O are finished */
 	fsync_bdev(bdev);
 	zram_reset_device(zram);
-	revalidate_disk_size(zram->disk, true);
 	bdput(bdev);
 
 	mutex_lock(&bdev->bd_mutex);
-- 
2.28.0


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

* [PATCH 20/24] dm-raid: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (18 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 19/24] zram: " Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-06 19:03 ` [PATCH 21/24] md: " Christoph Hellwig
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-raid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 9c1f7c4de65b35..294f34d2d61bae 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -700,8 +700,7 @@ static void rs_set_capacity(struct raid_set *rs)
 {
 	struct gendisk *gendisk = dm_disk(dm_table_get_md(rs->ti->table));
 
-	set_capacity(gendisk, rs->md.array_sectors);
-	revalidate_disk_size(gendisk, true);
+	set_capacity_and_notify(gendisk, rs->md.array_sectors);
 }
 
 /*
-- 
2.28.0


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

* [PATCH 21/24] md: use set_capacity_and_notify
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (19 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 20/24] dm-raid: " Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-07  0:32   ` Song Liu
  2020-11-06 19:03 ` [PATCH 22/24] md: remove a spurious call to revalidate_disk_size in update_size Christoph Hellwig
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/md-cluster.c |  6 ++----
 drivers/md/md-linear.c  |  3 +--
 drivers/md/md.c         | 24 ++++++++++--------------
 3 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 4aaf4820b6f625..87442dc59f6ca3 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -581,8 +581,7 @@ static int process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
 		process_metadata_update(mddev, msg);
 		break;
 	case CHANGE_CAPACITY:
-		set_capacity(mddev->gendisk, mddev->array_sectors);
-		revalidate_disk_size(mddev->gendisk, true);
+		set_capacity_and_notify(mddev->gendisk, mddev->array_sectors);
 		break;
 	case RESYNCING:
 		set_bit(MD_RESYNCING_REMOTE, &mddev->recovery);
@@ -1296,8 +1295,7 @@ static void update_size(struct mddev *mddev, sector_t old_dev_sectors)
 		if (ret)
 			pr_err("%s:%d: failed to send CHANGE_CAPACITY msg\n",
 			       __func__, __LINE__);
-		set_capacity(mddev->gendisk, mddev->array_sectors);
-		revalidate_disk_size(mddev->gendisk, true);
+		set_capacity_and_notify(mddev->gendisk, mddev->array_sectors);
 	} else {
 		/* revert to previous sectors */
 		ret = mddev->pers->resize(mddev, old_dev_sectors);
diff --git a/drivers/md/md-linear.c b/drivers/md/md-linear.c
index 5ab22069b5be9c..98f1b4b2bdcef8 100644
--- a/drivers/md/md-linear.c
+++ b/drivers/md/md-linear.c
@@ -200,9 +200,8 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
 		"copied raid_disks doesn't match mddev->raid_disks");
 	rcu_assign_pointer(mddev->private, newconf);
 	md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
-	set_capacity(mddev->gendisk, mddev->array_sectors);
+	set_capacity_and_notify(mddev->gendisk, mddev->array_sectors);
 	mddev_resume(mddev);
-	revalidate_disk_size(mddev->gendisk, true);
 	kfree_rcu(oldconf, rcu);
 	return 0;
 }
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 98bac4f304ae26..32e375d50fee17 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5355,10 +5355,9 @@ array_size_store(struct mddev *mddev, const char *buf, size_t len)
 
 	if (!err) {
 		mddev->array_sectors = sectors;
-		if (mddev->pers) {
-			set_capacity(mddev->gendisk, mddev->array_sectors);
-			revalidate_disk_size(mddev->gendisk, true);
-		}
+		if (mddev->pers)
+			set_capacity_and_notify(mddev->gendisk,
+						mddev->array_sectors);
 	}
 	mddev_unlock(mddev);
 	return err ?: len;
@@ -6107,8 +6106,7 @@ int do_md_run(struct mddev *mddev)
 	md_wakeup_thread(mddev->thread);
 	md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
 
-	set_capacity(mddev->gendisk, mddev->array_sectors);
-	revalidate_disk_size(mddev->gendisk, true);
+	set_capacity_and_notify(mddev->gendisk, mddev->array_sectors);
 	clear_bit(MD_NOT_READY, &mddev->flags);
 	mddev->changed = 1;
 	kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
@@ -6423,10 +6421,9 @@ static int do_md_stop(struct mddev *mddev, int mode,
 			if (rdev->raid_disk >= 0)
 				sysfs_unlink_rdev(mddev, rdev);
 
-		set_capacity(disk, 0);
+		set_capacity_and_notify(disk, 0);
 		mutex_unlock(&mddev->open_mutex);
 		mddev->changed = 1;
-		revalidate_disk_size(disk, true);
 
 		if (mddev->ro)
 			mddev->ro = 0;
@@ -7257,8 +7254,8 @@ static int update_size(struct mddev *mddev, sector_t num_sectors)
 		if (mddev_is_clustered(mddev))
 			md_cluster_ops->update_size(mddev, old_dev_sectors);
 		else if (mddev->queue) {
-			set_capacity(mddev->gendisk, mddev->array_sectors);
-			revalidate_disk_size(mddev->gendisk, true);
+			set_capacity_and_notify(mddev->gendisk,
+						mddev->array_sectors);
 		}
 	}
 	return rv;
@@ -9035,10 +9032,9 @@ void md_do_sync(struct md_thread *thread)
 		mddev_lock_nointr(mddev);
 		md_set_array_sectors(mddev, mddev->pers->size(mddev, 0, 0));
 		mddev_unlock(mddev);
-		if (!mddev_is_clustered(mddev)) {
-			set_capacity(mddev->gendisk, mddev->array_sectors);
-			revalidate_disk_size(mddev->gendisk, true);
-		}
+		if (!mddev_is_clustered(mddev))
+			set_capacity_and_notify(mddev->gendisk,
+						mddev->array_sectors);
 	}
 
 	spin_lock(&mddev->lock);
-- 
2.28.0


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

* [PATCH 22/24] md: remove a spurious call to revalidate_disk_size in update_size
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (20 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 21/24] md: " Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-07  0:39   ` Song Liu
  2020-11-06 19:03 ` [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size Christoph Hellwig
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

None of the ->resize methods updates the disk size, so calling
revalidate_disk_size here won't do anything.

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

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 87442dc59f6ca3..35e2690c1803dd 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1299,8 +1299,6 @@ static void update_size(struct mddev *mddev, sector_t old_dev_sectors)
 	} else {
 		/* revert to previous sectors */
 		ret = mddev->pers->resize(mddev, old_dev_sectors);
-		if (!ret)
-			revalidate_disk_size(mddev->gendisk, true);
 		ret = __sendmsg(cinfo, &cmsg);
 		if (ret)
 			pr_err("%s:%d: failed to send METADATA_UPDATED msg\n",
-- 
2.28.0


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

* [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (21 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 22/24] md: remove a spurious call to revalidate_disk_size in update_size Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-08 15:15   ` Paolo Bonzini
                     ` (2 more replies)
  2020-11-06 19:03 ` [PATCH 24/24] block: unexport revalidate_disk_size Christoph Hellwig
  2020-11-09 18:07 ` cleanup updating the size of block devices Josef Bacik
  24 siblings, 3 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

revalidate_disk_size just updates the block device size from the disk
size.  Thus calling it from revalidate_disk_size doesn't actually do
anything.

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

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 3e812b4c32e669..145606dc52db1e 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -598,7 +598,6 @@ static void virtblk_update_cache_mode(struct virtio_device *vdev)
 	struct virtio_blk *vblk = vdev->priv;
 
 	blk_queue_write_cache(vblk->disk->queue, writeback, false);
-	revalidate_disk_size(vblk->disk, true);
 }
 
 static const char *const virtblk_cache_types[] = {
-- 
2.28.0


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

* [PATCH 24/24] block: unexport revalidate_disk_size
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (22 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size Christoph Hellwig
@ 2020-11-06 19:03 ` Christoph Hellwig
  2020-11-09 18:07 ` cleanup updating the size of block devices Josef Bacik
  24 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-06 19:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

revalidate_disk_size is not only called from set_capacity_and_notify,
so drop the export.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/block_dev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 66ebf594c97f47..d8664f5c1ff669 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1362,7 +1362,6 @@ void revalidate_disk_size(struct gendisk *disk, bool verbose)
 		bdput(bdev);
 	}
 }
-EXPORT_SYMBOL(revalidate_disk_size);
 
 void bd_set_nr_sectors(struct block_device *bdev, sector_t sectors)
 {
-- 
2.28.0


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

* Re: [PATCH 21/24] md: use set_capacity_and_notify
  2020-11-06 19:03 ` [PATCH 21/24] md: " Christoph Hellwig
@ 2020-11-07  0:32   ` Song Liu
  0 siblings, 0 replies; 40+ messages in thread
From: Song Liu @ 2020-11-07  0:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Martin K. Petersen, dm-devel,
	linux-block, drbd-dev, nbd, ceph-devel, xen-devel, linux-raid,
	linux-nvme, linux-scsi, Linux-Fsdevel

On Fri, Nov 6, 2020 at 11:04 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Use set_capacity_and_notify to set the size of both the disk and block
> device.  This also gets the uevent notifications for the resize for free.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Song Liu <song@kernel.org>

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

* Re: [PATCH 22/24] md: remove a spurious call to revalidate_disk_size in update_size
  2020-11-06 19:03 ` [PATCH 22/24] md: remove a spurious call to revalidate_disk_size in update_size Christoph Hellwig
@ 2020-11-07  0:39   ` Song Liu
  0 siblings, 0 replies; 40+ messages in thread
From: Song Liu @ 2020-11-07  0:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Martin K. Petersen, dm-devel,
	linux-block, drbd-dev, nbd, ceph-devel, xen-devel, linux-raid,
	linux-nvme, linux-scsi, Linux-Fsdevel

On Fri, Nov 6, 2020 at 11:04 AM Christoph Hellwig <hch@lst.de> wrote:
>
> None of the ->resize methods updates the disk size, so calling
> revalidate_disk_size here won't do anything.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Song Liu <song@kernel.org>

> ---
>  drivers/md/md-cluster.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
> index 87442dc59f6ca3..35e2690c1803dd 100644
> --- a/drivers/md/md-cluster.c
> +++ b/drivers/md/md-cluster.c
> @@ -1299,8 +1299,6 @@ static void update_size(struct mddev *mddev, sector_t old_dev_sectors)
>         } else {
>                 /* revert to previous sectors */
>                 ret = mddev->pers->resize(mddev, old_dev_sectors);
> -               if (!ret)
> -                       revalidate_disk_size(mddev->gendisk, true);
>                 ret = __sendmsg(cinfo, &cmsg);
>                 if (ret)
>                         pr_err("%s:%d: failed to send METADATA_UPDATED msg\n",
> --
> 2.28.0
>

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

* Re: [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size
  2020-11-06 19:03 ` [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size Christoph Hellwig
@ 2020-11-08 15:15   ` Paolo Bonzini
  2020-11-09 10:22   ` Stefan Hajnoczi
  2020-11-09 11:30   ` Michael S. Tsirkin
  2 siblings, 0 replies; 40+ messages in thread
From: Paolo Bonzini @ 2020-11-08 15:15 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On 06/11/20 20:03, Christoph Hellwig wrote:
> revalidate_disk_size just updates the block device size from the disk 
> size. Thus calling it from revalidate_disk_size doesn't actually do 

s/revalidate_disk_size/virtblk_update_cache_mode/

> anything.


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

* Re: [PATCH 18/24] rnbd: use set_capacity_and_notify
  2020-11-06 19:03 ` [PATCH 18/24] rnbd: " Christoph Hellwig
@ 2020-11-09  6:56   ` Jinpu Wang
  0 siblings, 0 replies; 40+ messages in thread
From: Jinpu Wang @ 2020-11-09  6:56 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	device-mapper development, linux-block, drbd-dev, nbd,
	ceph-devel, xen-devel, linux-raid, linux-nvme,
	Linux SCSI Mailinglist, linux-fsdevel

On Fri, Nov 6, 2020 at 8:04 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Use set_capacity_and_notify to set the size of both the disk and block
> device.  This also gets the uevent notifications for the resize for free.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Thanks, Christoph!
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
> ---
>  drivers/block/rnbd/rnbd-clt.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
> index 8b2411ccbda97c..bb13d7dd195a08 100644
> --- a/drivers/block/rnbd/rnbd-clt.c
> +++ b/drivers/block/rnbd/rnbd-clt.c
> @@ -100,8 +100,7 @@ static int rnbd_clt_change_capacity(struct rnbd_clt_dev *dev,
>         rnbd_clt_info(dev, "Device size changed from %zu to %zu sectors\n",
>                        dev->nsectors, new_nsectors);
>         dev->nsectors = new_nsectors;
> -       set_capacity(dev->gd, dev->nsectors);
> -       revalidate_disk_size(dev->gd, true);
> +       set_capacity_and_notify(dev->gd, dev->nsectors);
>         return 0;
>  }
>
> --
> 2.28.0
>

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

* Re: [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size
  2020-11-06 19:03 ` [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size Christoph Hellwig
@ 2020-11-09  7:53   ` Hannes Reinecke
  2020-11-09  8:53     ` Christoph Hellwig
  0 siblings, 1 reply; 40+ messages in thread
From: Hannes Reinecke @ 2020-11-09  7:53 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On 11/6/20 8:03 PM, Christoph Hellwig wrote:
> There is no good reason to call revalidate_disk_size separately.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/nvme/host/core.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 376096bfc54a83..4e86c9aafd88a7 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2053,7 +2053,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
>   			capacity = 0;
>   	}
>   
> -	set_capacity_revalidate_and_notify(disk, capacity, false);
> +	set_capacity_revalidate_and_notify(disk, capacity, true);
>   
>   	nvme_config_discard(disk, ns);
>   	nvme_config_write_zeroes(disk, ns);
> @@ -2136,7 +2136,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
>   		blk_stack_limits(&ns->head->disk->queue->limits,
>   				 &ns->queue->limits, 0);
>   		blk_queue_update_readahead(ns->head->disk->queue);
> -		nvme_update_bdev_size(ns->head->disk);
>   		blk_mq_unfreeze_queue(ns->head->disk->queue);
>   	}
>   #endif

Hold on.
This, at the very least, should be a separate patch.
With this you are changing the behaviour of nvme multipath.

Originally nvme multipath would update/change the size of the multipath 
device according to the underlying path devices.
With this patch the size of the multipath device will _not_ change if 
there is a change on the underlying devices.

While personally I would _love_ to have this patch, we should at least 
document this by making it a separate patch.
And we possibly should check if both sizes are the same, and think of 
what we should be doing if they are not.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

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

* Re: [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size
  2020-11-09  7:53   ` Hannes Reinecke
@ 2020-11-09  8:53     ` Christoph Hellwig
  2020-11-09  9:25       ` Hannes Reinecke
  0 siblings, 1 reply; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-09  8:53 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Jens Axboe, Justin Sanders, Josef Bacik,
	Ilya Dryomov, Jack Wang, Michael S. Tsirkin, Jason Wang,
	Paolo Bonzini, Stefan Hajnoczi, Konrad Rzeszutek Wilk,
	Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On Mon, Nov 09, 2020 at 08:53:58AM +0100, Hannes Reinecke wrote:
>> index 376096bfc54a83..4e86c9aafd88a7 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -2053,7 +2053,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
>>   			capacity = 0;
>>   	}
>>   -	set_capacity_revalidate_and_notify(disk, capacity, false);
>> +	set_capacity_revalidate_and_notify(disk, capacity, true);
>>     	nvme_config_discard(disk, ns);
>>   	nvme_config_write_zeroes(disk, ns);
>> @@ -2136,7 +2136,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
>>   		blk_stack_limits(&ns->head->disk->queue->limits,
>>   				 &ns->queue->limits, 0);
>>   		blk_queue_update_readahead(ns->head->disk->queue);
>> -		nvme_update_bdev_size(ns->head->disk);
>>   		blk_mq_unfreeze_queue(ns->head->disk->queue);
>>   	}
>>   #endif
>
> Hold on.
> This, at the very least, should be a separate patch.
> With this you are changing the behaviour of nvme multipath.
>
> Originally nvme multipath would update/change the size of the multipath 
> device according to the underlying path devices.
> With this patch the size of the multipath device will _not_ change if there 
> is a change on the underlying devices.

Yes, it will.  Take a close look at nvme_update_disk_info and how it is
called.

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

* Re: [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size
  2020-11-09  8:53     ` Christoph Hellwig
@ 2020-11-09  9:25       ` Hannes Reinecke
  2020-11-09 23:28         ` Sagi Grimberg
  0 siblings, 1 reply; 40+ messages in thread
From: Hannes Reinecke @ 2020-11-09  9:25 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On 11/9/20 9:53 AM, Christoph Hellwig wrote:
> On Mon, Nov 09, 2020 at 08:53:58AM +0100, Hannes Reinecke wrote:
>>> index 376096bfc54a83..4e86c9aafd88a7 100644
>>> --- a/drivers/nvme/host/core.c
>>> +++ b/drivers/nvme/host/core.c
>>> @@ -2053,7 +2053,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
>>>    			capacity = 0;
[ .. ]
>> Originally nvme multipath would update/change the size of the multipath
>> device according to the underlying path devices.
>> With this patch the size of the multipath device will _not_ change if there
>> is a change on the underlying devices.
> 
> Yes, it will.  Take a close look at nvme_update_disk_info and how it is
> called.
> 
Okay, then: What would be the correct way of handling a size update for 
NVMe multipath?
Assuming we're getting an AEN for each path signalling the size change
(or a controller reset leading to a size change).
So if we're updating the size of the multipath device together with the 
path device at the first AEN/reset we'll end up with the other paths 
having a different size than the multipath device (and the path we've 
just been updating).
- Do we care, or cross fingers and hope for the best?
- Shouldn't we detect the case where we won't get a size update for the 
other paths, or, indeed, we have a genuine device size mismatch due to a 
misconfiguration on the target?

IE shouldn't we have a flag 'size update pending' for the other paths,, 
to take them out ouf use temporarily until the other AENs/resets have 
been processed?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

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

* Re: [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size
  2020-11-06 19:03 ` [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size Christoph Hellwig
  2020-11-08 15:15   ` Paolo Bonzini
@ 2020-11-09 10:22   ` Stefan Hajnoczi
  2020-11-09 11:30   ` Michael S. Tsirkin
  2 siblings, 0 replies; 40+ messages in thread
From: Stefan Hajnoczi @ 2020-11-09 10:22 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

On Fri, Nov 06, 2020 at 08:03:35PM +0100, Christoph Hellwig wrote:
> revalidate_disk_size just updates the block device size from the disk
> size.  Thus calling it from revalidate_disk_size doesn't actually do
> anything.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/virtio_blk.c | 1 -
>  1 file changed, 1 deletion(-)

Modulo Paolo's comment:

Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size
  2020-11-06 19:03 ` [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size Christoph Hellwig
  2020-11-08 15:15   ` Paolo Bonzini
  2020-11-09 10:22   ` Stefan Hajnoczi
@ 2020-11-09 11:30   ` Michael S. Tsirkin
  2 siblings, 0 replies; 40+ messages in thread
From: Michael S. Tsirkin @ 2020-11-09 11:30 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On Fri, Nov 06, 2020 at 08:03:35PM +0100, Christoph Hellwig wrote:
> revalidate_disk_size just updates the block device size from the disk
> size.  Thus calling it from revalidate_disk_size doesn't actually do
> anything.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/block/virtio_blk.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 3e812b4c32e669..145606dc52db1e 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -598,7 +598,6 @@ static void virtblk_update_cache_mode(struct virtio_device *vdev)
>  	struct virtio_blk *vblk = vdev->priv;
>  
>  	blk_queue_write_cache(vblk->disk->queue, writeback, false);
> -	revalidate_disk_size(vblk->disk, true);
>  }
>  
>  static const char *const virtblk_cache_types[] = {
> -- 
> 2.28.0


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

* Re: [PATCH 17/24] rbd: use set_capacity_and_notify
  2020-11-06 19:03 ` [PATCH 17/24] rbd: " Christoph Hellwig
@ 2020-11-09 13:52   ` Ilya Dryomov
  0 siblings, 0 replies; 40+ messages in thread
From: Ilya Dryomov @ 2020-11-09 13:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, Lars Ellenberg, nbd, Ceph Development,
	xen-devel, linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On Fri, Nov 6, 2020 at 8:04 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Use set_capacity_and_notify to set the size of both the disk and block
> device.  This also gets the uevent notifications for the resize for free.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/rbd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index f84128abade319..b7a194ffda55b4 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -4920,8 +4920,7 @@ static void rbd_dev_update_size(struct rbd_device *rbd_dev)
>             !test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) {
>                 size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE;
>                 dout("setting size to %llu sectors", (unsigned long long)size);
> -               set_capacity(rbd_dev->disk, size);
> -               revalidate_disk_size(rbd_dev->disk, true);
> +               set_capacity_and_notify(rbd_dev->disk, size);
>         }
>  }
>
> --
> 2.28.0
>

Acked-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya

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

* Re: cleanup updating the size of block devices
  2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
                   ` (23 preceding siblings ...)
  2020-11-06 19:03 ` [PATCH 24/24] block: unexport revalidate_disk_size Christoph Hellwig
@ 2020-11-09 18:07 ` Josef Bacik
  24 siblings, 0 replies; 40+ messages in thread
From: Josef Bacik @ 2020-11-09 18:07 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Justin Sanders, Ilya Dryomov, Jack Wang, Michael S. Tsirkin,
	Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On 11/6/20 2:03 PM, Christoph Hellwig wrote:
> Hi Jens,
> 
> this series builds on top of the work that went into the last merge window,
> and make sure we have a single coherent interfac for updating the size of a
> block device.
> 

You can add

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

for the nbd bits, thanks,

Josef

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

* Re: [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size
  2020-11-09  9:25       ` Hannes Reinecke
@ 2020-11-09 23:28         ` Sagi Grimberg
  2020-11-10  7:00           ` Hannes Reinecke
  0 siblings, 1 reply; 40+ messages in thread
From: Sagi Grimberg @ 2020-11-09 23:28 UTC (permalink / raw)
  To: Hannes Reinecke, Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel


> [ .. ]
>>> Originally nvme multipath would update/change the size of the multipath
>>> device according to the underlying path devices.
>>> With this patch the size of the multipath device will _not_ change if 
>>> there
>>> is a change on the underlying devices.
>>
>> Yes, it will.  Take a close look at nvme_update_disk_info and how it is
>> called.
>>
> Okay, then: What would be the correct way of handling a size update for 
> NVMe multipath?
> Assuming we're getting an AEN for each path signalling the size change
> (or a controller reset leading to a size change).
> So if we're updating the size of the multipath device together with the 
> path device at the first AEN/reset we'll end up with the other paths 
> having a different size than the multipath device (and the path we've 
> just been updating).
> - Do we care, or cross fingers and hope for the best?
> - Shouldn't we detect the case where we won't get a size update for the 
> other paths, or, indeed, we have a genuine device size mismatch due to a 
> misconfiguration on the target?
> 
> IE shouldn't we have a flag 'size update pending' for the other paths,, 
> to take them out ouf use temporarily until the other AENs/resets have 
> been processed?

the mpath device will take the minimum size from all the paths, that is
what blk_stack_limits does. When the AEN for all the paths will arrive
the mpath size will update.

Not sure how this is different than what we have today...

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

* Re: [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size
  2020-11-09 23:28         ` Sagi Grimberg
@ 2020-11-10  7:00           ` Hannes Reinecke
  0 siblings, 0 replies; 40+ messages in thread
From: Hannes Reinecke @ 2020-11-10  7:00 UTC (permalink / raw)
  To: Sagi Grimberg, Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

On 11/10/20 12:28 AM, Sagi Grimberg wrote:
> 
>> [ .. ]
>>>> Originally nvme multipath would update/change the size of the multipath
>>>> device according to the underlying path devices.
>>>> With this patch the size of the multipath device will _not_ change 
>>>> if there
>>>> is a change on the underlying devices.
>>>
>>> Yes, it will.  Take a close look at nvme_update_disk_info and how it is
>>> called.
>>>
>> Okay, then: What would be the correct way of handling a size update 
>> for NVMe multipath?
>> Assuming we're getting an AEN for each path signalling the size change
>> (or a controller reset leading to a size change).
>> So if we're updating the size of the multipath device together with 
>> the path device at the first AEN/reset we'll end up with the other 
>> paths having a different size than the multipath device (and the path 
>> we've just been updating).
>> - Do we care, or cross fingers and hope for the best?
>> - Shouldn't we detect the case where we won't get a size update for 
>> the other paths, or, indeed, we have a genuine device size mismatch 
>> due to a misconfiguration on the target?
>>
>> IE shouldn't we have a flag 'size update pending' for the other 
>> paths,, to take them out ouf use temporarily until the other 
>> AENs/resets have been processed?
> 
> the mpath device will take the minimum size from all the paths, that is
> what blk_stack_limits does. When the AEN for all the paths will arrive
> the mpath size will update.
> 
But that's precisely my point; there won't be an AEN for _all_ paths, 
but rather one AEN per path. Which will be processed separately, leading 
to the issue described above.

> Not sure how this is different than what we have today...

Oh, that is a problem even today.
So we should probably move it to a different thread...

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

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

* Re: [PATCH 04/24] sd: update the bdev size in sd_revalidate_disk
  2020-11-06 19:03 ` [PATCH 04/24] sd: update the bdev size in sd_revalidate_disk Christoph Hellwig
@ 2020-11-11  4:18   ` Martin K. Petersen
  0 siblings, 0 replies; 40+ messages in thread
From: Martin K. Petersen @ 2020-11-11  4:18 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel


Christoph,

> This avoids the extra call to revalidate_disk_size in sd_rescan and
> is otherwise a no-op because the size did not change, or we are in
> the probe path.

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* [PATCH 19/24] zram: use set_capacity_and_notify
  2020-11-11  8:26 cleanup updating the size of block devices v2 Christoph Hellwig
@ 2020-11-11  8:26 ` Christoph Hellwig
  0 siblings, 0 replies; 40+ messages in thread
From: Christoph Hellwig @ 2020-11-11  8:26 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Justin Sanders, Josef Bacik, Ilya Dryomov, Jack Wang,
	Michael S. Tsirkin, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
	Konrad Rzeszutek Wilk, Roger Pau Monné,
	Minchan Kim, Mike Snitzer, Song Liu, Martin K. Petersen,
	dm-devel, linux-block, drbd-dev, nbd, ceph-devel, xen-devel,
	linux-raid, linux-nvme, linux-scsi, linux-fsdevel

Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/zram/zram_drv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1b697208d66157..6d15d51cee2b7e 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1695,7 +1695,7 @@ static void zram_reset_device(struct zram *zram)
 	disksize = zram->disksize;
 	zram->disksize = 0;
 
-	set_capacity(zram->disk, 0);
+	set_capacity_and_notify(zram->disk, 0);
 	part_stat_set_all(&zram->disk->part0, 0);
 
 	up_write(&zram->init_lock);
@@ -1741,9 +1741,7 @@ static ssize_t disksize_store(struct device *dev,
 
 	zram->comp = comp;
 	zram->disksize = disksize;
-	set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
-
-	revalidate_disk_size(zram->disk, true);
+	set_capacity_and_notify(zram->disk, zram->disksize >> SECTOR_SHIFT);
 	up_write(&zram->init_lock);
 
 	return len;
@@ -1790,7 +1788,6 @@ static ssize_t reset_store(struct device *dev,
 	/* Make sure all the pending I/O are finished */
 	fsync_bdev(bdev);
 	zram_reset_device(zram);
-	revalidate_disk_size(zram->disk, true);
 	bdput(bdev);
 
 	mutex_lock(&bdev->bd_mutex);
-- 
2.28.0


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

end of thread, other threads:[~2020-11-11  8:28 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 19:03 cleanup updating the size of block devices Christoph Hellwig
2020-11-06 19:03 ` [PATCH 01/24] block: remove the call to __invalidate_device in check_disk_size_change Christoph Hellwig
2020-11-06 19:03 ` [PATCH 02/24] loop: remove loop_set_size Christoph Hellwig
2020-11-06 19:03 ` [PATCH 03/24] nvme: let set_capacity_revalidate_and_notify update the bdev size Christoph Hellwig
2020-11-09  7:53   ` Hannes Reinecke
2020-11-09  8:53     ` Christoph Hellwig
2020-11-09  9:25       ` Hannes Reinecke
2020-11-09 23:28         ` Sagi Grimberg
2020-11-10  7:00           ` Hannes Reinecke
2020-11-06 19:03 ` [PATCH 04/24] sd: update the bdev size in sd_revalidate_disk Christoph Hellwig
2020-11-11  4:18   ` Martin K. Petersen
2020-11-06 19:03 ` [PATCH 05/24] block: remove the update_bdev parameter from set_capacity_revalidate_and_notify Christoph Hellwig
2020-11-06 19:03 ` [PATCH 06/24] block: add a return value to set_capacity_and_notify Christoph Hellwig
2020-11-06 19:03 ` [PATCH 07/24] nbd: remove the call to set_blocksize Christoph Hellwig
2020-11-06 19:03 ` [PATCH 08/24] nbd: move the task_recv check into nbd_size_update Christoph Hellwig
2020-11-06 19:03 ` [PATCH 09/24] nbd: refactor size updates Christoph Hellwig
2020-11-06 19:03 ` [PATCH 10/24] nbd: validate the block size in nbd_set_size Christoph Hellwig
2020-11-06 19:03 ` [PATCH 11/24] nbd: use set_capacity_and_notify Christoph Hellwig
2020-11-06 19:03 ` [PATCH 12/24] aoe: don't call set_capacity from irq context Christoph Hellwig
2020-11-06 19:03 ` [PATCH 13/24] dm: use set_capacity_and_notify Christoph Hellwig
2020-11-06 19:03 ` [PATCH 14/24] pktcdvd: " Christoph Hellwig
2020-11-06 19:03 ` [PATCH 15/24] nvme: use set_capacity_and_notify in nvme_set_queue_dying Christoph Hellwig
2020-11-06 19:03 ` [PATCH 16/24] drbd: use set_capacity_and_notify Christoph Hellwig
2020-11-06 19:03 ` [PATCH 17/24] rbd: " Christoph Hellwig
2020-11-09 13:52   ` Ilya Dryomov
2020-11-06 19:03 ` [PATCH 18/24] rnbd: " Christoph Hellwig
2020-11-09  6:56   ` Jinpu Wang
2020-11-06 19:03 ` [PATCH 19/24] zram: " Christoph Hellwig
2020-11-06 19:03 ` [PATCH 20/24] dm-raid: " Christoph Hellwig
2020-11-06 19:03 ` [PATCH 21/24] md: " Christoph Hellwig
2020-11-07  0:32   ` Song Liu
2020-11-06 19:03 ` [PATCH 22/24] md: remove a spurious call to revalidate_disk_size in update_size Christoph Hellwig
2020-11-07  0:39   ` Song Liu
2020-11-06 19:03 ` [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size Christoph Hellwig
2020-11-08 15:15   ` Paolo Bonzini
2020-11-09 10:22   ` Stefan Hajnoczi
2020-11-09 11:30   ` Michael S. Tsirkin
2020-11-06 19:03 ` [PATCH 24/24] block: unexport revalidate_disk_size Christoph Hellwig
2020-11-09 18:07 ` cleanup updating the size of block devices Josef Bacik
2020-11-11  8:26 cleanup updating the size of block devices v2 Christoph Hellwig
2020-11-11  8:26 ` [PATCH 19/24] zram: use set_capacity_and_notify 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).