From patchwork Wed May 8 06:42:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13658132 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B13151A2C15 for ; Wed, 8 May 2024 06:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150586; cv=none; b=eZuIi43iQT8umDkCXc9kV35pVK3WD6CFyCWEKIMIKcJrHLBGi2J99AQW+a0fuqimp+wKTUQc8H8CpNvgVbBPLsMoShNHsYVMlIomE5DsOnT28ricsHy8u3yOb7V4yGpSiO2Nx+h71FW6N0bPcTlFOqyE08Ubs+S0ptHpSu8FSO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150586; c=relaxed/simple; bh=O7/svx19PHGA7RQQM/4haK5NTpzXS0w2J0ej4VFL+I0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mp1v9/0F1hkzFPRfAdt4w9cMZZ2ztD/TE+X7wVyw7kMp9twCfhfd/J1Bfc7NAN8RDrUkSSTKbgeax7lZcRzwT1aVjo6np8YZ1Ugne+qk+aKHFK7EjbZnocSxrwCzhq9OQ9PnHelgvzqYbDHtVIY3rBNhCy70iVHp7JGKcg7oJWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=geVAFd3A; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="geVAFd3A" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=BtwrkYQuRbDbpdUipdu6pNRU/MfaZ4iN5Z5g3Xeh6Ik=; b=geVAFd3AihCTEppBEMMUdCKVnX BOB8/35cFWMzLNcqgnuzDvKTVCAxNzZuip/V7APw+1O6xpfDZt9OBG36c/yW2rsdAvphhpZaJlzcT Z94r18mi4LQCErRaIaPBCvgu4WtPu4bfsfLHaDY8kTwx04s7VyIh7oB7/Ben/vCElYWsOci8zmRvU Y4sXlkKCURMmGIWJuUEpWTJULNf3uzF1EvT7Pd0Nq/XfHv4BB70ESBvR1FsH2+BncdqVJhxVmnVhU Qal7YxEEt98cKvnpdniFoGyN4AWtAigUkYlOUJePhseCFS17QgOAg2tvx2rg5LPsCJzErkbtNdH56 fA75mBfA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s4b13-00Fvp8-2K; Wed, 08 May 2024 06:43:01 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de Subject: [PATCHES part 1 1/7] ext4: remove block_device_ejected() Date: Wed, 8 May 2024 07:42:55 +0100 Message-Id: <20240508064301.3797191-1-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240508063522.GO2118490@ZenIV> References: <20240508063522.GO2118490@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro From: Yu Kuai block_device_ejected() is added by commit bdfe0cbd746a ("Revert "ext4: remove block_device_ejected"") in 2015. At that time 'bdi->wb' is destroyed synchronized from del_gendisk(), hence if ext4 is still mounted, and then mark_buffer_dirty() will reference destroyed 'wb'. However, such problem doesn't exist anymore: - commit d03f6cdc1fc4 ("block: Dynamically allocate and refcount backing_dev_info") switch bdi to use refcounting; - commit 13eec2363ef0 ("fs: Get proper reference for s_bdi"), will grab additional reference of bdi while mounting, so that 'bdi->wb' will not be destroyed until generic_shutdown_super(). Hence remove this dead function block_device_ejected(). Signed-off-by: Yu Kuai Reviewed-by: Jan Kara Reviewed-by: Christoph Hellwig Signed-off-by: Al Viro Link: https://lore.kernel.org/r/20240411145346.2516848-7-viro@zeniv.linux.org.uk Signed-off-by: Christian Brauner --- fs/ext4/super.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9988b3a40b42..b255f798f449 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -492,22 +492,6 @@ static void ext4_maybe_update_superblock(struct super_block *sb) schedule_work(&EXT4_SB(sb)->s_sb_upd_work); } -/* - * The del_gendisk() function uninitializes the disk-specific data - * structures, including the bdi structure, without telling anyone - * else. Once this happens, any attempt to call mark_buffer_dirty() - * (for example, by ext4_commit_super), will cause a kernel OOPS. - * This is a kludge to prevent these oops until we can put in a proper - * hook in del_gendisk() to inform the VFS and file system layers. - */ -static int block_device_ejected(struct super_block *sb) -{ - struct inode *bd_inode = sb->s_bdev->bd_inode; - struct backing_dev_info *bdi = inode_to_bdi(bd_inode); - - return bdi->dev == NULL; -} - static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn) { struct super_block *sb = journal->j_private; @@ -6172,8 +6156,6 @@ static int ext4_commit_super(struct super_block *sb) if (!sbh) return -EINVAL; - if (block_device_ejected(sb)) - return -ENODEV; ext4_update_super(sb); From patchwork Wed May 8 06:42:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13658126 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B134A1DA53 for ; Wed, 8 May 2024 06:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; cv=none; b=l/XVZpcBhuE5ZtqB7OtRa0OPPPl9JJWuz2ddRnrzHTDnA/bGqLf6/v7MbNDhY36AtbjvPjiGAQwKeiUwQP76CrKOYHcoEgfhuuhs8hS0L8N4RCm6JgYnxtNFIXANQMi3Vfd3lSKZpT8Q5MIMjuaIQ1auCv1DOFn3sEMC42GdIC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; c=relaxed/simple; bh=4AKcBf8T1mKo69V26eKRttQKogY/D5c0HXlT8kTQcfs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MNaSXiBn+4202xm/PHtTnR8n4Vw9f8h1tHURcYRpo+TFDF8YsDtVgCqc4hRx77YveylRLShXz/gdWCCxTENp65FiWuH5rYZlkqp4WKGEbY4bPtIBFf0snfyMUqTIjJ3PSpcS6p6HMRrPtNsLowx5Kc5Na/dFpLthN79K9ZXhRLk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=MaQ8UFwb; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="MaQ8UFwb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=gT1CHbrfj2ld1KCAZnaHgr9yRAWq/Q+f8sqf1E8X5lw=; b=MaQ8UFwbjhMrWM+Sg4tp1XlC0G 6oy0nhoCy+XKCVEvelmBMNLRcRtEENflNTyKqH8Y+r1oAmLTPnAXNxg7628sJeteC3omBJLIFJ3bt hxcQBpzm6wpuN6kfquvRAzSeCoDiNVNKrTBBeLXYSHzF3l8pcmQ0MLqWFLZltJiA8ymYOqDyH1rik AZMZNWo1lKR7mC5V+Hq70h7k1qfVUwmlTgw1GZ7e1jCiVF4gSRcCvujV4oTXj0cNlt6Ibp1VJs6YH g3wl4URof/QbKjk/MiZFWwxMOul7JJAWy2mx/j88TCe7s0O/VW2vuQfhgi81v13lx3KKoeCzW7KOS z/nuDnqg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s4b13-00FvpC-38; Wed, 08 May 2024 06:43:02 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de Subject: [PATCHES part 1 2/7] bcachefs: remove dead function bdev_sectors() Date: Wed, 8 May 2024 07:42:56 +0100 Message-Id: <20240508064301.3797191-2-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240508064301.3797191-1-viro@zeniv.linux.org.uk> References: <20240508063522.GO2118490@ZenIV> <20240508064301.3797191-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro From: Yu Kuai bdev_sectors() is not used hence remove it. Signed-off-by: Yu Kuai Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Signed-off-by: Al Viro Link: https://lore.kernel.org/r/20240411145346.2516848-10-viro@zeniv.linux.org.uk Acked-by: Kent Overstreet Signed-off-by: Christian Brauner --- fs/bcachefs/util.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 5cf885b09986..5d2c470a49ac 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -445,11 +445,6 @@ static inline unsigned fract_exp_two(unsigned x, unsigned fract_bits) void bch2_bio_map(struct bio *bio, void *base, size_t); int bch2_bio_alloc_pages(struct bio *, size_t, gfp_t); -static inline sector_t bdev_sectors(struct block_device *bdev) -{ - return bdev->bd_inode->i_size >> 9; -} - #define closure_bio_submit(bio, cl) \ do { \ closure_get(cl); \ From patchwork Wed May 8 06:42:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13658127 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE9221EB45 for ; Wed, 8 May 2024 06:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; cv=none; b=cDr7fw1QjiMP7FMzIeAbmnWy0bMVqVDftj1xpR7vzrks8GYsc8PV/reew7uHMRpS2s3Y3SPd0OS2h73sxr5qWlc9+qyCRQRrz4q9OD053CZ2DWmsbft6Fr4mrg2/GWelOCTreYMfG10l8HFKj5pNay0Gzs25uGEHbcFU2R8O+WM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; c=relaxed/simple; bh=FI7nZOW4jAMQ7zWKk3/48y5CNUEqc9wZVzGIr6sBxAE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XH7aFunVxQlP1brnNUTfhHLxOT1h1l0opVhEdDOIQMCdJagA1J080kdB0ghHxQvjjYXa3Z2aAWkdOS9EfsJ61W2gdUKpZ2McNc7VuzGPbDxPJIqGXSqij/td2opGIXXcfOte/fuuyXiZ4SoHz3/OwtnvOOXC6HM9U+fYNw9dmw8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=jCARK9tC; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="jCARK9tC" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=SUkXRrOO407hJED/veKQuzROfrF1mHglYDDOL6cKg8g=; b=jCARK9tCVFP9fVysfw8o0bFFiA 9yZhP5HG8hqt6s9fZa3HTc2e9GHOf4r/J6l88vlWDQavLJ0PoKV1t3JF9tlv5UuNPIc7d4rV/duK2 af4zoNuJ1Sx8oJaVT66cTfSE/9SeT3zPgi87noKGFoeia4k4b/vID6KLLxrC9aP2Yq83/4Qff9FdZ Tl3AiPFN5RflFsfGP+U1BKMHO/HQguEVwNf+KR/VM7R0XJjy9ttT/t4LLFvKNVxL3tdOHoA/AeFhg wRVeUV9O422mFEoKnM+MIPNWpHb2F1KlYm1yh6taqysewAY6wUXXPjRrEbeT56dqg5YzK0YG+WHJw gVh2u5/g==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s4b14-00FvpE-0T; Wed, 08 May 2024 06:43:02 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de Subject: [PATCHES part 1 3/7] blkdev_write_iter(): saner way to get inode and bdev Date: Wed, 8 May 2024 07:42:57 +0100 Message-Id: <20240508064301.3797191-3-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240508064301.3797191-1-viro@zeniv.linux.org.uk> References: <20240508063522.GO2118490@ZenIV> <20240508064301.3797191-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro ... same as in other methods - bdev_file_inode() and I_BDEV() of that. Signed-off-by: Al Viro Link: https://lore.kernel.org/r/20240411145346.2516848-5-viro@zeniv.linux.org.uk Signed-off-by: Christian Brauner --- block/fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/fops.c b/block/fops.c index 679d9b752fe8..9d0f36688a5d 100644 --- a/block/fops.c +++ b/block/fops.c @@ -668,8 +668,8 @@ static ssize_t blkdev_buffered_write(struct kiocb *iocb, struct iov_iter *from) static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) { struct file *file = iocb->ki_filp; - struct block_device *bdev = I_BDEV(file->f_mapping->host); - struct inode *bd_inode = bdev->bd_inode; + struct inode *bd_inode = bdev_file_inode(file); + struct block_device *bdev = I_BDEV(bd_inode); loff_t size = bdev_nr_bytes(bdev); size_t shorted = 0; ssize_t ret; From patchwork Wed May 8 06:42:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13658131 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B13771E868 for ; Wed, 8 May 2024 06:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150586; cv=none; b=UMkrur1scCfVMjOkrh0W5TyOYdb335SQlBY87tnuG+cUb5ApjVciJl6KluPUrggXOFu/8kee9oLpZTc8NB/MThg+xXgELuSutoUqsb6RYyf4j3vse7IehYG1R7cINtS7tvJajdhf9M3wE98TE2Zn5POUJtYuQdTzdAWVm8/eXz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150586; c=relaxed/simple; bh=c/LfkIG3OKV3mBy7vmW75Qz2v/e3S6TjvRxEBwxCngg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Z7UK3gpU+BnhHSV9cBGvVKWh2LAF8dXOlzy9jH1W7oK96q1gjiad5kEsM78vO472XX4My5to3Q8FAfQVnEuMFbVBGraZzkAge7YwSbt8vpXavHOtbaqdhWuBwDhuE6Ht/0LiTaDCECo6UGjrk3lpeGdPnW8dZsvLJt4m42YcBNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=WcPIgnjW; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="WcPIgnjW" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=2BLWewjM35s5NMQmlkBJWYQMcLrPzus45j304Q0c6m0=; b=WcPIgnjWCopFi/mlZeg0ju5qAl xftBUdmbR6rzxBH1U3omp6/ZRdhdX/kHRZzdMGD5r2Qe/uDEPFnWrHd9uOl9VbdfcL1iK4imZKsTU gUSHbp+iDKu8dcXGhAoWMq/W2+ORRHrv2ZwdzFa3M26blB/q7XV+p3Uu4Qw+ctz+oSTZcXdBn6UIR +7QGzjsuC1iW/VfyEVU1XtCnXKLHxWvn0QxYfd9dxPF6c5wHBrd0IiNnbqOFYeG+BPpBX+ExQRX2z q0Lr9ixeawSNxVEUuR0b/346kqvykiTmI06ThyA6q7QP7i+Oz82AHqT6Qyow89Rn93fvDuLGMaJHp C44cRPcQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s4b14-00FvpG-0w; Wed, 08 May 2024 06:43:02 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de Subject: [PATCHES part 1 4/7] dm-vdo: use bdev_nr_bytes(bdev) instead of i_size_read(bdev->bd_inode) Date: Wed, 8 May 2024 07:42:58 +0100 Message-Id: <20240508064301.3797191-4-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240508064301.3797191-1-viro@zeniv.linux.org.uk> References: <20240508063522.GO2118490@ZenIV> <20240508064301.3797191-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro going to be faster, actually - shift is cheaper than dereference... Signed-off-by: Al Viro Link: https://lore.kernel.org/r/20240411145346.2516848-9-viro@zeniv.linux.org.uk Reviewed-by: Matthew Sakai Signed-off-by: Christian Brauner --- drivers/md/dm-vdo/dm-vdo-target.c | 4 ++-- drivers/md/dm-vdo/indexer/io-factory.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-vdo/dm-vdo-target.c b/drivers/md/dm-vdo/dm-vdo-target.c index 5a4b0a927f56..b423bec6458b 100644 --- a/drivers/md/dm-vdo/dm-vdo-target.c +++ b/drivers/md/dm-vdo/dm-vdo-target.c @@ -878,7 +878,7 @@ static int parse_device_config(int argc, char **argv, struct dm_target *ti, } if (config->version == 0) { - u64 device_size = i_size_read(config->owned_device->bdev->bd_inode); + u64 device_size = bdev_nr_bytes(config->owned_device->bdev); config->physical_blocks = device_size / VDO_BLOCK_SIZE; } @@ -1011,7 +1011,7 @@ static void vdo_status(struct dm_target *ti, status_type_t status_type, static block_count_t __must_check get_underlying_device_block_count(const struct vdo *vdo) { - return i_size_read(vdo_get_backing_device(vdo)->bd_inode) / VDO_BLOCK_SIZE; + return bdev_nr_bytes(vdo_get_backing_device(vdo)) / VDO_BLOCK_SIZE; } static int __must_check process_vdo_message_locked(struct vdo *vdo, unsigned int argc, diff --git a/drivers/md/dm-vdo/indexer/io-factory.c b/drivers/md/dm-vdo/indexer/io-factory.c index 515765d35794..1bee9d63dc0a 100644 --- a/drivers/md/dm-vdo/indexer/io-factory.c +++ b/drivers/md/dm-vdo/indexer/io-factory.c @@ -90,7 +90,7 @@ void uds_put_io_factory(struct io_factory *factory) size_t uds_get_writable_size(struct io_factory *factory) { - return i_size_read(factory->bdev->bd_inode); + return bdev_nr_bytes(factory->bdev); } /* Create a struct dm_bufio_client for an index region starting at offset. */ From patchwork Wed May 8 06:42:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13658128 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D682720DCC for ; Wed, 8 May 2024 06:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; cv=none; b=kLgf+Aw44wp8h9mN804zu6T0oNqhPF0N/mMPzJjiaoTqlDWRzaPlRx0zA8yeXhCGOeaeIdMlGhpYKPz5h9K61p6q742KntAswEoh4DhMQVVp+wu7A1G+5gl4Q/EVlWX02KnqhNxm63biY2oU3FNoJKFxzKfzQEklX7q280WRBXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; c=relaxed/simple; bh=6zGn5vkpjtaojVe8dx4j692J0Ws0QzGVzTmjYahWxKY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mn0VbgxT/j2bRpljXOtg1bXkS82LICAnZewHRqzuB7EGKtUiPp0Ok12OHse30emPM5jIxjDoGo0J7gWDdZzy8q2g09ObdsFhHLxytr5W8VHMUgB7fSLN2FjcvWGpqrNHZWjP7pKaDQjYnZWKaJl3Y1P2TvdNxlVArzLURNqOM/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=bHBGh0f5; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="bHBGh0f5" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=A80ql/fjXXwEvWMM6caYngfY8ceo3/ObTxd/L6fIV3I=; b=bHBGh0f57iuv6877li4O+Upyhm zoXMenlVXohfq/8Jz914iEyR8ctZ98mTXqEOe2H8hlb64EvhyqKxdIwQ2xqmHtv7nwRfAOx3F+ADp G64B1OchgUwNKq82HuN4jA8u7TrHK025YekWHhFfopAgjMCeZp81pe9Qc0jUV7tHbaibPGwSYwNgK zE8YKE978zply3AGnYzIfam4qwME8QWPD1aPvTwhY+ASjutNB8JcmkjUs1kA/XtGhsyxz+RK3+1d4 mbAzKFFoiNNfB76KLPCQz4+6TeCX0PjMdVidrT66YbEMzuzj7u6PLFNv860QAGfKikrG04pJRDIaf PjW9J48w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s4b14-00FvpI-1H; Wed, 08 May 2024 06:43:02 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de Subject: [PATCHES part 1 5/7] block2mtd: prevent direct access of bd_inode Date: Wed, 8 May 2024 07:42:59 +0100 Message-Id: <20240508064301.3797191-5-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240508064301.3797191-1-viro@zeniv.linux.org.uk> References: <20240508063522.GO2118490@ZenIV> <20240508064301.3797191-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro From: Yu Kuai All we need is size, and that can be obtained via bdev_nr_bytes() Signed-off-by: Yu Kuai Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Signed-off-by: Al Viro Link: https://lore.kernel.org/r/20240411145346.2516848-11-viro@zeniv.linux.org.uk Signed-off-by: Christian Brauner --- drivers/mtd/devices/block2mtd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index caacdc0a3819..b06c8dd51562 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c @@ -265,6 +265,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size, struct file *bdev_file; struct block_device *bdev; struct block2mtd_dev *dev; + loff_t size; char *name; if (!devname) @@ -291,7 +292,8 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size, goto err_free_block2mtd; } - if ((long)bdev->bd_inode->i_size % erase_size) { + size = bdev_nr_bytes(bdev); + if ((long)size % erase_size) { pr_err("erasesize must be a divisor of device size\n"); goto err_free_block2mtd; } @@ -309,7 +311,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size, dev->mtd.name = name; - dev->mtd.size = bdev->bd_inode->i_size & PAGE_MASK; + dev->mtd.size = size & PAGE_MASK; dev->mtd.erasesize = erase_size; dev->mtd.writesize = 1; dev->mtd.writebufsize = PAGE_SIZE; From patchwork Wed May 8 06:43:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13658130 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09DF9225D9 for ; Wed, 8 May 2024 06:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; cv=none; b=bRKrJE+iTmQAG5k+aPeKDBlcNIw3fjHo0jZzVT0o6S3K2Q2VYvUiliMlW1HqAsNx18bPPpDsPFXhlIw5P2iXcHKcHrZk0EkAaw/YfI9RjjhJHW4jF4MPCMsYA77J+VtPHd8nWE7HJ3iFyJf9xFQvEFzU2yxbaHQj4jFd/Kk5YLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; c=relaxed/simple; bh=7CXhcn6v3eRyqRNxQHV+jKyrjhNAmPq6RQEebi+AY7A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EWBfSu2fkZOqZ9W9jimkSHQ0DW2+QuGJBU9Q6jEWhdaNm9yneiuQ6mURQAQtjvpxHTM8Pln+eJ6PI9NiSTXPMnky+s036AeKgASRRWV7pTK3H9doXq2Pnso+qP+WUkCd1ueXEZoNLTx7nkoxVd/DKpsZBx9pZ6lWc5p8zrAXI+Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=TrvnGpqv; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="TrvnGpqv" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=unLU6pu3cZKcxS6z/DPlTL3Ib06ii51m5b67kS8y7AM=; b=TrvnGpqvl3n4cQH3A4FXIPsh8u RbyfH9bPGWhUY3RVokdu2b2LpWcadGxxwt71PyiE6un3DF9/+bxJ0owbIu/TTgWUSgIuyuSHlrMYs lX2jDIXWtD80MFTjr3auH9wol7DLjy331u6JWQnms0DNc1JGXfGgX6kpv0njc6dx3oCYsqxBj2lL1 WNBRG3z5sSW+aHgifAdkWxcZQ13SpE8UWAnmAZgeQ//mTncPfiJsbAwURoXQRUUYsOl3bRV477sLI Qdi/otASS7OyKXeAIZpTP26EB5egyQvJz2ykZKMH1jHqCPtzLorDFZJ579LEooTtR/pFHtk/PNJfw sWsTsDPw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s4b14-00FvpS-1b; Wed, 08 May 2024 06:43:02 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de Subject: [PATCHES part 1 6/7] block: move two helpers into bdev.c Date: Wed, 8 May 2024 07:43:00 +0100 Message-Id: <20240508064301.3797191-6-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240508064301.3797191-1-viro@zeniv.linux.org.uk> References: <20240508063522.GO2118490@ZenIV> <20240508064301.3797191-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro From: Yu Kuai disk_live() and block_size() access bd_inode directly, prepare to remove the field bd_inode from block_device, and only access bd_inode in block layer. Signed-off-by: Yu Kuai Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Signed-off-by: Al Viro Link: https://lore.kernel.org/r/20240411145346.2516848-8-viro@zeniv.linux.org.uk Signed-off-by: Christian Brauner --- block/bdev.c | 12 ++++++++++++ include/linux/blkdev.h | 12 ++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/block/bdev.c b/block/bdev.c index a89bce368b64..536233ac3e99 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -1257,6 +1257,18 @@ void bdev_statx_dioalign(struct inode *inode, struct kstat *stat) blkdev_put_no_open(bdev); } +bool disk_live(struct gendisk *disk) +{ + return !inode_unhashed(disk->part0->bd_inode); +} +EXPORT_SYMBOL_GPL(disk_live); + +unsigned int block_size(struct block_device *bdev) +{ + return 1 << bdev->bd_inode->i_blkbits; +} +EXPORT_SYMBOL_GPL(block_size); + static int __init setup_bdev_allow_write_mounted(char *str) { if (kstrtobool(str, &bdev_allow_write_mounted)) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 20c749b2ebc2..99ac98ed9548 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -211,11 +211,6 @@ struct gendisk { struct blk_independent_access_ranges *ia_ranges; }; -static inline bool disk_live(struct gendisk *disk) -{ - return !inode_unhashed(disk->part0->bd_inode); -} - /** * disk_openers - returns how many openers are there for a disk * @disk: disk to check @@ -1364,11 +1359,6 @@ static inline unsigned int blksize_bits(unsigned int size) return order_base_2(size >> SECTOR_SHIFT) + SECTOR_SHIFT; } -static inline unsigned int block_size(struct block_device *bdev) -{ - return 1 << bdev->bd_inode->i_blkbits; -} - int kblockd_schedule_work(struct work_struct *work); int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay); @@ -1536,6 +1526,8 @@ void blkdev_put_no_open(struct block_device *bdev); struct block_device *I_BDEV(struct inode *inode); struct block_device *file_bdev(struct file *bdev_file); +bool disk_live(struct gendisk *disk); +unsigned int block_size(struct block_device *bdev); #ifdef CONFIG_BLOCK void invalidate_bdev(struct block_device *bdev); From patchwork Wed May 8 06:43:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13658129 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0212C22338 for ; Wed, 8 May 2024 06:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; cv=none; b=czNK6uwAHZ65ClzpHRcOLlW1kokG+2H6ikLreJ7aZspMS1rmI6dhizCn0rk3iXAcu+PBWyGvC+PRRMkvmUOZ46TXZihTYECTBiqBOFVqwNjvvimXQW5+6LwZNzdB3PhMVGF9RewcLp5HGFd9p+uA3cvXSqWi+FVCOnzwRwrPZkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715150585; c=relaxed/simple; bh=vsn5RA6dJh10d0LFvF5Wh6an43jQZ2DgTxMqluUInIE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BCLAzwFB1XBPT/Ipj2A+3EIUDZZzH0Kdas2/9/Y5VsuniTcLdEzDItZPxyED5/eWJ68MZWwKzqc3e2oZ1GVXM97tnOUCLq2raxB7YC16TdXMcT0dzbok9FJ3gAHZdkpLpHx89niD85m49cnNMXK77oia5W8eOsP3c14vjx/5/P0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=tXRO1kMj; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="tXRO1kMj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=S2yDGez8CmwR7HOIt6alJvJjwhN30c1saUmRuDwXzwY=; b=tXRO1kMj2bxGNptsSl0I3SyEgu wWjM2SI7YdJDnOikV6h4I8ACDIvI1P/aZggP/VGYz42+an6zWeY4BfXaPmADcH94lCPzfoVKhB5Ie vLeAslJfarrizOxULCw5fIY1GGJ+4ezDV3mTsDSjCdI23c/J7wkxnXniLkLZoheWGrn20XU/4qotC IODzxSTNLdwBBMeTdLEMg8PQO32UEkQhG+RjZ7F/wcFXfmt6YC223S7Qu1boJAeuI4W6PFKYl2JTE yOiYaWswBOy3dBZFLbBlDSprXTSkd/qZtvgqNtun0dbsqfBU1KOEWF6Kq5vm3tyHATIEcQWnY07ln CT+T1HJg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s4b14-00FvpW-1q; Wed, 08 May 2024 06:43:02 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de Subject: [PATCHES part 1 7/7] missing helpers: bdev_unhash(), bdev_drop() Date: Wed, 8 May 2024 07:43:01 +0100 Message-Id: <20240508064301.3797191-7-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240508064301.3797191-1-viro@zeniv.linux.org.uk> References: <20240508063522.GO2118490@ZenIV> <20240508064301.3797191-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro bdev_unhash(): make block device invisible to lookups by device number bdev_drop(): drop reference to associated inode. Both are internal, for use by genhd and partition-related code - similar to bdev_add(). The logics in there (especially the lifetime-related parts of it) ought to be cleaned up, but that's a separate story; here we just encapsulate getting to associated inode. Signed-off-by: Al Viro --- block/bdev.c | 10 ++++++++++ block/blk.h | 2 ++ block/genhd.c | 6 +++--- block/partitions/core.c | 6 +++--- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/block/bdev.c b/block/bdev.c index 536233ac3e99..28e6f0423857 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -451,6 +451,16 @@ void bdev_add(struct block_device *bdev, dev_t dev) insert_inode_hash(bdev->bd_inode); } +void bdev_unhash(struct block_device *bdev) +{ + remove_inode_hash(bdev->bd_inode); +} + +void bdev_drop(struct block_device *bdev) +{ + iput(bdev->bd_inode); +} + long nr_blockdev_pages(void) { struct inode *inode; diff --git a/block/blk.h b/block/blk.h index d9f584984bc4..e3347e1030d5 100644 --- a/block/blk.h +++ b/block/blk.h @@ -428,6 +428,8 @@ static inline int blkdev_zone_mgmt_ioctl(struct block_device *bdev, struct block_device *bdev_alloc(struct gendisk *disk, u8 partno); void bdev_add(struct block_device *bdev, dev_t dev); +void bdev_unhash(struct block_device *bdev); +void bdev_drop(struct block_device *bdev); int blk_alloc_ext_minor(void); void blk_free_ext_minor(unsigned int minor); diff --git a/block/genhd.c b/block/genhd.c index bb29a68e1d67..93f5118b7d41 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -656,7 +656,7 @@ void del_gendisk(struct gendisk *disk) */ mutex_lock(&disk->open_mutex); xa_for_each(&disk->part_tbl, idx, part) - remove_inode_hash(part->bd_inode); + bdev_unhash(part); mutex_unlock(&disk->open_mutex); /* @@ -1191,7 +1191,7 @@ static void disk_release(struct device *dev) if (test_bit(GD_ADDED, &disk->state) && disk->fops->free_disk) disk->fops->free_disk(disk); - iput(disk->part0->bd_inode); /* frees the disk */ + bdev_drop(disk->part0); /* frees the disk */ } static int block_uevent(const struct device *dev, struct kobj_uevent_env *env) @@ -1381,7 +1381,7 @@ struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, out_destroy_part_tbl: xa_destroy(&disk->part_tbl); disk->part0->bd_disk = NULL; - iput(disk->part0->bd_inode); + bdev_drop(disk->part0); out_free_bdi: bdi_put(disk->bdi); out_free_bioset: diff --git a/block/partitions/core.c b/block/partitions/core.c index b11e88c82c8c..2b75e325c63b 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -243,7 +243,7 @@ static const struct attribute_group *part_attr_groups[] = { static void part_release(struct device *dev) { put_disk(dev_to_bdev(dev)->bd_disk); - iput(dev_to_bdev(dev)->bd_inode); + bdev_drop(dev_to_bdev(dev)); } static int part_uevent(const struct device *dev, struct kobj_uevent_env *env) @@ -469,7 +469,7 @@ int bdev_del_partition(struct gendisk *disk, int partno) * Just delete the partition and invalidate it. */ - remove_inode_hash(part->bd_inode); + bdev_unhash(part); invalidate_bdev(part); drop_partition(part); ret = 0; @@ -655,7 +655,7 @@ int bdev_disk_changed(struct gendisk *disk, bool invalidate) * it cannot be looked up any more even when openers * still hold references. */ - remove_inode_hash(part->bd_inode); + bdev_unhash(part); /* * If @disk->open_partitions isn't elevated but there's