Skip to content

block: Make blkdev_get_by_*() return handle

Jan Kara dm-devel drbd-dev linux-bcache linux-block linux-btrfs linux-erofs linux-ext4 linux-f2fs-devel linux-fsdevel linux-mm linux-mtd linux-nfs linux-nilfs linux-nvme linux-pm linux-raid linux-s390 linux-scsi linux-xfs reiserfs-devel target-devel xen-devel 3 versions – Applied

Status from this message: Applied to the vfs.super branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest29 patches 50 repliesApplied
  2. v229 patches 20 repliesSuperseded
  3. v1 RFC32 patches 29 repliesSuperseded

Changes in v3 from the cover letter

* Rebased on top of current vfs tree
* Added some acks
* Reflected minor nits from Christoph
* Added missing conversion of blkdev_put() calls in cramfs and erofs
* Fixed possible leak of bdev handle in xfs if logdev is the same as fs dev

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/29block: Provide bdev_open_* functionsblock/bdev.c include/linux/blkdev.h+58 -01 reply
1/29block: Provide bdev_open_* functionsblock/bdev.c include/linux/blkdev.h+58 -00 replies
2/29block: Use bdev_open_by_dev() in blkdev_open()block/bdev.c block/blk.h block/fops.c +2 more+24 -215 replies
2/29block: Use bdev_open_by_dev() in blkdev_open()block/bdev.c block/fops.c include/linux/blkdev.h+32 -160 replies
3/29block: Use bdev_open_by_dev() in disk_scan_partitions() and blkdev_bszset()block/genhd.c block/ioctl.c+10 -81 reply
3/29block: Use bdev_open_by_dev() in disk_scan_partitions() and blkdev_bszset()block/genhd.c block/ioctl.c+10 -80 replies
4/29drdb: Convert to use bdev_open_by_path()drivers/block/drbd/drbd_int.h drivers/block/drbd/drbd_nl.c+34 -331 reply
4/29drdb: Convert to use bdev_open_by_path()drivers/block/drbd/drbd_int.h drivers/block/drbd/drbd_nl.c+34 -330 replies
5/29pktcdvd: Convert to bdev_open_by_dev()drivers/block/pktcdvd.c include/linux/pktcdvd.h+44 -361 reply
5/29pktcdvd: Convert to bdev_open_by_dev()drivers/block/pktcdvd.c include/linux/pktcdvd.h+44 -360 replies
6/29rnbd-srv: Convert to use bdev_open_by_path()drivers/block/rnbd/rnbd-srv.c drivers/block/rnbd/rnbd-srv.h+15 -141 reply
6/29rnbd-srv: Convert to use bdev_open_by_path()drivers/block/rnbd/rnbd-srv.c drivers/block/rnbd/rnbd-srv.h+15 -140 replies
7/29xen/blkback: Convert to bdev_open_by_dev()drivers/block/xen-blkback/blkback.c drivers/block/xen-blkback/common.h drivers/block/xen-blkback/xenbus.c+25 -231 reply
7/29xen/blkback: Convert to bdev_open_by_dev()drivers/block/xen-blkback/blkback.c drivers/block/xen-blkback/common.h drivers/block/xen-blkback/xenbus.c+25 -230 replies
8/29zram: Convert to use bdev_open_by_dev()drivers/block/zram/zram_drv.c drivers/block/zram/zram_drv.h+15 -181 reply
8/29zram: Convert to use bdev_open_by_dev()drivers/block/zram/zram_drv.c drivers/block/zram/zram_drv.h+15 -180 replies
9/29bcache: Convert to bdev_open_by_path()drivers/md/bcache/bcache.h drivers/md/bcache/super.c+43 -371 reply
9/29bcache: Convert to bdev_open_by_path()drivers/md/bcache/bcache.h drivers/md/bcache/super.c+43 -370 replies
10/29dm: Convert to bdev_open_by_dev()drivers/md/dm.c include/linux/device-mapper.h+12 -91 reply
10/29dm: Convert to bdev_open_by_dev()drivers/md/dm.c include/linux/device-mapper.h+12 -90 replies
11/29md: Convert to bdev_open_by_dev()drivers/md/md.c drivers/md/md.h+8 -51 reply
11/29md: Convert to bdev_open_by_dev()drivers/md/md.c drivers/md/md.h+9 -170 replies
12/29mtd: block2mtd: Convert to bdev_open_by_dev/path()drivers/mtd/devices/block2mtd.c+29 -221 reply
12/29mtd: block2mtd: Convert to bdev_open_by_dev/path()drivers/mtd/devices/block2mtd.c+29 -220 replies
13/29nvmet: Convert to bdev_open_by_path()drivers/nvme/target/io-cmd-bdev.c drivers/nvme/target/nvmet.h+12 -92 replies
13/29nvmet: Convert to bdev_open_by_path()drivers/nvme/target/io-cmd-bdev.c drivers/nvme/target/nvmet.h+12 -90 replies
14/29s390/dasd: Convert to bdev_open_by_path()drivers/s390/block/dasd.c drivers/s390/block/dasd_genhd.c drivers/s390/block/dasd_int.h +1 more+31 -303 replies
14/29s390/dasd: Convert to bdev_open_by_path()drivers/s390/block/dasd.c drivers/s390/block/dasd_genhd.c drivers/s390/block/dasd_int.h +1 more+31 -300 replies
15/29scsi: target: Convert to bdev_open_by_path()drivers/target/target_core_iblock.c drivers/target/target_core_iblock.h drivers/target/target_core_pscsi.c +1 more+26 -221 reply
15/29scsi: target: Convert to bdev_open_by_path()drivers/target/target_core_iblock.c drivers/target/target_core_iblock.h drivers/target/target_core_pscsi.c +1 more+26 -221 reply
16/29PM: hibernate: Convert to bdev_open_by_dev()kernel/power/swap.c+16 -151 reply
16/29PM: hibernate: Convert to bdev_open_by_dev()kernel/power/swap.c+16 -150 replies
17/29PM: hibernate: Drop unused snapshot_test argumentkernel/power/hibernate.c kernel/power/power.h kernel/power/swap.c+11 -111 reply
17/29PM: hibernate: Drop unused snapshot_test argumentkernel/power/hibernate.c kernel/power/power.h kernel/power/swap.c+11 -110 replies
18/29mm/swap: Convert to use bdev_open_by_dev()include/linux/swap.h mm/swapfile.c+13 -111 reply
18/29mm/swap: Convert to use bdev_open_by_dev()include/linux/swap.h mm/swapfile.c+13 -110 replies
19/29fs: Convert to bdev_open_by_dev()fs/cramfs/inode.c fs/romfs/super.c fs/super.c +1 more+12 -81 reply
19/29fs: Convert to bdev_open_by_dev()fs/cramfs/inode.c fs/romfs/super.c fs/super.c +1 more+12 -80 replies
20/29btrfs: Convert to bdev_open_by_path()fs/btrfs/dev-replace.c fs/btrfs/ioctl.c fs/btrfs/volumes.c +1 more+73 -721 reply
20/29btrfs: Convert to bdev_open_by_path()fs/btrfs/dev-replace.c fs/btrfs/ioctl.c fs/btrfs/volumes.c +1 more+73 -720 replies
21/29erofs: Convert to use bdev_open_by_path()fs/erofs/data.c fs/erofs/internal.h fs/erofs/super.c+13 -131 reply
21/29erofs: Convert to use bdev_open_by_path()fs/erofs/data.c fs/erofs/internal.h fs/erofs/super.c+13 -130 replies
22/29ext4: Convert to bdev_open_by_dev()fs/ext4/ext4.h fs/ext4/fsmap.c fs/ext4/super.c+29 -261 reply
22/29ext4: Convert to bdev_open_by_dev()fs/ext4/ext4.h fs/ext4/fsmap.c fs/ext4/super.c+33 -300 replies
23/29f2fs: Convert to bdev_open_by_dev/path()fs/f2fs/f2fs.h fs/f2fs/super.c+10 -83 replies
23/29f2fs: Convert to bdev_open_by_dev/path()fs/f2fs/f2fs.h fs/f2fs/super.c+8 -60 replies
24/29jfs: Convert to bdev_open_by_dev()fs/jfs/jfs_logmgr.c fs/jfs/jfs_logmgr.h fs/jfs/jfs_mount.c+18 -161 reply
24/29jfs: Convert to bdev_open_by_dev()fs/jfs/jfs_logmgr.c fs/jfs/jfs_logmgr.h fs/jfs/jfs_mount.c+18 -160 replies
25/29nfs/blocklayout: Convert to use bdev_open_by_dev/path()fs/nfs/blocklayout/blocklayout.h fs/nfs/blocklayout/dev.c+38 -401 reply
25/29nfs/blocklayout: Convert to use bdev_open_by_dev/path()fs/nfs/blocklayout/blocklayout.h fs/nfs/blocklayout/dev.c+38 -400 replies
26/29ocfs2: Convert to use bdev_open_by_dev()fs/ocfs2/cluster/heartbeat.c+45 -361 reply
26/29ocfs2: Convert to use bdev_open_by_dev()fs/ocfs2/cluster/heartbeat.c+45 -360 replies
27/29reiserfs: Convert to bdev_open_by_dev/path()fs/reiserfs/journal.c fs/reiserfs/procfs.c fs/reiserfs/reiserfs.h+33 -361 reply
27/29reiserfs: Convert to bdev_open_by_dev/path()fs/reiserfs/journal.c fs/reiserfs/procfs.c fs/reiserfs/reiserfs.h+33 -360 replies
28/29xfs: Convert to bdev_open_by_path()fs/xfs/xfs_buf.c fs/xfs/xfs_buf.h fs/xfs/xfs_super.c+42 -375 replies
28/29xfs: Convert to bdev_open_by_path()fs/xfs/xfs_buf.c fs/xfs/xfs_buf.h fs/xfs/xfs_super.c+36 -311 reply
29/29block: Remove blkdev_get_by_*() functionsblock/bdev.c include/linux/blkdev.h+30 -691 reply
29/29block: Remove blkdev_get_by_*() functionsblock/bdev.c include/linux/blkdev.h+30 -690 replies

