From patchwork Tue Jul 4 12:21:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 13301126 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 ED01BEB64D9 for ; Tue, 4 Jul 2023 12:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231732AbjGDMYL (ORCPT ); Tue, 4 Jul 2023 08:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231736AbjGDMXO (ORCPT ); Tue, 4 Jul 2023 08:23:14 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430E110F1; Tue, 4 Jul 2023 05:22:41 -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 9D49D2056F; Tue, 4 Jul 2023 12:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1688473346; 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=DCGhF7aG0ICnzzcrmQsOj1iUvKcFg3KjYUt2ITpurKA=; b=JYTQ4Qndf0rmIHWQ/Wge5YOAxgITvuWtSC+X+uxM8Ag+eytWbHShbtJoizWkc8GONChhT7 p+utlJCTK2JVn8+gf1M81Ir3Ds/I6wyAgcdJr6tv5z/C6VS1s5Icc2yeOcpoLNLajRekEt gtjyL1ikbFFqwFlfuaOkKDGf2HguPMU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1688473346; 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=DCGhF7aG0ICnzzcrmQsOj1iUvKcFg3KjYUt2ITpurKA=; b=7D4V23So0uda/luweBJxz11yl0lwco62tjFcKIjQ32NHEUu3+82UVHdsD4yrGrO9DrtUEl UHyuEvTZ+i1sFfCg== 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 8ADC613A26; Tue, 4 Jul 2023 12:22:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DyrgIQIPpGRZMAAAMHmgww (envelope-from ); Tue, 04 Jul 2023 12:22:26 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 2B6E1A0787; Tue, 4 Jul 2023 14:22:25 +0200 (CEST) From: Jan Kara To: Cc: , Jens Axboe , Christoph Hellwig , Jan Kara , Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH 24/32] f2fs: Convert to blkdev_get_handle_by_dev/path() Date: Tue, 4 Jul 2023 14:21:51 +0200 Message-Id: <20230704122224.16257-24-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230629165206.383-1-jack@suse.cz> References: <20230629165206.383-1-jack@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2324; i=jack@suse.cz; h=from:subject; bh=zY0vQIFWwXxZ7RHzAEqG6D4bDjhEcI3Cdr6fuyrfZKs=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBkpA7fQhkJvnMF8uP9W/ZbXYDJIo2ZlL1tAVBNnpLc tGLTdAmJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZKQO3wAKCRCcnaoHP2RA2ZwFB/ 9x2FfXI23LL9d4U0StfRUPWhB/1bRuiDcFEymT2N8DWjxiyNYTYniv/hG+AYiVk5fvwKPVPLtbeCWR SwTc296AoMYNt6OYTs5omCWTDrrGuU7/N9IyGZKlPDDKWCFlGUhR+GoQYC+p2MgWPo4MUyF/p5QXx9 NTG2SMoLXGFMMBE83HivzaIzqr84ckWTYdCbrXp32tkCttJqnAZrTdFSb3SPxL+PwNS5C+wpdyY/Xu xdpcXqd3W62aPcYj8imMu2V2aEknQm1o4YfBnsQ6cKANu+lft0AJ6gIdJkDd7ZjKRDtSZWL009oOjG lWB+GrHroIZAeQODGJDj4/Yp3JjPOY 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 blkdev_get_handle_by_dev/path() and pass the handle around. CC: Jaegeuk Kim CC: Chao Yu CC: linux-f2fs-devel@lists.sourceforge.net Signed-off-by: Jan Kara --- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index d211ee89c158..680874adb265 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1227,6 +1227,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 e34197a70dc1..570364954578 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1538,7 +1538,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->s_type); + blkdev_handle_put(FDEV(i).bdev_handle); #ifdef CONFIG_BLK_DEV_ZONED kvfree(FDEV(i).blkz_seq); #endif @@ -4024,9 +4024,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->s_type, NULL); + FDEV(0).bdev_handle = blkdev_get_handle_by_dev( + sbi->sb->s_bdev->bd_dev, + mode, sbi->sb->s_type, NULL); } else { /* Multi-device mount */ memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN); @@ -4044,13 +4044,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->s_type, - NULL); + FDEV(i).bdev_handle = blkdev_get_handle_by_path( + FDEV(i).path, mode, sbi->sb->s_type, 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;