Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2609622rdh; Wed, 27 Sep 2023 07:38:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBI9Q7xGBhj/65h6FZIjbKIohYo+BGcV0/Ge2mGnLsqQs8xIMslTCXVPSCzOSRQ2vb0svN X-Received: by 2002:a05:6808:114b:b0:3ab:83fe:e18f with SMTP id u11-20020a056808114b00b003ab83fee18fmr3095290oiu.35.1695825539209; Wed, 27 Sep 2023 07:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695825539; cv=none; d=google.com; s=arc-20160816; b=HuTTUykF/EQxjUFjlTnK/39+c8kudoPhQNnBXFX62UvpNdz1i5bnDOloQ/xbt6wlQ1 sg6EOq07pBJ1QDB/wL9rWc/sz9iHAaITSNRuitaj8PEzgIlBHnOBXaqoc9rDVTFZi5nQ sy5odf/F0jDeUBy9iY16UU+X2ul1jGH7yw1itQeNHo5buZmE8N+A8/hH8Fy4e46ZMCzU cylmeiP75GiVNQHt1mWOuEnWAMgoM3g9VYM8JEpWAh4YZ8rnB927iKaXjErmUcKKY8XN k85rM+HmloTP3czfeNK9ome1Dvr5tqRqYqpA43jp6XRG7HwfLZH0so/fFen6ogRQSNvL 6JEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=8yq/EWr5xgyIq2expGTOm/a8E50tdoL6jyUvlCURtkA=; fh=576Qxqq9tgMWOHB/cTJwy8f/xzbFClsxsbLi8D8Jy80=; b=z3Wt6Xgu66Crm1n/aF7iXz2jCmdqWtpdZ3a8ojggTIPVFNyae0cE09v4wy/KTJFgdn d7dxTvVTnEhLZZTSU9oi+YfOP7IgIV1EYuBcuhpJqg6wCsMrmcrcNJd7t89myb48eXms RyC2YXHCVt9DluOsT/+eFSjezbeFkqdVx7BEDxCLlCcVYMZXsa/NSOnumWqZWuz99HCF o9np8u4oE6NPQ0J/6D39EwaaYVKy4GjVqLcVZvtwiNf6Ipt9Tlf31vnH1jpt3bjVi0UE giujf631+QhSIKx1pBteijFHjs87cDFnBQQ1xKcoAG7x9t8xnckgFWJs/l7H19Buo1+2 5U2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AFBlD5Dh; dkim=neutral (no key) header.i=@suse.cz header.b=mg4W9cwL; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id az1-20020a056a02004100b00578a2466521si16486705pgb.676.2023.09.27.07.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 07:38:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AFBlD5Dh; dkim=neutral (no key) header.i=@suse.cz header.b=mg4W9cwL; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 847B88315CB7; Wed, 27 Sep 2023 02:34:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbjI0Jew (ORCPT + 99 others); Wed, 27 Sep 2023 05:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbjI0Jes (ORCPT ); Wed, 27 Sep 2023 05:34:48 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9157A193; Wed, 27 Sep 2023 02:34:45 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 967601FD5E; Wed, 27 Sep 2023 09:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1695807283; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8yq/EWr5xgyIq2expGTOm/a8E50tdoL6jyUvlCURtkA=; b=AFBlD5DhZEt1NESHiYyz8SkegLzofp7eJ1WULrYqvNawr6FwYRs8YvfnxMMuueLH4oaPAr 4/E8CfUtgD9JCSYdgqDNPTGf3WDqWggCkDqswdM4bg88sfMPDeWHH5NIlB2Bfj+JpMt9FG ZcOWlzLEUXG/bpJ8Kbaqy4vRi+qRmpA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1695807283; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8yq/EWr5xgyIq2expGTOm/a8E50tdoL6jyUvlCURtkA=; b=mg4W9cwL1b35dhDAXFy+IpXoqDtwwHWZKy46oqV5YDeY2A866tqG4ZHrqCDezVtTxVLjRN B2SqzI+xFxiJavDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 779CF13A74; Wed, 27 Sep 2023 09:34:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YqW3HDP3E2X+EgAAMHmgww (envelope-from ); Wed, 27 Sep 2023 09:34:43 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id DAA33A07C9; Wed, 27 Sep 2023 11:34:42 +0200 (CEST) From: Jan Kara To: Christian Brauner Cc: , , Christoph Hellwig , Jan Kara , Alasdair Kergon , Andrew Morton , Anna Schumaker , Chao Yu , Christian Borntraeger , "Darrick J. Wong" , Dave Kleikamp , David Sterba , dm-devel@redhat.com, drbd-dev@lists.linbit.com, Gao Xiang , Jack Wang , Jaegeuk Kim , jfs-discussion@lists.sourceforge.net, Joern Engel , Joseph Qi , Kent Overstreet , linux-bcache@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org, linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-nvme@lists.infradead.org, linux-pm@vger.kernel.org, linux-raid@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-xfs@vger.kernel.org, "Md. Haris Iqbal" , Mike Snitzer , Minchan Kim , ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, Sergey Senozhatsky , Song Liu , Sven Schnelle , target-devel@vger.kernel.org, Ted Tso , Trond Myklebust , xen-devel@lists.xenproject.org Subject: [PATCH v4 0/29] block: Make blkdev_get_by_*() return handle Date: Wed, 27 Sep 2023 11:34:06 +0200 Message-Id: <20230818123232.2269-1-jack@suse.cz> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3761; i=jack@suse.cz; h=from:subject:message-id; bh=szriGynEGZ/XhMNms+k06ASpRGig2ulDzrbrydRWx/Q=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBlE/cIrHCVKGuvNFZzgT9xiRfuRKr6Es2Qs4om7G7p jp8k2rmJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZRP3CAAKCRCcnaoHP2RA2XGWB/ 4+O+K19fPnUyIouL+A+izJvDBxQbTCWLdn5TEMu5YdIMbi0dvnwAfknt+NWIhJaTQX2oqlgt3Z+UIT peMYb+jQZabj8X4xHMMy3Sfq64tRwodJHlZby5Ux9AfTZe49zDp4M4B3yxQqarEhmz6e4FJUGDaSej vcJmLz6AuSnYuAh4QK/3jCXQrEElZRTjarZjfbunWocM/2dQ7CB+rOSwKJcRMoDpqntU8QyArxca4l q6I2pBMNjnYMgjtG+ABGSBtTrj87TuJSTB3V8qtI38sfCYjMVVEoQiJKuUm1GMh2sPOFelwVMXMCJH mKs8UbSjcFd3wsbJXc8EOKLxzYparl X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 02:34:57 -0700 (PDT) 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 CC: Andrew Morton CC: Anna Schumaker CC: Chao Yu CC: Christian Borntraeger CC: Coly Li CC: Dave Kleikamp CC: David Sterba CC: dm-devel@redhat.com CC: drbd-dev@lists.linbit.com CC: Gao Xiang CC: Jack Wang CC: Jaegeuk Kim CC: jfs-discussion@lists.sourceforge.net CC: Joern Engel CC: Joseph Qi CC: Kent Overstreet CC: linux-bcache@vger.kernel.org CC: linux-btrfs@vger.kernel.org CC: linux-erofs@lists.ozlabs.org CC: CC: linux-f2fs-devel@lists.sourceforge.net CC: linux-mm@kvack.org CC: linux-mtd@lists.infradead.org CC: linux-nfs@vger.kernel.org CC: linux-nilfs@vger.kernel.org CC: linux-nvme@lists.infradead.org CC: linux-pm@vger.kernel.org CC: linux-raid@vger.kernel.org CC: linux-s390@vger.kernel.org CC: linux-scsi@vger.kernel.org CC: linux-xfs@vger.kernel.org CC: "Md. Haris Iqbal" CC: Mike Snitzer CC: Minchan Kim CC: ocfs2-devel@oss.oracle.com CC: reiserfs-devel@vger.kernel.org CC: Sergey Senozhatsky CC: Song Liu CC: Sven Schnelle CC: target-devel@vger.kernel.org CC: Ted Tso CC: Trond Myklebust CC: xen-devel@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