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/zjgnsvdhzx0xg...@infradead.org CC: Alasdair Kergon <a...@redhat.com> CC: Andrew Morton <a...@linux-foundation.org> CC: Anna Schumaker <a...@kernel.org> CC: Chao Yu <c...@kernel.org> CC: Christian Borntraeger <borntrae...@linux.ibm.com> CC: Coly Li <col...@suse.de CC: "Darrick J. Wong" <djw...@kernel.org> CC: Dave Kleikamp <sha...@kernel.org> CC: David Sterba <dste...@suse.com> CC: dm-de...@redhat.com CC: drbd-...@lists.linbit.com CC: Gao Xiang <xi...@kernel.org> CC: Jack Wang <jinpu.w...@ionos.com> CC: Jaegeuk Kim <jaeg...@kernel.org> CC: jfs-discuss...@lists.sourceforge.net CC: Joern Engel <jo...@lazybastard.org> CC: Joseph Qi <joseph...@linux.alibaba.com> CC: Kent Overstreet <kent.overstr...@gmail.com> CC: linux-bca...@vger.kernel.org CC: linux-bt...@vger.kernel.org CC: linux-er...@lists.ozlabs.org CC: <linux-e...@vger.kernel.org> CC: linux-f2fs-de...@lists.sourceforge.net CC: linux...@kvack.org CC: linux-...@lists.infradead.org CC: linux-...@vger.kernel.org CC: linux-ni...@vger.kernel.org CC: linux-n...@lists.infradead.org CC: linux...@vger.kernel.org CC: linux-r...@vger.kernel.org CC: linux-s...@vger.kernel.org CC: linux-s...@vger.kernel.org CC: linux-...@vger.kernel.org CC: "Md. Haris Iqbal" <haris.iq...@ionos.com> CC: Mike Snitzer <snit...@kernel.org> CC: Minchan Kim <minc...@kernel.org> CC: ocfs2-de...@oss.oracle.com CC: reiserfs-de...@vger.kernel.org CC: Sergey Senozhatsky <senozhat...@chromium.org> CC: Song Liu <s...@kernel.org> CC: Sven Schnelle <sv...@linux.ibm.com> CC: target-de...@vger.kernel.org CC: Ted Tso <ty...@mit.edu> CC: Trond Myklebust <trond.mykleb...@hammerspace.com> CC: xen-devel@lists.xenproject.org Previous versions: Link: http://lore.kernel.org/r/20230629165206.383-1-j...@suse.cz # v1 Link: http://lore.kernel.org/r/20230810171429.31759-1-j...@suse.cz # v2