use block_device based APIs in block layer consumers v2

Christoph Hellwig
2022-04-09T04:51:05Z

Hi Jens,

this series cleanups up the block layer API so that APIs consumed
by file systems are (almost) only struct block_devic based, so that
file systems don't have to poke into block layer internals like the
request_queue.

I also found a bunch of existing bugs related to partition offsets
and discard so these are fixed while going along.

Changes since v1:
- fix a bisection hazard
- minor spelling fixes
- reorder hunks between two patches to make the changes more obvious
- reorder a patch to be earlier in the series to ease backporting

Diffstat:
arch/um/drivers/ubd_kern.c | 2
block/blk-core.c | 4 -
block/blk-lib.c | 124 ++++++++++++++++++++---------------
block/blk-mq-debugfs.c | 2
block/blk-settings.c | 74 ++++++++++++++++++++
block/blk.h | 14 ---
block/fops.c | 2
block/genhd.c | 4 -
block/ioctl.c | 48 ++++++++++---
block/partitions/core.c | 12 ---
drivers/block/drbd/drbd_main.c | 51 ++++++--------
drivers/block/drbd/drbd_nl.c | 94 +++++++++++---------------
drivers/block/drbd/drbd_receiver.c | 13 +--
drivers/block/loop.c | 15 +---
drivers/block/nbd.c | 5 -
drivers/block/null_blk/main.c | 1
drivers/block/rbd.c | 1
drivers/block/rnbd/rnbd-clt.c | 6 -
drivers/block/rnbd/rnbd-srv-dev.h | 8 --
drivers/block/rnbd/rnbd-srv.c | 5 -
drivers/block/virtio_blk.c | 2
drivers/block/xen-blkback/blkback.c | 15 ++--
drivers/block/xen-blkback/xenbus.c | 9 --
drivers/block/xen-blkfront.c | 7 -
drivers/block/zram/zram_drv.c | 1
drivers/md/bcache/alloc.c | 2
drivers/md/bcache/request.c | 4 -
drivers/md/bcache/super.c | 3
drivers/md/bcache/sysfs.c | 2
drivers/md/dm-cache-target.c | 9 --
drivers/md/dm-clone-target.c | 9 --
drivers/md/dm-io.c | 2
drivers/md/dm-log-writes.c | 3
drivers/md/dm-raid.c | 9 --
drivers/md/dm-table.c | 25 +------
drivers/md/dm-thin.c | 15 ----
drivers/md/dm.c | 3
drivers/md/md-linear.c | 11 ---
drivers/md/md.c | 5 -
drivers/md/raid0.c | 7 -
drivers/md/raid1.c | 18 -----
drivers/md/raid10.c | 20 -----
drivers/md/raid5-cache.c | 8 +-
drivers/md/raid5.c | 14 +--
drivers/mmc/core/queue.c | 3
drivers/mtd/mtd_blkdevs.c | 1
drivers/nvme/host/core.c | 6 -
drivers/nvme/target/io-cmd-bdev.c | 2
drivers/nvme/target/zns.c | 3
drivers/s390/block/dasd_fba.c | 1
drivers/scsi/sd.c | 2
drivers/target/target_core_device.c | 20 ++---
drivers/target/target_core_file.c | 10 +-
drivers/target/target_core_iblock.c | 17 +---
fs/btrfs/disk-io.c | 3
fs/btrfs/extent-tree.c | 8 +-
fs/btrfs/ioctl.c | 12 +--
fs/btrfs/volumes.c | 4 -
fs/btrfs/zoned.c | 3
fs/direct-io.c | 32 +--------
fs/exfat/file.c | 5 -
fs/exfat/super.c | 10 --
fs/ext4/ioctl.c | 10 --
fs/ext4/mballoc.c | 10 +-
fs/ext4/super.c | 10 --
fs/f2fs/f2fs.h | 3
fs/f2fs/file.c | 19 ++---
fs/f2fs/segment.c | 8 --
fs/fat/file.c | 5 -
fs/fat/inode.c | 10 --
fs/gfs2/rgrp.c | 7 -
fs/iomap/direct-io.c | 3
fs/jbd2/journal.c | 9 --
fs/jfs/ioctl.c | 5 -
fs/jfs/super.c | 8 --
fs/nilfs2/ioctl.c | 6 -
fs/nilfs2/sufile.c | 4 -
fs/nilfs2/the_nilfs.c | 4 -
fs/ntfs3/file.c | 6 -
fs/ntfs3/super.c | 10 +-
fs/ocfs2/ioctl.c | 5 -
fs/super.c | 2
fs/xfs/xfs_discard.c | 8 +-
fs/xfs/xfs_log_cil.c | 2
fs/xfs/xfs_super.c | 12 +--
fs/zonefs/super.c | 3
include/linux/blkdev.h | 112 +++++++++++--------------------
include/target/target_core_backend.h | 4 -
mm/swapfile.c | 31 ++------
89 files changed, 493 insertions(+), 653 deletions(-)