[dm-devel] [PATCH 18/44] init: cleanup match_dev_by_uuid and match_dev_by_label

2020-11-26 Thread Christoph Hellwig
Avoid a totally pointless goto label, and use the same style of comparism for both helpers. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn Acked-by: Tejun Heo --- init/do_mounts.c | 18 ++ 1 file changed

[dm-devel] merge struct block_device and struct hd_struct v3

2020-11-26 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 16/44] init: refactor name_to_dev_t

2020-11-26 Thread Christoph Hellwig
Split each case into a self-contained helper, and move the block dependent code entirely under the pre-existing #ifdef CONFIG_BLOCK. This allows to remove the blk_lookup_devt stub in genhd.h. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed

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

2020-11-26 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Acked-by: Tejun Heo --- fs/block_dev.c | 26

[dm-devel] [PATCH 17/44] init: refactor devt_from_partuuid

2020-11-26 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Acked-by: Tejun Heo --- init/do_mounts.c | 68

[dm-devel] [PATCH 19/44] block: refactor __blkdev_put

2020-11-26 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Acked-by: Tejun Heo --- fs/block_dev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

[dm-devel] [PATCH 11/44] block: remove a superflous check in blkpg_do_ioctl

2020-11-26 Thread Christoph Hellwig
sector_t is now always a u64, so this check is not needed. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo Reviewed-by: Jan Kara --- block/ioctl.c | 9 - 1 file changed, 9 deletions(-) diff --git a/block/ioctl.c b/block/ioctl.c index 6b785181344fe1..0c09bb7a6ff35f 100644

[dm-devel] [PATCH 10/44] block: remove a duplicate __disk_get_part prototype

2020-11-26 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo Reviewed-by: Jan Kara Reviewed-by: Greg Kroah-Hartman Reviewed-by: Johannes Thumshirn --- include/linux/genhd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 46553d6d602563

[dm-devel] [PATCH 34/44] block: move make_it_fail to struct block_device

2020-11-26 Thread Christoph Hellwig
Move the make_it_fail flag to struct block_device an turn it into a bool in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 3 ++- block/genhd.c | 4 ++-- include/linux/blk_types.h | 3 +++ include/linux/genhd.h | 3

[dm-devel] [PATCH 27/44] block: simplify part_to_disk

2020-11-26 Thread Christoph Hellwig
Now that struct hd_struct has a block_device pointer use that to find the disk. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo --- include/linux/genhd.h | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index

[dm-devel] [PATCH 37/44] block: switch partition lookup to use struct block_device

2020-11-26 Thread Christoph Hellwig
Use struct block_device to lookup partitions on a disk. This removes all usage of struct hd_struct from the I/O path, and this allows removing the percpu refcount in struct hd_struct. Signed-off-by: Christoph Hellwig Acked-by: Coly Li [bcache] Acked-by: Chao Yu

[dm-devel] [PATCH 40/44] block: pass a block_device to invalidate_partition

2020-11-26 Thread Christoph Hellwig
Pass the block_device actually needed instead of looking it up using bdget_disk. Signed-off-by: Christoph Hellwig --- block/genhd.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 89cd0ba8e3b84a..28299b24173be1 100644

[dm-devel] [PATCH 31/44] block: move the start_sect field to struct block_device

2020-11-26 Thread Christoph Hellwig
Move the start_sect field to struct block_device in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 5 +++-- block/blk-lib.c | 2 +- block/genhd.c | 4 ++-- block/partitions/core.c | 17

[dm-devel] [PATCH 35/44] block: move the policy field to struct block_device

2020-11-26 Thread Christoph Hellwig
Move the policy field to struct block_device and rename it to the more descriptive bd_read_only. Also turn the field into a bool as it is used as such. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 2 +- block/genhd.c | 8 block/ioctl.c | 2

[dm-devel] [PATCH 23/44] block: remove i_bdev

