From patchwork Wed Apr 10 12:38:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 13624224 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4902CD128A for ; Wed, 10 Apr 2024 12:39:17 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1ruXER-0005vy-Kp; Wed, 10 Apr 2024 12:39:15 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ruXER-0005vr-0s for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Apr 2024 12:39:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uebJnwGPMFuzJkWdsTeZ6spREWfXShLiiPg/TwV8BHk=; b=Dv9N1bHKrmHkB04qI0L4mDHAZZ 1gIYU1f2Ej8+GVpZuftyrNI74NCCcgP4tk6c/h6iF/DUh0d5QeUG4xm4Z6gW4jCG1HxAPsOsK+X4g FZCOSBwIP1IMJnVlC1ZrKk/7oYoZoTSvGRNb7Ii0eOsgBsP8za/aN0eAjWrLxvglFe6E=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=uebJnwGPMFuzJkWdsTeZ6spREWfXShLiiPg/TwV8BHk=; b=k pC5QS3YBXjcMNTiLxZJM0X+907PTM/g1iMdIOg4bbXfoD3MP4kBmI3s2r1SdmI6grYKPtKe305t4Z /vrNDTM2zvQpXALuMiZIkDMjoqrneuTpMmUauGnySdc7mp5rwIWcEqaPtO/c9XtcnarV54pVLIT72 QQMa6BG4OGepxDnk=; Received: from mail-tyzapc01on2135.outbound.protection.outlook.com ([40.107.117.135] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1ruXEP-0002P3-Ve for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Apr 2024 12:39:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xc2JW/6hkb5kkJxUOGPspcrEfGNChCmdCrMq74p/ehRvTCF1vWIxFfmFGpSzpeAZfP8N3qQBLdEKmKFID243w6CtlDb7o2Edwa79ybM/SkweboOYF8KAU/Eyh+TUF2N+jFWJukuHKd2vh4gE77Xyb/+wvR6qF09eaS//1QlPGtJVaITLi4t++X7F0V3bgQbwzFciKrplvN36oI7QE7U8rf85Ma/ZQAXbV+ihjGE14MfQKUmL+eKmaItQCDqMWydfiCp25hcq9Wp+nb8fiAAhKQuZT8IziNEavcKUhkX3rA8KfDo9kNOgki1AMFyPUOyl2aEUzzx6AmmL2eVbSlPLFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uebJnwGPMFuzJkWdsTeZ6spREWfXShLiiPg/TwV8BHk=; b=Hw2zb2OXFgK2GC3FVmcT/NTnGxfGZJCS+hH3/hou6JKlF3Xk/NR7BHmQ58F0uD0WjigmFNNIUiA6d/uDljB0EIwh0G3ewvw4MsGiw+vcnd6RreKmvUnxrMacOZQjyFLTTdrMCNFrZLPUjViCKxNI4d7y9krzPfXlAFhoUWXM7X/uMPDtOnCZ6TOXs5eImJox32+aDbm3EQz/riXmu1LnmP0dxlAvnkx27s9gJ1Tg/rA2q8Gb8PMR1RsLyZzYAQlcKJ4se1OwwprDJNTuLBRbWGS9dS5bG6ZdzhkNQgKbE/WQgP54Zh8X1psTufWxgibsGUv5e2zw05fBbWAeQcANdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uebJnwGPMFuzJkWdsTeZ6spREWfXShLiiPg/TwV8BHk=; b=UMc4bxdI8tF6ELwKpLYiUoTKZuaRgWW1lD2DwbtkiTxzg2zgMYPatx+8muTAiTUAYQcdoQwtin2ilpt+x2PdjAlUPPBor4OU2igWynnuGUFSTr7dHIjlpIjHwgbKvD3fFUysgtekZK9z8XOB+ve4ZPwpxCHezUxQxUXtG9FAL7A= Received: from SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) by TYZPR02MB6882.apcprd02.prod.outlook.com (2603:1096:405:29::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 10 Apr 2024 12:39:05 +0000 Received: from SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::a99e:50b1:70a6:3afc]) by SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::a99e:50b1:70a6:3afc%4]) with mapi id 15.20.7409.042; Wed, 10 Apr 2024 12:39:05 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Wed, 10 Apr 2024 20:38:48 +0800 Message-Id: <20240410123848.1291821-1-shengyong@oppo.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: SI2PR01CA0034.apcprd01.prod.exchangelabs.com (2603:1096:4:192::9) To SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR02MB6014:EE_|TYZPR02MB6882:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YGFmJ51ubQ7CKstPfnfMYi1Prdr9ye2Y+iPSOXMYIQpd9UoutkWDbC3jFF4HDmh62vgjON6CLpIOBXuWkYR9VadWoq4/Pa3fLzjg7Ra2XH6zANdF+fbqLEdGML3wlOLPA4KNkoQ5k1kQSTC9XfulcM4MGIWtl9vpqxIAXXO0R2dPTjhMAlxevBnYUSWiSySFP7fjS5n5EADLEoeRmI4XzQrbzzxkAZHU1uDScaivQbdOViWRhZBOynf0HcaZRi9mGvDDuR7GTYoB3V9aqaqOqWl53xIJr+nX4woiOHnhRyCJByC70eUYsA0xg6IAGnUTc2SqnpdMIamElg2Q+AYQcFzUk0c89ImYSiCOhXHxhP+kF1KzKqVTsJYlnHNtKzL1/NjlmIgNGtQh171xnk+iXCVMCOF0SAiCU/E3gq+4ttC2NgxuqFnkcNt4TYAWr81k4LYp1wYedP0LA7JJHqauhfvXLz3fkZ4zWyyUGF9laOxqQNQy61LuNCiKPT7sRgWcs9Ni6gQeQT6gtUrsAhgJjnKfTkR/zF5fEVSR7RD2oZK3blkDRpO04QclegSwlacAib2eQuZGAeCsJwEjU8lZLL/29Stmv7fPEHViqB0WY3phwJVlmEd5rsFgfencxe/IagltRvKSjt21V5R6HWtnhoTw1JjWpdIkeOPjhCOxNAeV4KAe33DWmiaFqtvwfw515lhCXsoAazHzUvckO/9jlw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEYPR02MB6014.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: utNwIwiSJwwhDji/rsznXhCDPSdvC/2J9gmWmbyfaVcecLB0Tzvm0kcLOLRrREF4z9Rz2wwt/VIASF3C8+XeQaMJkUanhKF/7L4eQfhbIOq/C74RCy9vwZ1od1F86pd392ZJ51TXpeRShNwO5TSqUeLoAZhx6yAqGafExnDluFENR+q3A0vDJPkgvSfWJbx4CSqpCZAQl4kEFO38h7/dNmOiSAXX2S+E2ek40lLFYTtNqGXCqSSI1qDNlQNzVClsvqBet0h2ZwrP57lr0CHSwDWdqllx4KoUCFMc8I2CMSoONWyvYRlT4ROj/8NLNUdfx2xTiVxdRb24JRg/2CaAygb3aHrfbZleldef91vBuprMbCIXMQAbwXwyG1Jkdy8jdXwcovCRqewqozetswu6zwvmLit/Yv7ekECZ47rRqDcdqxp/2BsxX3AOzOMboMpgGDuIIjgvhkN3D8ermsAGr0vpGV+5QZ8yjUOBRfXH8dvisi5IODJD53iA9lAskacwBd+HV4OpK6m66l7hwGe+65TeJsZWCYsiu+QCWs6AAS0cdf1Aum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 7265a883-3554-4aaa-df6a-08dc595b352b X-MS-Exchange-CrossTenant-AuthSource: SEYPR02MB6014.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2024 12:39:05.0508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Gk50CO9Dz0fhiV+Inf1KO3A8cY8fN8AbkTmg8gdmHrnzYs2xPQEawr45SIXwgLuo9KDp0kd+BxCaCkQRn36RIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR02MB6882 X-Headers-End: 1ruXEP-0002P3-Ve Subject: [f2fs-dev] [PATCH] mkfs.f2fs: align each device to zone size X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sheng Yong via Linux-f2fs-devel From: Sheng Yong Reply-To: Sheng Yong Cc: linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net For multiple device, each device should be aligned to zone size, instead of aligning the total size. Signed-off-by: Sheng Yong Reviewed-by: Chao Yu --- mkfs/f2fs_format.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index 8f632f8..9e1b0d6 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -296,17 +296,19 @@ static int f2fs_prepare_super_block(void) for (i = 0; i < c.ndevs; i++) { if (i == 0) { c.devices[i].total_segments = - (c.devices[i].total_sectors * + ((c.devices[i].total_sectors * c.sector_size - zone_align_start_offset) / - segment_size_bytes; + segment_size_bytes) / c.segs_per_zone * + c.segs_per_zone; c.devices[i].start_blkaddr = 0; c.devices[i].end_blkaddr = c.devices[i].total_segments * c.blks_per_seg - 1 + sb->segment0_blkaddr; } else { c.devices[i].total_segments = - c.devices[i].total_sectors / - (c.sectors_per_blk * c.blks_per_seg); + (c.devices[i].total_sectors / + (c.sectors_per_blk * c.blks_per_seg)) / + c.segs_per_zone * c.segs_per_zone; c.devices[i].start_blkaddr = c.devices[i - 1].end_blkaddr + 1; c.devices[i].end_blkaddr = c.devices[i].start_blkaddr + @@ -321,8 +323,7 @@ static int f2fs_prepare_super_block(void) c.total_segments += c.devices[i].total_segments; } - set_sb(segment_count, (c.total_segments / c.segs_per_zone * - c.segs_per_zone)); + set_sb(segment_count, c.total_segments); set_sb(segment_count_ckpt, F2FS_NUMBER_OF_CHECKPOINT_PACK); set_sb(sit_blkaddr, get_sb(segment0_blkaddr) +