[dm-devel] [PATCH 06/20] block: change the hash used for looking up block devices

2020-11-18 Thread Christoph Hellwig
Adding the minor to the major creates tons of pointless conflicts. Just use the dev_t itself, which is 32-bits and thus is guaranteed to fit into ino_t. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 26 ++ 1 file changed, 2 insertions(+), 24 deletions(-) diff

[dm-devel] [PATCH 14/20] block: remove the nr_sects field in struct hd_struct

2020-11-18 Thread Christoph Hellwig
gets fixed. Signed-off-by: Christoph Hellwig --- block/bio.c| 2 +- block/blk-core.c | 2 +- block/blk.h| 53 -- block/genhd.c | 34 +++--- block/partitions/core.c| 17

[dm-devel] [PATCH 05/20] block: use put_device in put_disk

2020-11-18 Thread Christoph Hellwig
Use put_device to put the device instead of poking into the internals and using kobject_put. Signed-off-by: Christoph Hellwig --- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/genhd.c b/block/genhd.c index 0bd9c41dd4cb69..f46e89226fdf91 100644

[dm-devel] [PATCH 07/20] init: refactor name_to_dev_t

2020-11-18 Thread Christoph Hellwig
Split each case into a self-contained helper. Signed-off-by: Christoph Hellwig --- include/linux/genhd.h | 7 +- init/do_mounts.c | 183 +- 2 files changed, 91 insertions(+), 99 deletions(-) diff --git a/include/linux/genhd.h b/include/linux

[dm-devel] [PATCH 09/20] init: cleanup match_dev_by_uuid and match_dev_by_label

2020-11-18 Thread Christoph Hellwig
Avoid a totally pointless goto label, and use the same style of comparism for both helpers. Signed-off-by: Christoph Hellwig --- init/do_mounts.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/init/do_mounts.c b/init/do_mounts.c index afa26a4028d25e

[dm-devel] [PATCH 18/20] fs: remove get_super_thawed and get_super_exclusive_thawed

2020-11-18 Thread Christoph Hellwig
Just open code the wait in the only caller of both functions. Signed-off-by: Christoph Hellwig --- fs/internal.h | 2 ++ fs/quota/quota.c | 31 +--- fs/super.c | 51 ++ include/linux/fs.h | 4 +--- 4 files

[dm-devel] [PATCH 19/20] bcache: remove a superflous lookup_bdev all

2020-11-18 Thread Christoph Hellwig
Don't bother to call lookup_bdev for just a slightly different error message without any functional change. Signed-off-by: Christoph Hellwig --- drivers/md/bcache/super.c | 44 +-- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/drivers/md

[dm-devel] [PATCH 04/20] block: use disk_part_iter_exit in disk_part_iter_next

2020-11-18 Thread Christoph Hellwig
Call disk_part_iter_exit in disk_part_iter_next instead of duplicating the functionality. Signed-off-by: Christoph Hellwig --- block/genhd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 4e039524f92b8f..0bd9c41dd4cb69 100644

[dm-devel] [PATCH 01/20] blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats

2020-11-18 Thread Christoph Hellwig
disk_get_part needs to be paired with a disk_put_part. Fixes: ef45fe470e1 ("blk-cgroup: show global disk stats in root cgroup io.stat") Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/blk-cgroup.c b/block/blk-cgro

[dm-devel] [PATCH 16/20] block: stop using bdget_disk for partition 0

2020-11-18 Thread Christoph Hellwig
We can just dereference the point in struct gendisk instead. Also remove the now unused export. Signed-off-by: Christoph Hellwig --- block/genhd.c | 1 - drivers/block/nbd.c | 4 +--- drivers/block/xen-blkfront.c| 20 +--- drivers/block/zram

[dm-devel] [PATCH 03/20] block: add a bdev_kobj helper

2020-11-18 Thread Christoph Hellwig
Add a little helper to find the kobject for a struct block_device. Signed-off-by: Christoph Hellwig --- drivers/md/bcache/super.c | 7 ++- drivers/md/md.c | 4 +--- fs/btrfs/sysfs.c | 15 +++ include/linux/blk_types.h | 3 +++ 4 files changed, 9 insertions

[dm-devel] [PATCH 13/20] block: remove ->bd_contains

2020-11-18 Thread Christoph Hellwig
Now that each hd_struct has a reference to the corresponding block_device, there is no need for the bd_contains pointer. Add a bdev_whole() helper to look up the whole device block_device struture instead. Signed-off-by: Christoph Hellwig --- drivers/scsi/scsicam.c| 2 +- fs/block_dev.c

[dm-devel] [PATCH 08/20] init: refactor devt_from_partuuid

2020-11-18 Thread Christoph Hellwig
The code in devt_from_partuuid is very convoluted. Refactor a bit by sanitizing the goto and variable name usage. Signed-off-by: Christoph Hellwig --- init/do_mounts.c | 68 ++-- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/init

[dm-devel] merge struct block_device and struct hd_struct

2020-11-18 Thread Christoph Hellwig
Hi Jens, this series cleans up our main per-device node data structure by merging the block_device and hd_struct data structures that have the same scope, but different life times. The main effect (besides removing lots of code) is that instead of having two device sizes that need complex

[dm-devel] [PATCH 10/20] block: refactor __blkdev_put

2020-11-18 Thread Christoph Hellwig
Reorder the code to have one big section for the last close, and to use bdev_is_partition. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 29db12c3bb501c..4c4d6c30382c06

[dm-devel] [PATCH 12/20] block: simplify the block device claiming interface

2020-11-18 Thread Christoph Hellwig
Stop passing the whole device as a separate argument given that it can be trivially deducted. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 12 +++- fs/block_dev.c | 69 +++--- include/linux/blkdev.h | 6 ++-- 3 files changed, 38

Re: [dm-devel] merge struct block_device and struct hd_struct

2020-11-18 Thread Christoph Hellwig
On Wed, Nov 18, 2020 at 10:04:04AM +0100, Jan Beulich wrote: > That's the view of some people, but not all. Context can be easily > established by those who care going to one of the many archives on > which the entire series lands. Getting spammed, however, can't be > avoided by the dozens or

Re: [dm-devel] merge struct block_device and struct hd_struct

2020-11-18 Thread Christoph Hellwig
On Wed, Nov 18, 2020 at 09:56:11AM +0100, Jan Beulich wrote: > since this isn't the first series from you recently spamming > xen-devel, may I ask that you don't Cc entire series to lists > which are involved with perhaps just one out of the many patches? > IMO Cc lists should be compiled on a

Re: [dm-devel] [PATCH 19/20] bcache: remove a superflous lookup_bdev all

2020-11-18 Thread Christoph Hellwig
On Wed, Nov 18, 2020 at 04:54:51PM +0800, Coly Li wrote: > On 11/18/20 4:47 PM, Christoph Hellwig wrote: > > Don't bother to call lookup_bdev for just a slightly different error > > message without any functional change. > > > > Signed-off-by: Christoph Hellwig ist &

Re: [dm-devel] [PATCH 07/20] init: refactor name_to_dev_t

2020-11-18 Thread Christoph Hellwig
On Wed, Nov 18, 2020 at 03:37:47PM +0100, Jan Kara wrote: > > -static inline dev_t blk_lookup_devt(const char *name, int partno) > > -{ > > - dev_t devt = MKDEV(0, 0); > > - return devt; > > -} > > #endif /* CONFIG_BLOCK */ > > This hunk looks unrelated to the change? Also why you move the

Re: [dm-devel] misc struct block_device related driver cleanups