2020-11-26 Thread Christoph Hellwig
of struct block_device to keep the lookups contained in the core block layer code. Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo Acked-by: Coly Li [bcache] --- block/ioctl.c| 3 +- drivers/block/loop.c | 8 +- drivers

[dm-devel] [PATCH 26/44] block: simplify the block device claiming interface

2020-11-26 Thread Christoph Hellwig
Stop passing the whole device as a separate argument given that it can be trivially deducted and cleanup the !holder debug check. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Acked-by: Tejun Heo --- drivers/block/loop.c | 12 +- fs

[dm-devel] [PATCH 41/44] block: switch disk_part_iter_* to use a struct block_device

2020-11-26 Thread Christoph Hellwig
Switch the partition iter infrastructure to iterate over block_device references instead of hd_struct ones mostly used to get at the block_device. Signed-off-by: Christoph Hellwig --- block/genhd.c | 57 +++ block/partitions/core.c | 13

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

2020-11-26 Thread Christoph Hellwig
gets fixed. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Acked-by: Coly Li [bcache] Acked-by: Chao Yu [f2fs] --- block/bio.c| 4 +- block/blk-core.c | 2 +- block/blk.h

[dm-devel] [PATCH 39/44] block: pass a block_device to blk_alloc_devt

2020-11-26 Thread Christoph Hellwig
Pass the block_device actually needed instead of the hd_struct. Signed-off-by: Christoph Hellwig --- block/blk.h | 2 +- block/genhd.c | 14 +++--- block/partitions/core.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/block/blk.h b/block

[dm-devel] [PATCH 24/44] block: simplify bdev/disk lookup in blkdev_get

2020-11-26 Thread Christoph Hellwig
now cause a call to request_module. That call is harmless, and in practice no recent system will access these nodes as they aren't created by udev and static /dev/ setups are unusual. Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c | 42 block/blk-iocost.c | 36

[dm-devel] [PATCH 06/44] zram: do not call set_blocksize

2020-11-26 Thread Christoph Hellwig
set_blocksize is used by file systems to use their preferred buffer cache block size. Block drivers should not set it. Signed-off-by: Christoph Hellwig Acked-by: Minchan Kim --- drivers/block/zram/zram_drv.c | 11 +-- drivers/block/zram/zram_drv.h | 1 - 2 files changed, 1 insertion

[dm-devel] [PATCH 05/44] mtip32xx: remove the call to fsync_bdev on removal

2020-11-26 Thread Christoph Hellwig
del_gendisk already calls fsync_bdev for every partition, no need to do this twice. Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara --- drivers/block/mtip32xx/mtip32xx.c | 15 --- drivers/block/mtip32xx/mtip32xx.h | 2 -- 2 files changed, 17 deletions(-) diff --git

[dm-devel] [PATCH 36/44] block: allocate struct hd_struct as part of struct bdev_inode

2020-11-26 Thread Christoph Hellwig
. The lifetime of struct gendisk is still controlled by the struct device embedded in the part0 hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 16 --- block/blk-flush.c | 2 +- block/blk-merge.c | 2 - block/blk.h

[dm-devel] [PATCH 09/44] dm: remove the block_device reference in struct mapped_device

2020-11-26 Thread Christoph Hellwig
Get rid of the long-lasting struct block_device reference in struct mapped_device. The only remaining user is the freeze code, where we can trivially look up the block device at freeze time and release the reference at thaw time. Signed-off-by: Christoph Hellwig Acked-by: Mike Snitzer

[dm-devel] [PATCH 04/44] fs: simplify freeze_bdev/thaw_bdev

2020-11-26 Thread Christoph Hellwig
Store the frozen superblock in struct block_device to avoid the awkward interface that can return a sb only used a cookie, an ERR_PTR or NULL. Signed-off-by: Christoph Hellwig Acked-by: Chao Yu [f2fs] --- drivers/md/dm-core.h | 5 - drivers/md/dm.c | 20

[dm-devel] [PATCH 30/44] block: move disk stat accounting to struct block_device

