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/ZJGNsVDhZx0Xgs2H@xxxxxxxxxxxxx CC: Alasdair Kergon <agk@xxxxxxxxxx> CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> CC: Anna Schumaker <anna@xxxxxxxxxx> CC: Chao Yu <chao@xxxxxxxxxx> CC: Christian Borntraeger <borntraeger@xxxxxxxxxxxxx> CC: Coly Li <colyli@xxxxxxx CC: "Darrick J. Wong" <djwong@xxxxxxxxxx> CC: Dave Kleikamp <shaggy@xxxxxxxxxx> CC: David Sterba <dsterba@xxxxxxxx> CC: dm-devel@xxxxxxxxxx CC: drbd-dev@xxxxxxxxxxxxxxxx CC: Gao Xiang <xiang@xxxxxxxxxx> CC: Jack Wang <jinpu.wang@xxxxxxxxx> CC: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> CC: jfs-discussion@xxxxxxxxxxxxxxxxxxxxx CC: Joern Engel <joern@xxxxxxxxxxxxxxx> CC: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx> CC: Kent Overstreet <kent.overstreet@xxxxxxxxx> CC: linux-bcache@xxxxxxxxxxxxxxx CC: linux-btrfs@xxxxxxxxxxxxxxx CC: linux-erofs@xxxxxxxxxxxxxxxx CC: <linux-ext4@xxxxxxxxxxxxxxx> CC: linux-f2fs-devel@xxxxxxxxxxxxxxxxxxxxx CC: linux-mm@xxxxxxxxx CC: linux-mtd@xxxxxxxxxxxxxxxxxxx CC: linux-nfs@xxxxxxxxxxxxxxx CC: linux-nilfs@xxxxxxxxxxxxxxx CC: linux-nvme@xxxxxxxxxxxxxxxxxxx CC: linux-pm@xxxxxxxxxxxxxxx CC: linux-raid@xxxxxxxxxxxxxxx CC: linux-s390@xxxxxxxxxxxxxxx CC: linux-scsi@xxxxxxxxxxxxxxx CC: linux-xfs@xxxxxxxxxxxxxxx CC: "Md. Haris Iqbal" <haris.iqbal@xxxxxxxxx> CC: Mike Snitzer <snitzer@xxxxxxxxxx> CC: Minchan Kim <minchan@xxxxxxxxxx> CC: ocfs2-devel@xxxxxxxxxxxxxx CC: reiserfs-devel@xxxxxxxxxxxxxxx CC: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> CC: Song Liu <song@xxxxxxxxxx> CC: Sven Schnelle <svens@xxxxxxxxxxxxx> CC: target-devel@xxxxxxxxxxxxxxx CC: Ted Tso <tytso@xxxxxxx> CC: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> CC: xen-devel@xxxxxxxxxxxxxxxxxxxx Previous versions: Link: http://lore.kernel.org/r/20230629165206.383-1-jack@xxxxxxx # v1 Link: http://lore.kernel.org/r/20230810171429.31759-1-jack@xxxxxxx # v2 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel