From patchwork Wed Sep 27 09:34:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 13400520 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBA4EE810BD for ; Wed, 27 Sep 2023 09:35:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbjI0JfA (ORCPT ); Wed, 27 Sep 2023 05:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbjI0Jeu (ORCPT ); Wed, 27 Sep 2023 05:34:50 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C931310E; Wed, 27 Sep 2023 02:34:48 -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-out1.suse.de (Postfix) with ESMTPS id EFE4821972; Wed, 27 Sep 2023 09:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1695807284; 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: in-reply-to:in-reply-to:references:references; bh=iUa4qiF0fK+FCGgvHHglsbXPmDmw8P3lWfMQ2r3au+0=; b=B/YNdch69PAQ4ZS2OtdNjt5ZhU4b9W9zRKz9038QVXOYEQO8gd0xFjrnATN26SI5LPLAQW g5mNQ1i1Ij77Jz4bI0+0vIICKS66Ln+l7r0pHhPHvfqdLDmvoHTGzSVNjh/1/yNiU/et4k SkHw6ASek0lur8rj063TrpDcxJuY8Dk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1695807284; 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: in-reply-to:in-reply-to:references:references; bh=iUa4qiF0fK+FCGgvHHglsbXPmDmw8P3lWfMQ2r3au+0=; b=zcl5zqM3retFqVWaPZL6Y4GgBBCAiiYaI1InZZDJHqaAtx2Azila68Ie45hUQ0kDZAknnL kRsVChJhgG75vDAQ== 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 DE3B713AC6; Wed, 27 Sep 2023 09:34:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PQA+NjT3E2U2EwAAMHmgww (envelope-from ); Wed, 27 Sep 2023 09:34:44 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 946BCA07CF; Wed, 27 Sep 2023 11:34:43 +0200 (CEST) From: Jan Kara To: Christian Brauner Cc: , , Christoph Hellwig , Jan Kara , Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Christoph Hellwig Subject: [PATCH 23/29] f2fs: Convert to bdev_open_by_dev/path() Date: Wed, 27 Sep 2023 11:34:29 +0200 Message-Id: <20230927093442.25915-23-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230818123232.2269-1-jack@suse.cz> References: <20230818123232.2269-1-jack@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2195; i=jack@suse.cz; h=from:subject; bh=EfNWf25rG2sdLblSTrWJS5psCk0G25MPE7O29FeYgqA=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBlE/clgXVcj1Zx/OgudGuoqAk0hSGl4fLTx+MB3LRD +R/h59+JATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZRP3JQAKCRCcnaoHP2RA2dYrCA CO5TgKgITfqgA+lj4x64uTVQHKzhHpSPPD6NNiafZkszAYkIkiOC/1j1vERuvZm4+FwdHqB7D0BBwW e3gjBvqhiCgQwv3/+JOaHGCQBhxb+3nlPSDLNulwAl/w7qBEre/B93mC5naEV58uCF/m59HQscatzX DKq3crirY01XE9eHNh4jXLit9TFiZFN+qGTQtPWx3zptAKz72u8dBrZAnQXtBBACI67eTm2BeoQyAc Zs+0dPVqT7lrnm5WmtnI3Sv3F+kZKGV2WSor4yhQnGmUbQptp51I7twr8HlXpUBnA14vUtzRXBrkfr l54aU1ckgv08LxPiobVKJaHDBQ5z6O X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Convert f2fs to use bdev_open_by_dev/path() and pass the handle around. CC: Jaegeuk Kim CC: Chao Yu CC: linux-f2fs-devel@lists.sourceforge.net Acked-by: Christoph Hellwig Reviewed-by: Christian Brauner Signed-off-by: Jan Kara --- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 6d688e42d89c..3878288122ee 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1234,6 +1234,7 @@ struct f2fs_bio_info { #define FDEV(i) (sbi->devs[i]) #define RDEV(i) (raw_super->devs[i]) struct f2fs_dev_info { + struct bdev_handle *bdev_handle; struct block_device *bdev; char path[MAX_PATH_LEN]; unsigned int total_segments; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a8c8232852bb..027c3ee03985 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1562,7 +1562,7 @@ static void destroy_device_list(struct f2fs_sb_info *sbi) for (i = 0; i < sbi->s_ndevs; i++) { if (i > 0) - blkdev_put(FDEV(i).bdev, sbi->sb); + bdev_release(FDEV(i).bdev_handle); #ifdef CONFIG_BLK_DEV_ZONED kvfree(FDEV(i).blkz_seq); #endif @@ -4198,7 +4198,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) for (i = 0; i < max_devices; i++) { if (i == 0) - FDEV(0).bdev = sbi->sb->s_bdev; + FDEV(0).bdev_handle = sbi->sb->s_bdev_handle; else if (!RDEV(i).path[0]) break; @@ -4218,13 +4218,14 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) FDEV(i).end_blk = FDEV(i).start_blk + (FDEV(i).total_segments << sbi->log_blocks_per_seg) - 1; - FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, - mode, sbi->sb, NULL); + FDEV(i).bdev_handle = bdev_open_by_path( + FDEV(i).path, mode, sbi->sb, NULL); } } - if (IS_ERR(FDEV(i).bdev)) - return PTR_ERR(FDEV(i).bdev); + if (IS_ERR(FDEV(i).bdev_handle)) + return PTR_ERR(FDEV(i).bdev_handle); + FDEV(i).bdev = FDEV(i).bdev_handle->bdev; /* to release errored devices */ sbi->s_ndevs = i + 1;