Reviews trailers per patch

All 58 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristoph HellwigGao XiangColy LiSong LiuMd. Haris IqbalRafael J. WysockiSergey SenozhatskyDave KleikampJoseph QiChaitanya KulkarniDave ChinnerChristian BraunerJens AxboeMartin K. PetersenDarrick J. WongStefan Haberland
SeriesA-b
1/29A-b A-b R-b R-b
1/29A-b A-b R-b R-b
2/29A-b A-b A-b R-b R-b
2/29A-b A-b A-b R-b R-b
3/29A-b A-b R-b R-b
3/29A-b A-b R-b R-b
4/29A-b A-b A-b A-b
4/29A-b A-b A-b A-b
5/29A-b A-b A-b A-b
5/29A-b A-b A-b A-b
6/29A-b A-b A-b A-b A-b A-b
6/29A-b A-b A-b A-b A-b A-b
7/29A-b A-b A-b A-b
7/29A-b A-b A-b A-b
8/29A-b A-b R-b R-b A-b A-b
8/29A-b A-b R-b R-b A-b A-b
9/29A-b A-b A-b A-b A-b A-b
9/29A-b A-b A-b A-b A-b A-b
10/29A-b A-b A-b A-b
10/29A-b A-b A-b A-b
11/29A-b A-b A-b A-b A-b A-b
11/29A-b A-b A-b A-b A-b A-b
12/29A-b A-b A-b A-b
12/29A-b A-b A-b A-b
13/29A-b A-b R-b R-b A-b A-b
13/29A-b A-b R-b R-b A-b A-b
14/29A-b A-b A-b A-b A-b
14/29A-b A-b A-b A-b A-b
15/29A-b A-b A-b A-b R-b
15/29A-b A-b A-b A-b R-b
16/29A-b A-b A-b A-b A-b A-b
16/29A-b A-b A-b A-b A-b A-b
17/29A-b A-b A-b A-b A-b A-b
17/29A-b A-b A-b A-b A-b A-b
18/29A-b A-b A-b A-b
18/29A-b A-b A-b A-b
19/29A-b A-b R-b R-b
19/29A-b A-b R-b R-b
20/29A-b A-b R-b R-b
20/29A-b A-b R-b R-b
21/29A-b A-b A-b A-b R-b R-b
21/29A-b A-b A-b A-b R-b R-b
22/29A-b A-b R-b R-b
22/29A-b A-b R-b R-b
23/29A-b A-b R-b R-b
23/29A-b A-b R-b R-b
24/29A-b A-b A-b A-b R-b R-b
24/29A-b A-b A-b A-b R-b R-b
25/29A-b A-b R-b R-b
25/29A-b A-b R-b R-b
26/29A-b A-b R-b R-b R-b R-b
26/29A-b A-b R-b R-b R-b R-b
27/29A-b A-b R-b R-b
27/29A-b A-b R-b R-b
28/29A-b A-b A-b R-b R-b R-b R-b A-b R-b
28/29A-b A-b A-b R-b R-b R-b R-b A-b R-b
29/29A-b A-b R-b R-b
29/29A-b A-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 16 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/29] block: Make blkdev_get_by_*() return handle

