[PATCH v4 0/29] block: Make blkdev_get_by_*() return handle

Jan Kara jack at suse.cz
Wed Sep 27 02:34:06 PDT 2023


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 Btrfs tree's for-next branch [2] as of today as the
series depends on Christoph's changes to btrfs device handling.  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. Christian, can you pull the patches to your tree
to get some exposure in linux-next as well? Thanks!

Changes since v3:
* Rebased on top on btrfs tree

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@infradead.org
[2] git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next

CC: Alasdair Kergon <agk at redhat.com>
CC: Andrew Morton <akpm at linux-foundation.org>
CC: Anna Schumaker <anna at kernel.org>
CC: Chao Yu <chao at kernel.org>
CC: Christian Borntraeger <borntraeger at linux.ibm.com>
CC: Coly Li <colyli at suse.de
CC: "Darrick J. Wong" <djwong at kernel.org>
CC: Dave Kleikamp <shaggy at kernel.org>
CC: David Sterba <dsterba at suse.com>
CC: dm-devel at redhat.com
CC: drbd-dev at lists.linbit.com
CC: Gao Xiang <xiang at kernel.org>
CC: Jack Wang <jinpu.wang at ionos.com>
CC: Jaegeuk Kim <jaegeuk at kernel.org>
CC: jfs-discussion at lists.sourceforge.net
CC: Joern Engel <joern at lazybastard.org>
CC: Joseph Qi <joseph.qi at linux.alibaba.com>
CC: Kent Overstreet <kent.overstreet at gmail.com>
CC: linux-bcache at vger.kernel.org
CC: linux-btrfs at vger.kernel.org
CC: linux-erofs at lists.ozlabs.org
CC: <linux-ext4 at vger.kernel.org>
CC: linux-f2fs-devel at lists.sourceforge.net
CC: linux-mm at kvack.org
CC: linux-mtd at lists.infradead.org
CC: linux-nfs at vger.kernel.org
CC: linux-nilfs at vger.kernel.org
CC: linux-nvme at lists.infradead.org
CC: linux-pm at vger.kernel.org
CC: linux-raid at vger.kernel.org
CC: linux-s390 at vger.kernel.org
CC: linux-scsi at vger.kernel.org
CC: linux-xfs at vger.kernel.org
CC: "Md. Haris Iqbal" <haris.iqbal at ionos.com>
CC: Mike Snitzer <snitzer at kernel.org>
CC: Minchan Kim <minchan at kernel.org>
CC: ocfs2-devel at oss.oracle.com
CC: reiserfs-devel at vger.kernel.org
CC: Sergey Senozhatsky <senozhatsky at chromium.org>
CC: Song Liu <song at kernel.org>
CC: Sven Schnelle <svens at linux.ibm.com>
CC: target-devel at vger.kernel.org
CC: Ted Tso <tytso at mit.edu>
CC: Trond Myklebust <trond.myklebust at hammerspace.com>
CC: xen-devel at lists.xenproject.org

Previous versions:
Link: http://lore.kernel.org/r/20230629165206.383-1-jack@suse.cz # v1
Link: http://lore.kernel.org/r/20230810171429.31759-1-jack@suse.cz # v2



More information about the Linux-nvme mailing list