2020-11-26 Thread Christoph Hellwig
Move the dkstats and stamp field to struct block_device in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c| 2 +- block/blk-core.c | 4 ++-- block/blk.h | 1 - block/genhd.c | 14 -- block

[dm-devel] [PATCH 08/44] dm: simplify flush_bio initialization in __send_empty_flush

2020-11-26 Thread Christoph Hellwig
We don't really need the struct block_device to initialize a bio. So switch from using bio_set_dev to manually setting up bi_disk (bi_partno will always be zero and has been cleared by bio_init already). Signed-off-by: Christoph Hellwig Acked-by: Mike Snitzer --- drivers/md/dm.c | 12

[dm-devel] [PATCH 14/44] block: use put_device in put_disk

2020-11-26 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn Acked-by: Tejun Heo --- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1

[dm-devel] [PATCH 33/44] block: move holder_dir to struct block_device

2020-11-26 Thread Christoph Hellwig
Move the holder_dir field to struct block_device in preparation for kill struct hd_struct. Signed-off-by: Christoph Hellwig --- block/genhd.c | 5 +++-- block/partitions/core.c | 8 fs/block_dev.c| 11 +-- include/linux/blk_types.h | 1 + include

[dm-devel] [PATCH 13/44] block: use disk_part_iter_exit in disk_part_iter_next

2020-11-26 Thread Christoph Hellwig
Call disk_part_iter_exit in disk_part_iter_next instead of duplicating the functionality. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn Acked-by: Tejun Heo --- block/genhd.c | 3 +-- 1 file changed, 1 insertion(+), 2

[dm-devel] [PATCH 25/44] block: remove ->bd_contains

2020-11-26 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara

[dm-devel] [PATCH 21/44] block: move bdput() to the callers of __blkdev_get

2020-11-26 Thread Christoph Hellwig
This will allow for a more symmetric calling convention going forward. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 86a61a2141f642..d0783c55a0ce65 100644 --- a/fs/block_dev.c

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

2020-11-26 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumsh

Re: [dm-devel] [PATCH 24/44] block: simplify bdev/disk lookup in blkdev_get

2020-11-26 Thread Christoph Hellwig
On Thu, Nov 26, 2020 at 05:33:41PM +0100, Jan Kara wrote: > > bdev->bd_contains = whole; > > - bdev->bd_part = disk_get_part(disk, partno); > > - if (!(disk->flags & GENHD_FL_UP) || > > - !bdev->bd_part ||

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

2020-11-26 Thread Christoph Hellwig
On Thu, Nov 26, 2020 at 05:50:36PM +0100, Jan Kara wrote: > > + if (size == capacity || > > + (disk->flags & (GENHD_FL_UP | GENHD_FL_HIDDEN)) != GENHD_FL_UP) > > + return false; > > + pr_info("%s: detected capacity change from %lld to %lld\n", > > + disk->disk_name,

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

2020-12-07 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 --- drivers/block/rbd.c | 19 --- 1 file changed, 19 deletions(-) diff --git a/drivers

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

2020-12-07 Thread Christoph Hellwig
whole-disk device policy. The current behavior violates the principle of least surprise by 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 --- block/genhd.c | 3 +-- 1 file changed, 1

[dm-devel] split hard read-only vs read-only policy v2

2020-12-07 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

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

2020-12-07 Thread Christoph Hellwig
Only a single caller can end up in bdev_read_only, so move the check there. Signed-off-by: Christoph Hellwig --- block/genhd.c | 3 --- fs/super.c| 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 09ff6cef028729..c87013879b8650 100644

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

2020-12-07 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 --- drivers/nvme/host/core.c | 5 ++--- 1 file changed

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

2020-12-07 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: Hannes Reinecke --- drivers/md/dm-cache-metadata.c | 2 +- drivers/md/dm-thin-metadata.c | 2 +- 2 files changed, 2 insertions(+), 2

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

2020-12-07 Thread Christoph Hellwig
lla: https://bugzilla.kernel.org/show_bug.cgi?id=201221 Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- block/blk-core.c| 2 +- block/genhd.c | 33 +++-- block/partitions/core.c | 3 +-- include/linux/genhd.h | 6 -- 4 files c

Re: [dm-devel] [RFC PATCH v2 0/2] add simple copy support

2020-12-07 Thread Christoph Hellwig
So, I'm really worried about: a) a good use case. GC in f2fs or btrfs seem like good use cases, as does accelating dm-kcopyd. I agree with Damien that lifting dm-kcopyd to common code would also be really nice. I'm not 100% sure it should be a requirement, but it sure would be

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

2020-12-07 Thread Christoph Hellwig
Thanks for the report. Jens, can you revert the series for now? I think waiting any longer with a report like this is not helpful. I'll look into it with Qian in the meantime. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

[dm-devel] [PATCH 1/5] block: remove the unused block_sleeprq tracepoint

2020-12-03 Thread Christoph Hellwig
The block_sleeprq tracepoint was only used by the legacy request code. Remove it now that the legacy request code is gone. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- include/trace/events/block.h | 18 -- kernel/trace

[dm-devel] [PATCH 2/5] block: simplify and extend the block_bio_merge tracepoint class

2020-12-03 Thread Christoph Hellwig
The block_bio_merge tracepoint class can be reused for most bio-based tracepoints. For that it just needs to lose the superfluous q and rq parameters. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- block/blk-core.c | 2 +- block

[dm-devel] [PATCH 4/5] block: remove the request_queue argument to the block_bio_remap tracepoint

2020-12-03 Thread Christoph Hellwig
The request_queue can trivially be derived from the bio. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- block/blk-core.c | 2 +- drivers/md/dm.c | 3 +-- drivers/md/md-linear.c| 3 +-- drivers/md/md.c

[dm-devel] [PATCH 5/5] block: remove the request_queue to argument request based tracepoints

2020-12-03 Thread Christoph Hellwig
The request_queue can trivially be derived from the request. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- block/blk-merge.c| 2 +- block/blk-mq-sched.c | 2 +- block/blk-mq.c | 8 +++ drivers/md/dm-rq.c

[dm-devel] block tracepoint cleanups v2

2020-12-03 Thread Christoph Hellwig
Hi Jens, this series cleans up the block layer tracepoints by removing unused tracepoints or tracepoint arguments and consolidating the implementation of various bio based tracepoints. Changes since v1: - a few commit log typo fixes and improvements Diffstat: block/blk-core.c |

[dm-devel] [PATCH 3/5] block: remove the request_queue argument to the block_split tracepoint

2020-12-03 Thread Christoph Hellwig
The request_queue can trivially be derived from the bio. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- block/blk-merge.c| 2 +- drivers/md/dm.c | 2 +- include/trace/events/block.h | 14 ++ kernel/trace

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

2020-12-08 Thread Christoph Hellwig
: > On Tue, 2020-12-01 at 17:54 +0100, Christoph Hellwig wrote: > > 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 actua

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

2020-12-08 Thread Christoph Hellwig
On Tue, Dec 08, 2020 at 12:27:41AM -0500, Martin K. Petersen wrote: > > Christoph, > > > The existing behavior is inconsistent in the sense that doing: > > > > permits writes. But: > > > > > > > > doesn't. > > > > And a subsequent: > > Looks like the command line pieces got zapped from the

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

2020-12-08 Thread Christoph Hellwig
On Tue, Dec 08, 2020 at 06:29:23PM +0800, Ming Lei wrote: > > - test_bit(GD_READ_ONLY, >bd_disk->state); > > + return bdev->bd_read_only || get_disk_ro(bdev->bd_disk); > > } > > EXPORT_SYMBOL(bdev_read_only); > > I think this patch should be folded into previous one, otherwise >

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

2020-12-08 Thread Christoph Hellwig
On Tue, Dec 08, 2020 at 06:22:11PM +0800, Ming Lei wrote: > > int bdev_read_only(struct block_device *bdev) > > { > > - return bdev->bd_read_only; > > + return bdev->bd_read_only || > > + test_bit(GD_READ_ONLY, >bd_disk->state); > > } > > EXPORT_SYMBOL(bdev_read_only); > > Maybe

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

2020-12-08 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 1/6] dm: use bdev_read_only to check if a device is read-only

2020-12-08 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] split hard read-only vs read-only policy v3

2020-12-08 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

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

2020-12-08 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

2020-12-08 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

2020-12-08 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] [PATCH 3/6] block: add a hard-readonly flag to struct gendisk

2020-12-08 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 12/45] block: remove a superflous check in blkpg_do_ioctl

2020-11-24 Thread Christoph Hellwig
sector_t is now always a u64, so this check is not needed. Signed-off-by: Christoph Hellwig --- block/ioctl.c | 9 - 1 file changed, 9 deletions(-) diff --git a/block/ioctl.c b/block/ioctl.c index 6b785181344fe1..0c09bb7a6ff35f 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -35,15

[dm-devel] [PATCH 11/45] block: remove a duplicate __disk_get_part prototype

2020-11-24 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- include/linux/genhd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 46553d6d602563..22f5b9fd96f8bf 100644

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

2020-11-24 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- fs/block_dev.c | 26 ++ 1

[dm-devel] [PATCH 24/45] blk-cgroup: stop abusing get_gendisk

2020-11-24 Thread Christoph Hellwig
media. Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c | 42 +++--- block/blk-iocost.c | 36 include/linux/blk-cgroup.h | 4 ++-- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/block/blk

[dm-devel] [PATCH 15/45] block: use put_device in put_disk

2020-11-24 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[dm-devel] [PATCH 28/45] block: simplify part_to_disk

2020-11-24 Thread Christoph Hellwig
Now that struct hd_struct has a block_device pointer use that to find the disk. Signed-off-by: Christoph Hellwig --- include/linux/genhd.h | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index d068e46f9086ae

[dm-devel] [PATCH 38/45] block: switch partition lookup to use struct block_device

2020-11-24 Thread Christoph Hellwig
Use struct block_device to lookup partitions on a disk. This removes all usage of struct hd_struct from the I/O path, and this allows removing the percpu refcount in struct hd_struct. Signed-off-by: Christoph Hellwig --- block/bio.c| 4 +- block/blk-core.c

[dm-devel] [PATCH 40/45] block: pass a block_device to blk_alloc_devt

2020-11-24 Thread Christoph Hellwig
Pass the block_device actually needed instead of the hd_struct. Signed-off-by: Christoph Hellwig --- block/blk.h | 2 +- block/genhd.c | 14 +++--- block/partitions/core.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/block/blk.h b/block

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

2020-11-24 Thread Christoph Hellwig
We can just dereference the point in struct gendisk instead. Also remove the now unused export. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- block/genhd.c | 1 - drivers/block/nbd.c | 4 +--- drivers/block/xen

[dm-devel] [PATCH 36/45] block: move the policy field to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the policy field to struct block_device and rename it to the more descriptive bd_read_only. Also turn the field into a bool as it is used as such. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 2 +- block/genhd.c | 8 block/ioctl.c | 2

[dm-devel] [PATCH 31/45] block: move disk stat accounting to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the dkstats and stamp field to struct block_device in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c| 2 +- block/blk-core.c | 4 ++-- block/blk.h | 1 - block/genhd.c | 14 -- block

[dm-devel] [PATCH 41/45] block: pass a block_device to invalidate_partition

2020-11-24 Thread Christoph Hellwig
Pass the block_device actually needed instead of looking it up using bdget_disk. Signed-off-by: Christoph Hellwig --- block/genhd.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 498c816e90df64..2985740eab084b 100644

[dm-devel] [PATCH 37/45] block: allocate struct hd_struct as part of struct bdev_inode

2020-11-24 Thread Christoph Hellwig
. The lifetime of struct gendisk is still controlled by the struct device embedded in the part0 hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 16 --- block/blk-flush.c | 2 +- block/blk-merge.c | 2 - block/blk.h

[dm-devel] [PATCH 44/45] block: merge struct block_device and struct hd_struct

2020-11-24 Thread Christoph Hellwig
, with the device model reference front ending it for device model interaction. The percpu refcount in struct hd_struct is entirely gone given that struct block_device must be opened and thus valid for the duration of the I/O. Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c| 9 ++- block

[dm-devel] [PATCH 23/45] block: remove i_bdev

2020-11-24 Thread Christoph Hellwig
of struct block_device to keep the lookups contained in the core block layer code. Signed-off-by: Christoph Hellwig --- block/ioctl.c| 3 +- drivers/block/loop.c | 8 +- drivers/md/bcache/super.c| 20 +- drivers/md/dm

[dm-devel] [PATCH 02/45] filemap: consistently use ->f_mapping over ->i_mapping

2020-11-24 Thread Christoph Hellwig
Use file->f_mapping in all remaining places that have a struct file available to properly handle the case where inode->i_mapping != file_inode(file)->i_mapping. Signed-off-by: Christoph Hellwig --- mm/filemap.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff -

[dm-devel] [PATCH 03/45] fs: remove get_super_thawed and get_super_exclusive_thawed

2020-11-24 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 06/45] zram: remove the claim mechanism

2020-11-24 Thread Christoph Hellwig
on a block device that is not open. Signed-off-by: Christoph Hellwig --- drivers/block/zram/zram_drv.c | 72 --- 1 file changed, 15 insertions(+), 57 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 6d15d51cee2b7e

[dm-devel] [PATCH 21/45] block: refactor blkdev_get

2020-11-24 Thread Christoph Hellwig
, similar to what we do with normal file operations. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 185 +++-- 1 file changed, 86 insertions(+), 99 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 88847839ef0102..2ffa11a95f10db 100644

[dm-devel] [PATCH 27/45] block: simplify the block device claiming interface

2020-11-24 Thread Christoph Hellwig
Stop passing the whole device as a separate argument given that it can be trivially deducted and cleanup the !holder debug check. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- drivers/block/loop.c | 12 +- fs/block_dev.c | 51

[dm-devel] [PATCH 14/45] block: use disk_part_iter_exit in disk_part_iter_next

2020-11-24 Thread Christoph Hellwig
Call disk_part_iter_exit in disk_part_iter_next instead of duplicating the functionality. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- block/genhd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[dm-devel] merge struct block_device and struct hd_struct v2

2020-11-24 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 01/45] blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats

2020-11-24 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn Acked-by: Tejun Heo ---

[dm-devel] [PATCH 10/45] dm: remove the block_device reference in struct mapped_device

2020-11-24 Thread Christoph Hellwig
Get rid of the long-lasting struct block_device reference in struct mapped_device. The only remaining user is the freeze code, where we can trivially look up the block device at freeze time and release the reference at thaw time. Signed-off-by: Christoph Hellwig Acked-by: Mike Snitzer

[dm-devel] [PATCH 17/45] init: refactor name_to_dev_t

2020-11-24 Thread Christoph Hellwig
Split each case into a self-contained helper, and move the block dependent code entirely under the pre-existing #ifdef CONFIG_BLOCK. This allows to remove the blk_lookup_devt stub in genhd.h. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed

[dm-devel] [PATCH 13/45] block: add a bdev_kobj helper

2020-11-24 Thread Christoph Hellwig
Add a little helper to find the kobject for a struct block_device. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- drivers/md/bcache/super.c | 7 ++- drivers/md/md.c | 4 +--- fs/block_dev.c

[dm-devel] [PATCH 04/45] fs: simplify freeze_bdev/thaw_bdev

2020-11-24 Thread Christoph Hellwig
Store the frozen superblock in struct block_device to avoid the awkward interface that can return a sb only used a cookie, an ERR_PTR or NULL. Signed-off-by: Christoph Hellwig --- drivers/md/dm-core.h | 5 - drivers/md/dm.c | 20 ++-- fs/block_dev.c

[dm-devel] [PATCH 09/45] dm: simplify flush_bio initialization in __send_empty_flush

2020-11-24 Thread Christoph Hellwig
We don't really need the struct block_device to initialize a bio. So switch from using bio_set_dev to manually setting up bi_disk (bi_partno will always be zero and has been cleared by bio_init already). Signed-off-by: Christoph Hellwig Acked-by: Mike Snitzer --- drivers/md/dm.c | 12

[dm-devel] [PATCH 26/45] block: remove ->bd_contains

2020-11-24 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara

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

2020-11-24 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- fs/block_dev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs

[dm-devel] [PATCH 18/45] init: refactor devt_from_partuuid

2020-11-24 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 Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- init/do_mounts.c | 68 ++-- 1 file changed

[dm-devel] [PATCH 19/45] init: cleanup match_dev_by_uuid and match_dev_by_label

2020-11-24 Thread Christoph Hellwig
Avoid a totally pointless goto label, and use the same style of comparism for both helpers. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- init/do_mounts.c | 18 ++ 1 file changed, 6 insertions(+), 12

[dm-devel] [PATCH 22/45] block: opencode devcgroup_inode_permission

2020-11-24 Thread Christoph Hellwig
Just call devcgroup_check_permission to avoid various superflous checks and a double conversion of the access flags. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index

[dm-devel] [PATCH 05/45] mtip32xx: remove the call to fsync_bdev on removal

2020-11-24 Thread Christoph Hellwig
del_gendisk already calls fsync_bdev for every partition, no need to do this twice. Signed-off-by: Christoph Hellwig --- drivers/block/mtip32xx/mtip32xx.c | 15 --- drivers/block/mtip32xx/mtip32xx.h | 2 -- 2 files changed, 17 deletions(-) diff --git a/drivers/block/mtip32xx

[dm-devel] [PATCH 33/45] block: move the partition_meta_info to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the partition_meta_info to struct block_device in preparation for killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk.h | 1 - block/genhd.c | 3 ++- block/partitions/core.c | 18 +++--- fs/block_dev.c| 1

[dm-devel] [PATCH 34/45] block: move holder_dir to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the holder_dir field to struct block_device in preparation for kill struct hd_struct. Signed-off-by: Christoph Hellwig --- block/genhd.c | 5 +++-- block/partitions/core.c | 8 fs/block_dev.c| 11 +-- include/linux/blk_types.h | 1 + include

[dm-devel] [PATCH 07/45] zram: do not call set_blocksize

2020-11-24 Thread Christoph Hellwig
set_blocksize is used by file systems to use their preferred buffer cache block size. Block drivers should not set it. Signed-off-by: Christoph Hellwig --- drivers/block/zram/zram_drv.c | 11 +-- drivers/block/zram/zram_drv.h | 1 - 2 files changed, 1 insertion(+), 11 deletions

[dm-devel] [PATCH 35/45] block: move make_it_fail to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the make_it_fail flag to struct block_device an turn it into a bool in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 3 ++- block/genhd.c | 4 ++-- include/linux/blk_types.h | 3 +++ include/linux/genhd.h | 3

[dm-devel] [PATCH 42/45] block: switch disk_part_iter_* to use a struct block_device

2020-11-24 Thread Christoph Hellwig
Switch the partition iter infrastructure to iterate over block_device references instead of hd_struct ones mostly used to get at the block_device. Signed-off-by: Christoph Hellwig --- block/genhd.c | 57 +++ block/partitions/core.c | 13

<    5   6   7   8   9   10   11   12   13   14   >