Hello,

this is a v3 of the patch series which implements the idea of blkdev_get_by_*() calls returning bdev_handle which is then passed to blkdev_put() [1]. This makes the get and put calls for bdevs more obviously matching and allows us to propagate context from get to put without having to modify all the users (again!). In particular I need to propagate used open flags to blkdev_put() to be able count writeable opens and add support for blocking writes to mounted block devices. I'll send that series separately.

The series is based on Christian's vfs tree as of today as there is quite some overlap. Patches have passed some reasonable testing - I've tested block changes, md, dm, bcache, xfs, btrfs, ext4, swap. More testing or review is always welcome. Thanks! I've pushed out the full branch to:

git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git bdev_handle

to ease review / testing. Since there were not many comments for v2 and Christoph has acked the series I think we should start discussing how to merge the series. Most collisions with this series seem to happen in the filesystems area so VFS tree would seem as the least painful way to merge this. Jens, are you OK with that?

Changes since v2:
* Rebased on top of current vfs tree
* Added some acks
* Reflected minor nits from Christoph
* Added missing conversion of blkdev_put() calls in cramfs and erofs
* Fixed possible leak of bdev handle in xfs if logdev is the same as fs dev

Changes since v1:
* Rebased on top of current vfs tree
* Renamed final functions to bdev_open_by_*() and bdev_release()
* Fixed detection of exclusive open in blkdev_ioctl() and blkdev_fallocate()
* Fixed swap conversion to properly reinitialize swap_info->bdev_handle
* Fixed xfs conversion to not oops with rtdev without logdev
* Couple other minor fixups

Honza

[1] https://lore.kernel.org/all/[email protected]

Previous versions: