Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1224519rwd; Wed, 31 May 2023 11:00:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4gcc1Fb7rS7SSieHk1sKr3YChFnJCQwNq7WXDzwvcssW9Al7Rai/ZpiSpizTeSoDtCevgb X-Received: by 2002:a17:902:da81:b0:1b0:5ce9:adc7 with SMTP id j1-20020a170902da8100b001b05ce9adc7mr6708139plx.28.1685556028903; Wed, 31 May 2023 11:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685556028; cv=none; d=google.com; s=arc-20160816; b=a4xYV9HnTSLKrjQ5oWr97D3+SxqimAKba1rTSJIKfZ14DbGn6F/hZ/NScxmdw9BRXx VWJwyK0srjdpwl0C2GztCypFM2J+iXTuX+Z2+TvJymByOHu+UZfENOM2r/odgE5DzOuM hb0+jCxuNeNl13/JFJ6fLyA1M5DJnkh5J/siDkRMNtNcth76u9sMm2zn8PLg2lmlc4RU 2udnTx2T0IQc6GAjWkWDbNUKNpWeihI3N4D+fyV8wb2n/gycjnpkuiDLGLWexoQCl2bx nVqeBXYhdZ9BlZf5DVFb4r0ElYiAkGXPTUQFT/X7/nN4Kspy5exBsqGA3e+Nn04YQ7fY FJzw== 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; bh=kfMuDdWL1b4kSqYmj4dPZPS2+HxbmlkGgksoSf7cEdM=; b=nK+8ODwpm39MObVo4nh+4hcD6OKQjCuiF3+YhDgB7/ZqtqKOrNSajXH2AckDtElxXu Xe9sP3118QDeu8gAmo7sVA9fjL87xEzE0G2n5XY9HNXXIY2TC8cXDJCY0g91nqlLT6WY ZH6GeouR1A/ZfoQM5Bm/nAFx7K+6rECBc/BHaQRhsR15Gbwzk7wl989XQtfFdd/YbXmG h1aNZYYkoC+KyoHIetc/VbKOKGepTXhoxvYy9Qw50dcA1davDcUo8p5xntk+z01LM0UF 2PhHMIbKh9DHROadZNZBGvjUzbd7/7P3X1g0x7JeTn9D5inZu3u8vpIKio3VA/FAEtZg FcuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=GCbj2dgt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a170902654600b001a6f0eab385si1313752pln.55.2023.05.31.11.00.14; Wed, 31 May 2023 11:00:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=GCbj2dgt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbjEaRwi (ORCPT + 99 others); Wed, 31 May 2023 13:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjEaRwh (ORCPT ); Wed, 31 May 2023 13:52:37 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91DEF125 for ; Wed, 31 May 2023 10:52:36 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-64d24136685so21163b3a.1 for ; Wed, 31 May 2023 10:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685555556; x=1688147556; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kfMuDdWL1b4kSqYmj4dPZPS2+HxbmlkGgksoSf7cEdM=; b=GCbj2dgtrPxM81YowcETNQ7Tw7u17jOm8NgY0XIvDAhknW7UNNBsch0YtMcFekc361 6/Wad6Tz8fsQQg1eYGqg+85i9VG6EoFd6QO9uosS61SXofS450nU07/j9MSQ2VmiY2rn wad7XwqFrzdKhFr0cxIPBYy2E4V+2OaCfGyxCT1DSVfC3AkjQrqBZY1ueOxk16GDKHTR epPOhOIRe/Wua1Wzbeb4V1LkFHQT7UseSwek0eF6bjM2QuoopWANatm8LMmqsnlGCRdo DOmoMPQwsefZBwyj1nD7ejisJfYydRbcVQ3AitRWyz4lihhFvRGrbiQcvveSjJtkItu9 8Vow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685555556; x=1688147556; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kfMuDdWL1b4kSqYmj4dPZPS2+HxbmlkGgksoSf7cEdM=; b=DjwlCCHUg0gPMfqN1MjutLC04H0Cczx3w64BOqZk9Vf81r+C7JtyCtuIL2+NI2gJn3 Tw9v56EnIYkTS6eQJfjruC70MpqSuK2DBUm4mLxmNkit0rdDmFRPciwAim+gvvv2ApL/ wMIKWDEC1QSKpKS4kEfE5PG+aHt3K95CiO/pPIbDv0h6RZKs03rYmTCoTHOAoMCxng9E pJbr4ltVLRT+etAgce7OzUfqtvk3Yfq2ydvc7MYAGtyKwsBgwDqYl84BwqFuEBgMv7g7 qGcb3BNx+9eLRt4zS3DYMBG8qgdklcxMf9p+UvawW6qlhfN0Umy4uPDZYJ9iazkaWUh0 FSbg== X-Gm-Message-State: AC+VfDxuuUrsgOGiBdjZ8UlHZW3XE7FJOz7+FKITyXQuDCmVw2/4LVfd walK8V6YwYED1MKU9kIvVMwE8N1VirI= X-Received: by 2002:a05:6a00:2393:b0:64d:2a87:2596 with SMTP id f19-20020a056a00239300b0064d2a872596mr9221088pfc.10.1685555555629; Wed, 31 May 2023 10:52:35 -0700 (PDT) Received: from daehojeong-desktop.mtv.corp.google.com ([2620:15c:211:201:3d32:dc28:3a98:9cdf]) by smtp.gmail.com with ESMTPSA id bm17-20020a056a00321100b0063f1a1e3003sm3587517pfb.166.2023.05.31.10.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 10:52:35 -0700 (PDT) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong Subject: [PATCH] f2fs-tools: remove power-of-two limitation of zoned device Date: Wed, 31 May 2023 10:52:13 -0700 Message-ID: <20230531175214.3561692-1-daeho43@gmail.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, TVD_SUBJ_WIPE_DEBT,T_SCC_BODY_TEXT_LINE autolearn=no 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-kernel@vger.kernel.org From: Daeho Jeong Remove power-of-two limitation for zoned device, since zoned devices don't have it. Signed-off-by: Daeho Jeong --- fsck/mount.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fsck/mount.c b/fsck/mount.c index 4c74888..851a62b 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -56,19 +56,17 @@ static int get_zone_idx_from_dev(struct f2fs_sb_info *sbi, { block_t seg_start_blkaddr = START_BLOCK(sbi, segno); - return (seg_start_blkaddr - c.devices[dev_idx].start_blkaddr) >> - log_base_2(sbi->segs_per_sec * sbi->blocks_per_seg); + return (seg_start_blkaddr - c.devices[dev_idx].start_blkaddr) / + (sbi->segs_per_sec * sbi->blocks_per_seg); } bool is_usable_seg(struct f2fs_sb_info *sbi, unsigned int segno) { - unsigned int secno = segno / sbi->segs_per_sec; block_t seg_start = START_BLOCK(sbi, segno); - block_t blocks_per_sec = sbi->blocks_per_seg * sbi->segs_per_sec; unsigned int dev_idx = get_device_idx(sbi, segno); unsigned int zone_idx = get_zone_idx_from_dev(sbi, segno, dev_idx); - unsigned int sec_off = SM_I(sbi)->main_blkaddr >> - log_base_2(blocks_per_sec); + unsigned int sec_start_blkaddr = START_BLOCK(sbi, + GET_SEG_FROM_SEC(sbi, segno / sbi->segs_per_sec)); if (zone_idx < c.devices[dev_idx].nr_rnd_zones) return true; @@ -76,7 +74,7 @@ bool is_usable_seg(struct f2fs_sb_info *sbi, unsigned int segno) if (c.devices[dev_idx].zoned_model != F2FS_ZONED_HM) return true; - return seg_start < ((sec_off + secno) * blocks_per_sec) + + return seg_start < sec_start_blkaddr + c.devices[dev_idx].zone_cap_blocks[zone_idx]; } -- 2.41.0.rc0.172.g3f132b7071-goog