2020-11-17 Thread Christoph Hellwig
On Tue, Nov 17, 2020 at 10:46:29AM -0500, Mike Snitzer wrote: > On Mon, Nov 16 2020 at 4:20pm -0500, > Christoph Hellwig wrote: > > > Hi Jens, Minchan and Mike, > > > > this series cleans up a few interactions of driver with struct > > block_device, in prep

[dm-devel] [PATCH 12/78] dm: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 Reviewed-by: Hannes Reinecke --- drivers/md/dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[dm-devel] [PATCH 20/78] md: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 Acked-by: Song Liu --- drivers/md/md-cluster.c | 6 ++ drivers/md/md-linear.c | 3 +-- drivers/md/md.c

[dm-devel] [PATCH 05/78] block: remove the update_bdev parameter to set_capacity_revalidate_and_notify

2020-11-17 Thread Christoph Hellwig
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 Reviewed-by: Hannes Reinecke Reviewed

[dm-devel] [PATCH 14/78] nvme: use set_capacity_and_notify in nvme_set_queue_dying

2020-11-17 Thread Christoph Hellwig
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 Reviewed-by: Hannes Reinecke --- drivers/nvme/host/core.c | 13 + 1 file changed, 1

[dm-devel] [PATCH 15/78] drbd: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 --- drivers/block/drbd/drbd_main.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers

[dm-devel] [PATCH 03/78] nvme: let set_capacity_revalidate_and_notify update the bdev size

2020-11-17 Thread Christoph Hellwig
There is no good reason to call revalidate_disk_size separately. Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- 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

[dm-devel] [PATCH 02/78] loop: let set_capacity_revalidate_and_notify update the bdev size

2020-11-17 Thread Christoph Hellwig
There is no good reason to call revalidate_disk_size separately. Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- drivers/block/loop.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a58084c2ed7ceb

[dm-devel] [PATCH 10/78] nbd: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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

[dm-devel] [PATCH 17/78] rnbd: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 Acked-by: Jack Wang --- drivers/block/rnbd/rnbd-clt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[dm-devel] [PATCH 13/78] pktcdvd: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 --- drivers/block/pktcdvd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block

[dm-devel] [PATCH 19/78] dm-raid: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 Reviewed-by: Hannes Reinecke --- drivers/md/dm-raid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[dm-devel] [PATCH 18/78] zram: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 --- drivers/block/zram/zram_drv.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers

[dm-devel] [PATCH 16/78] rbd: use set_capacity_and_notify

2020-11-17 Thread Christoph Hellwig
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 Acked-by: Ilya Dryomov --- drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[dm-devel] [PATCH 19/24] zram: use set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
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 --- drivers/block/zram/zram_drv.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers

[dm-devel] [PATCH 13/24] dm: use set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
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 --- drivers/md/dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers

[dm-devel] [PATCH 15/24] nvme: use set_capacity_and_notify in nvme_set_queue_dying

2020-11-08 Thread Christoph Hellwig
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 --- drivers/nvme/host/core.c | 13 + 1 file changed, 1 insertion(+), 12 deletions

[dm-devel] [PATCH 17/24] rbd: use set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
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 --- drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/rbd.c b

[dm-devel] [PATCH 06/24] block: add a return value to set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
Return if the function ended up sending an uevent or not. Signed-off-by: Christoph Hellwig --- 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

[dm-devel] [PATCH 20/24] dm-raid: use set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
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 --- drivers/md/dm-raid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/md/dm-raid.c b

[dm-devel] [PATCH 11/24] nbd: use set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
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

[dm-devel] [PATCH 21/24] md: use set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
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 --- drivers/md/md-cluster.c | 6 ++ drivers/md/md-linear.c | 3 +-- drivers/md/md.c | 24

[dm-devel] [PATCH 05/24] block: remove the update_bdev parameter from set_capacity_revalidate_and_notify

2020-11-08 Thread Christoph Hellwig
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 --- block/genhd.c| 13

[dm-devel] [PATCH 18/24] rnbd: use set_capacity_and_notify

