From patchwork Wed Aug 23 10:48:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 13362102 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 C71E3EE49B0 for ; Wed, 23 Aug 2023 10:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233875AbjHWKuh (ORCPT ); Wed, 23 Aug 2023 06:50:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233896AbjHWKuX (ORCPT ); Wed, 23 Aug 2023 06:50:23 -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 A7127E7D; Wed, 23 Aug 2023 03:49:27 -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 2BC0022238; Wed, 23 Aug 2023 10:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1692787739; 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=2AUkHVYDDBg67q+3OD0qFSazOfyxTAI2542TIz3rbns=; b=ZXrZlNJ3g4AtXip0gcX9yOKeExtqThYsiSH/r5mRCx7snkGOAI4bxRyChbhpTyL+YexBdn bRYsTUSSyIdny4nYF6zpWcL5pY9mc1XOJHP7Tb+/3HMIMtj5otx7DOkSh/zpAhixApQL6x rd586/2JMwc1UfVFL6EJJw64zSt8XhI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1692787739; 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=2AUkHVYDDBg67q+3OD0qFSazOfyxTAI2542TIz3rbns=; b=m5WcXtUVe4h3za6ZijNlLIIyMKLAsIuwR1PjgVMTs0bVDdKI+wzWvV6vSq6kuDZNRA3ulW 67bI0IDo7GpnJSAQ== 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 1D3C613592; Wed, 23 Aug 2023 10:48:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wV8iBxvk5WRzIAAAMHmgww (envelope-from ); Wed, 23 Aug 2023 10:48:59 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 8D718A0799; Wed, 23 Aug 2023 12:48:57 +0200 (CEST) From: Jan Kara To: Christian Brauner Cc: Jens Axboe , , , 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, 23 Aug 2023 12:48:34 +0200 Message-Id: <20230823104857.11437-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=2284; i=jack@suse.cz; h=from:subject; bh=A8xzyyYYp7e3nycZMwh5um089G3sh6pF1T1fTnU+2b4=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBk5eQCpKEjjgiqB3ZA1c5TSrTxzQCLo0J9QrbxTBbl SsdwFCeJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZOXkAgAKCRCcnaoHP2RA2Yo7CA DYPCyhul0tth4sF/mXbVG+Z7Im4oaDJsjL/BvAEgOC/9sq+RuecArAuEaoYD1RvO49AHJHjPARmsuB xRWlPxNeZFWhePZeL17m7liT+2aykb1N9AsnJR1TSrr/HfCfMFNwsvnE3Hyo8H9hif+Ly/4DZubggh Xa1jU2D/7GK1eVnMKl0NqVABPx80+GL+4TiftnFI/vOMpIR4VnnB0M7fyH85Zv5zRWiTvUkrzEw5qa /CSDo9YDJ58zIAjq3QPYYLeBJ7E+3HCQwYsGT8/xlWjNrxCHYt040qaAeGvv9RjWXmh0krMUsBZW25 yQ9TU9vP6WqA3ZX3kKiLlX9ddWdazR 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 Signed-off-by: Jan Kara Reviewed-by: Christian Brauner --- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e18272ae3119..2ec6c10df636 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 aa1f9a3a8037..885dcbd81859 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1561,7 +1561,7 @@ static void destroy_device_list(struct f2fs_sb_info *sbi) int i; for (i = 0; i < sbi->s_ndevs; i++) { - blkdev_put(FDEV(i).bdev, sbi->sb); + bdev_release(FDEV(i).bdev_handle); #ifdef CONFIG_BLK_DEV_ZONED kvfree(FDEV(i).blkz_seq); #endif @@ -4196,9 +4196,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) if (max_devices == 1) { /* Single zoned block device mount */ - FDEV(0).bdev = - blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, mode, - sbi->sb, NULL); + FDEV(0).bdev_handle = bdev_open_by_dev( + sbi->sb->s_bdev->bd_dev, mode, sbi->sb, + NULL); } else { /* Multi-device mount */ memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN); @@ -4216,12 +4216,13 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) (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;