2020-11-08 Thread Christoph Hellwig
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 --- drivers/block/rnbd/rnbd-clt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block

Re: [dm-devel] [PATCH 14/20] block: remove the nr_sects field in struct hd_struct

2020-11-21 Thread Christoph Hellwig
On Fri, Nov 20, 2020 at 09:05:48PM +0100, Jan Kara wrote: > The code is already switched to it AFAICT (the lock is really only used in > the two places that write i_size). But the problem is that in theory two > i_size_write() calls can race in a way that the resulting stored i_size is a > mix of

[dm-devel] [PATCH 01/24] block: remove the call to __invalidate_device in check_disk_size_change

2020-11-06 Thread Christoph Hellwig
many people use partitions, for which no invalidation was performed anyway. Signed-off-by: Christoph Hellwig --- 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

[dm-devel] [PATCH 23/24] virtio-blk: remove a spurious call to revalidate_disk_size

2020-11-06 Thread Christoph Hellwig
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 --- drivers/block/virtio_blk.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b

[dm-devel] [PATCH 04/24] sd: update the bdev size in sd_revalidate_disk

2020-11-06 Thread Christoph Hellwig
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 --- drivers/scsi/sd.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/scsi

[dm-devel] cleanup updating the size of block devices

2020-11-06 Thread Christoph Hellwig
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 +-

[dm-devel] [PATCH 07/24] nbd: remove the call to set_blocksize

2020-11-06 Thread Christoph Hellwig
Block driver have no business setting the file system concept of a block size. Signed-off-by: Christoph Hellwig --- 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

[dm-devel] [PATCH 02/24] loop: remove loop_set_size

2020-11-06 Thread Christoph Hellwig
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 --- drivers/block/loop.c | 37 +++-- 1 file changed, 7 insertions(+), 30

[dm-devel] [PATCH 08/24] nbd: move the task_recv check into nbd_size_update

2020-11-06 Thread Christoph Hellwig
nbd_size_update is about to acquire a few more callers, so lift the check into the function. Signed-off-by: Christoph Hellwig --- 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

[dm-devel] [PATCH 09/24] nbd: refactor size updates

2020-11-06 Thread Christoph Hellwig
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

[dm-devel] [PATCH 10/24] nbd: validate the block size in nbd_set_size

2020-11-06 Thread Christoph Hellwig
Move the validation of the block from the callers into nbd_set_size. Signed-off-by: Christoph Hellwig --- 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

[dm-devel] [PATCH 12/24] aoe: don't call set_capacity from irq context

2020-11-06 Thread Christoph Hellwig
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 --- drivers/block/aoe/aoecmd.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions

[dm-devel] [PATCH 24/24] block: unexport revalidate_disk_size

2020-11-06 Thread Christoph Hellwig
revalidate_disk_size is not only called from set_capacity_and_notify, so drop the export. Signed-off-by: Christoph Hellwig --- 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

[dm-devel] [PATCH 22/24] md: remove a spurious call to revalidate_disk_size in update_size

2020-11-06 Thread Christoph Hellwig
None of the ->resize methods updates the disk size, so calling revalidate_disk_size here won't do anything. Signed-off-by: Christoph Hellwig --- 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 87442dc59f6

[dm-devel] [PATCH 3/6] block: add a hard-readonly flag to struct gendisk

2021-01-09 Thread Christoph Hellwig
lla: https://bugzilla.kernel.org/show_bug.cgi?id=201221 Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Reviewed-by: Martin K. Petersen Reviewed-by: Hannes Reinecke --- block/blk-core.c| 4 +--- block/genhd.c | 33 +++-- block/partitions/c

[dm-devel] [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only

2021-01-09 Thread Christoph Hellwig
dm-thin and dm-cache also work on partitions, so use the proper interface to check if the device is read-only. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Reviewed-by: Martin K. Petersen Reviewed-by: Hannes Reinecke --- drivers/md/dm-cache-metadata.c | 2 +- drivers/md/dm-thin

[dm-devel] [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only

2021-01-09 Thread Christoph Hellwig
Only a single caller can end up in bdev_read_only, so move the check there. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Reviewed-by: Martin K. Petersen --- block/genhd.c | 3 --- fs/super.c| 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b

[dm-devel] [PATCH 5/6] rbd: remove the ->set_read_only method

2021-01-09 Thread Christoph Hellwig
Now that the hardware read-only state can't be changed by the BLKROSET ioctl, the code in this method is not required anymore. Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Acked-by: Ilya Dryomov Reviewed-by: Martin K. Petersen --- drivers/block/rbd.c | 19

[dm-devel] [PATCH 6/6] nvme: allow revalidate to set a namespace read-only

2021-01-09 Thread Christoph Hellwig
Unconditionally call set_disk_ro now that it only updates the hardware state. This allows to properly set up the Linux devices read-only when the controller turns a previously writable namespace read-only. Signed-off-by: Christoph Hellwig Reviewed-by: Keith Busch Reviewed-by: Martin K

[dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions

2021-01-09 Thread Christoph Hellwig
y letting the user think they write protected the whole disk when they actually didn't. Suggested-by: Martin K. Petersen Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/genhd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/genhd.c b/block/genh

[dm-devel] split hard read-only vs read-only policy v3 (resend)

2021-01-09 Thread Christoph Hellwig
Hi Jens, this series resurrects a patch from Martin to properly split the flag indicating a disk has been set read-only by the hardware vs the userspace policy set through the BLKROSET ioctl. Note that the last patch only applies to for-next and not to for-5.11/block. I can hold it back for the

Re: [dm-devel] dm: avoid filesystem lookup in dm_get_dev_t()

2021-01-21 Thread Christoph Hellwig
On Thu, Jan 21, 2021 at 11:09:33AM -0500, Mike Snitzer wrote: > > Mike, do you need anything more to apply this one? Do you want a > > cleaned-up resend? > > It got hung up with Christoph correctly requesting more discussion, last > linux-block/lkml mail on the associated thread I kicked off is

Re: [dm-devel] [PATCH 05/10] block: do not reassig ->bi_bdev when partition remapping

2021-01-25 Thread Christoph Hellwig
On Mon, Jan 25, 2021 at 10:53:36AM -0700, Jens Axboe wrote: > On Sun, Jan 24, 2021 at 3:05 AM Christoph Hellwig wrote: > > > > There is no good reason to reassign ->bi_bdev when remapping the > > partition-relative block number to the device wide one, as all the

Re: [dm-devel] [PATCH 05/10] block: do not reassig ->bi_bdev when partition remapping

2021-01-25 Thread Christoph Hellwig
On Mon, Jan 25, 2021 at 11:19:23AM -0700, Jens Axboe wrote: > On 1/25/21 11:18 AM, Christoph Hellwig wrote: > > On Mon, Jan 25, 2021 at 11:15:04AM -0700, Jens Axboe wrote: > >> On 1/25/21 11:13 AM, Christoph Hellwig wrote: > >>> On Mon, Jan 25, 2021 at 11:0

Re: [dm-devel] [PATCH 05/10] block: do not reassig ->bi_bdev when partition remapping

2021-01-25 Thread Christoph Hellwig
On Mon, Jan 25, 2021 at 11:03:24AM -0700, Jens Axboe wrote: > Partition table entries are not in disk order. And the issue shows up with the series just up to the this patch, without any later patches? -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 05/10] block: do not reassig ->bi_bdev when partition remapping

2021-01-25 Thread Christoph Hellwig
On Mon, Jan 25, 2021 at 11:15:04AM -0700, Jens Axboe wrote: > On 1/25/21 11:13 AM, Christoph Hellwig wrote: > > On Mon, Jan 25, 2021 at 11:03:24AM -0700, Jens Axboe wrote: > >> Partition table entries are not in disk order. > > > > And the issue shows up with the se

Re: [dm-devel] [PATCH v2] dm: avoid filesystem lookup in dm_get_dev_t()

2021-01-21 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig Mike, Jens - can we make sure this goes in before branching off the block branch for 5.12? I have some work pending that would otherwise conflict. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

[dm-devel] [PATCH 07/10] blk-mq: use ->bi_bdev for I/O accounting

2021-01-24 Thread Christoph Hellwig
Remove the reverse map from a sector to a partition for I/O accounting by simply using ->bi_bdev. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- block/blk-core.c | 6 +- block/blk.h | 2 -- block/genhd.c| 48 3 fi

[dm-devel] [PATCH 02/10] dcssblk: remove the end of device check in dcssblk_submit_bio

2021-01-24 Thread Christoph Hellwig
The block layer already checks for this conditions in bio_check_eod before calling the driver. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- drivers/s390/block/dcssblk.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block

[dm-devel] [PATCH 05/10] block: do not reassig ->bi_bdev when partition remapping

2021-01-24 Thread Christoph Hellwig
ay I/O accounting. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- block/blk-core.c | 5 +++-- include/linux/bio.h | 2 ++ include/linux/blk_types.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 64f69022

[dm-devel] [PATCH 03/10] block: store a block_device pointer in struct bio

2021-01-24 Thread Christoph Hellwig
Replace the gendisk pointer in struct bio with a pointer to the newly improved struct block device. From that the gendisk can be trivially accessed with an extra indirection, but it also allows to directly look up all information related to partition remapping. Signed-off-by: Christoph Hellwig

[dm-devel] [PATCH 01/10] brd: remove the end of device check in brd_do_bvec

2021-01-24 Thread Christoph Hellwig
The block layer already checks for this conditions in bio_check_eod before calling the driver. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- drivers/block/brd.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index

[dm-devel] [PATCH 06/10] block: use ->bi_bdev for bio based I/O accounting

2021-01-24 Thread Christoph Hellwig
I/O to a different device, or bio_end_io_acct_remapped if the driver did remap the I/O. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- block/blk-core.c| 23 +-- drivers/md/bcache/request.c | 34 +- drivers/md/md.c |

[dm-devel] [PATCH 08/10] block: add a disk_uevent helper

2021-01-24 Thread Christoph Hellwig
Add a helper to call kobject_uevent for the disk and all partitions, and unexport the disk_part_iter_* helpers that are now only used in the core block code. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- block/genhd.c | 27 ++- drivers/s390/block

[dm-devel] [PATCH 09/10] block: remove DISK_PITER_REVERSE

2021-01-24 Thread Christoph Hellwig
There is good reason to iterate backwards when deleting all partitions in del_gendisk, just like we don't in blk_drop_partitions. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- block/genhd.c | 37 +++-- include/linux/genhd.h | 1 - 2 files

[dm-devel] [PATCH 04/10] block: simplify submit_bio_checks a bit

2021-01-24 Thread Christoph Hellwig
Merge a few checks for whole devices vs partitions to streamline the sanity checks. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- block/blk-core.c | 39 ++- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/block/blk-core.c b/block

[dm-devel] store a pointer to the block_device in struct bio (again) v2

2021-01-24 Thread Christoph Hellwig
Hi Jens, this series switches back from storing the gendisk + partno to storing a block_device pointer in struct bio. The reason is two fold: for one the new struct block_device actually is always available, removing the need to avoid originally. Second the merge struct block_device is much

[dm-devel] [PATCH 10/10] block: use an xarray for disk->part_tbl

2021-01-24 Thread Christoph Hellwig
Now that no fast path lookups in the partition table are left, there is no point in micro-optimizing the data structure for it. Just use a bog standard xarray. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- block/blk-settings.c| 2 +- block/blk.h | 1 - block

Re: [dm-devel] [PATCH 04/17] block: split bio_kmalloc from bio_alloc_bioset

2021-02-01 Thread Christoph Hellwig
On Sat, Jan 30, 2021 at 03:56:46AM +, Matthew Wilcox wrote: > On Tue, Jan 26, 2021 at 03:52:34PM +0100, Christoph Hellwig wrote: > > bio_kmalloc shares almost no logic with the bio_set based fast path > > in bio_alloc_bioset. Split it into an entirely separate implementation.

[dm-devel] [PATCH 12/17] md: simplify sync_page_io

2021-01-26 Thread Christoph Hellwig
Use an on-stack bio and biovec for the single page synchronous I/O. Signed-off-by: Christoph Hellwig --- drivers/md/md.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index e2b9dbb6e888f6..6a27f52007c871 100644

[dm-devel] [PATCH 04/17] block: split bio_kmalloc from bio_alloc_bioset

2021-01-26 Thread Christoph Hellwig
bio_kmalloc shares almost no logic with the bio_set based fast path in bio_alloc_bioset. Split it into an entirely separate implementation. Signed-off-by: Christoph Hellwig --- block/bio.c | 167 ++-- include/linux/bio.h | 6 +- 2 files changed

[dm-devel] [PATCH 08/17] f2fs: remove FAULT_ALLOC_BIO

2021-01-26 Thread Christoph Hellwig
Sleeping bio allocations do not fail, which means that injecting an error into sleeping bio allocations is a little silly. Signed-off-by: Christoph Hellwig --- Documentation/filesystems/f2fs.rst | 1 - fs/f2fs/data.c | 29 - fs/f2fs/f2fs.h

[dm-devel] [PATCH 07/17] f2fs: use blkdev_issue_flush in __submit_flush_wait

2021-01-26 Thread Christoph Hellwig
Use the blkdev_issue_flush helper instead of duplicating it. Signed-off-by: Christoph Hellwig --- fs/f2fs/data.c| 3 ++- fs/f2fs/f2fs.h| 1 - fs/f2fs/segment.c | 12 +--- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index

[dm-devel] [PATCH 17/17] mm: remove get_swap_bio

2021-01-26 Thread Christoph Hellwig
Just reuse the block_device and sector from the swap_info structure, just as used by the SWP_SYNCHRONOUS path. Also remove the checks for NULL returns from bio_alloc as that can't happen for sleeping allocations. Signed-off-by: Christoph Hellwig --- include/linux/swap.h | 1 - mm/page_io.c

[dm-devel] [PATCH 01/17] zonefs: use bio_alloc in zonefs_file_dio_append

2021-01-26 Thread Christoph Hellwig
Use bio_alloc instead of open coding it. Signed-off-by: Christoph Hellwig --- fs/zonefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index bec47f2d074beb..faea2ed34b4a37 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c

[dm-devel] [PATCH 02/17] btrfs: use bio_kmalloc in __alloc_device

2021-01-26 Thread Christoph Hellwig
Use bio_kmalloc instead of open coding it. Signed-off-by: Christoph Hellwig --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0a6de859eb2226..584ba093cf4966 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs

[dm-devel] [PATCH 03/17] blk-crypto: use bio_kmalloc in blk_crypto_clone_bio

2021-01-26 Thread Christoph Hellwig
Use bio_kmalloc instead of open coding it. Signed-off-by: Christoph Hellwig --- block/blk-crypto-fallback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c index 50c225398e4d60..e8327c50d7c9f4 100644 --- a/block/blk

[dm-devel] misc bio allocation cleanups

2021-01-26 Thread Christoph Hellwig
Hi Jens, this series contains various cleanups for how bios are allocated or initialized plus related fallout. Diffstat: Documentation/filesystems/f2fs.rst |1 block/bio.c| 167 ++--- block/blk-crypto-fallback.c|2

[dm-devel] [PATCH 09/17] drbd: remove bio_alloc_drbd

2021-01-26 Thread Christoph Hellwig
Given that drbd_md_io_bio_set is initialized during module initialization and the module fails to load if the initialization fails there is no need to fall back to plain bio_alloc. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_actlog.c | 2 +- drivers/block/drbd/drbd_bitmap.c

[dm-devel] [PATCH 14/17] md/raid6: refactor raid5_read_one_chunk

2021-01-26 Thread Christoph Hellwig
Refactor raid5_read_one_chunk so that all simple checks are done before allocating the bio. Signed-off-by: Christoph Hellwig --- drivers/md/raid5.c | 108 +++-- 1 file changed, 45 insertions(+), 63 deletions(-) diff --git a/drivers/md/raid5.c b/drivers

[dm-devel] [PATCH 13/17] md: remove md_bio_alloc_sync

2021-01-26 Thread Christoph Hellwig
md_bio_alloc_sync is never called with a NULL mddev, and ->sync_set is initialized in md_run, so it always must be initialized as well. Just open code the remaining call to bio_alloc_bioset. Signed-off-by: Christoph Hellwig --- drivers/md/md.c | 10 +- 1 file changed, 1 insertion(+)

[dm-devel] [PATCH 16/17] nilfs2: remove cruft in nilfs_alloc_seg_bio

2021-01-26 Thread Christoph Hellwig
bio_alloc never returns NULL when it can sleep. Signed-off-by: Christoph Hellwig --- fs/nilfs2/segbuf.c | 4 1 file changed, 4 deletions(-) diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 1a8729eded8b14..1e75417bfe6e52 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c

[dm-devel] [PATCH 15/17] nfs/blocklayout: remove cruft in bl_alloc_init_bio

2021-01-26 Thread Christoph Hellwig
bio_alloc never returns NULL when it can sleep. Signed-off-by: Christoph Hellwig --- fs/nfs/blocklayout/blocklayout.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 3be6836074ae92..1a96ce28efb026 100644 --- a/fs

[dm-devel] [PATCH 05/17] block: use an on-stack bio in blkdev_issue_flush

2021-01-26 Thread Christoph Hellwig
There is no point in allocating memory for a synchronous flush. Signed-off-by: Christoph Hellwig --- block/blk-flush.c | 17 ++--- drivers/md/dm-zoned-metadata.c| 6 +++--- drivers/md/raid5-ppl.c| 2 +- drivers/nvme/target/io-cmd-bdev.c | 2 +- fs

[dm-devel] [PATCH 06/17] dm-clone: use blkdev_issue_flush in commit_metadata

2021-01-26 Thread Christoph Hellwig
Use blkdev_issue_flush instead of open coding it. Signed-off-by: Christoph Hellwig --- drivers/md/dm-clone-target.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/md/dm-clone-target.c b/drivers/md/dm-clone-target.c index bdb255edc20043..a90bdf9b2ca6bd

[dm-devel] [PATCH 11/17] md: remove bio_alloc_mddev

2021-01-26 Thread Christoph Hellwig
bio_alloc_mddev is never called with a NULL mddev, and ->bio_set is initialized in md_run, so it always must be initialized as well. Just open code the remaining call to bio_alloc_bioset. Signed-off-by: Christoph Hellwig --- drivers/md/md.c | 12 +--- drivers/md/md.h |

Re: [dm-devel] [PATCH v2 3/6] block: add iopoll method to support bio-based IO polling

2021-01-28 Thread Christoph Hellwig
On Mon, Jan 25, 2021 at 08:13:37PM +0800, Jeffle Xu wrote: > +int blk_poll(struct request_queue *q, blk_qc_t cookie, bool spin) Can you split the guts of this function into two separate helpers for the mq vs non-mq case? As is is is a little hard to read and introduced extra branches in the fast

<    8   9   10   11   12   13   14   15   16   17   >