Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1043876rdb; Tue, 30 Jan 2024 06:29:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCGzXFGqcnYs8bJyvjiiDPWzK2szPFt49AO/Aw1WOBvjHnu5NAdSnQW5gCwhyAlJbw+ZhR X-Received: by 2002:a17:906:4a11:b0:a31:54f:4fa6 with SMTP id w17-20020a1709064a1100b00a31054f4fa6mr7526807eju.29.1706624984328; Tue, 30 Jan 2024 06:29:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706624984; cv=pass; d=google.com; s=arc-20160816; b=gy8jcua9HuKhB26oZ2xFzzz+PiOttLd2Dah8MOdeFwTIIZP+Mx+MAirkjUE90krl04 p8v4bSlybwoGTi4+wib0YfNIjinLPGMJ7GqyeqRBWZcn6euoB9KtF4oNLwSixxy4nLt/ Ib23EWWJphrTl+WYSbZUBzMWDtiivKjqGzdg6ieBgt6+u66qB9Q57rAJhLFAiN1M4Udq 432u8qA7Mx7KEm6djIp0tqJK9C+sNHdI3OtWN31v7xM6Bz7fenvRlJg0Baleazx7p1// d6npLc9CCcU2fVyH9mKgPYLyH5zfbnZUOcYXG6gQ8wRO3+wmhBrZlriMhsIamqqDqAXD rZhg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=1pvV2bEyvE5kqXxxvVm66SvlKih+lITCLcVZXn3Ykp0=; fh=xZLmnXK+K5SU6ytudgxrkvtIXoMVIKYdiCJY3Ox/I/U=; b=NnPWfTfSEljz33gaT2HQUEKkHPOmmyqwIibPe83rUQ2ROjCbx/IFWPwXg2wezfwRh4 2soRgISWweo0hesPD+GswM55yFLakukowvfCRLRgHNs7E1+Gw2xkQdFc7+JZgxQpz9h5 9XcVHII0wZzwubTgAMkgMpS0l+ZXDgj7kDKLFDYC50A1YePleJ+tjadPpj10+B2uavzF Zk12zqv3klMRhBPWvK00yupH4oP0PLsW1eC1vxUfZj+gNQ+U2i4WlL7624Alq6AJRLxU d1mt7770szov0g38IghPqmRnq49Lr2ayTcIqqyFqCrDHhHhY/mlfwiwmSocy3SqiQJ1B hZHw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gdKdehbE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r22-20020a1709067fd600b00a3182cc0401si4606480ejs.916.2024.01.30.06.29.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gdKdehbE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E29B91F24E5C for ; Tue, 30 Jan 2024 14:29:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5E0B6DD1F; Tue, 30 Jan 2024 14:29:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gdKdehbE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5ABF6BB20 for ; Tue, 30 Jan 2024 14:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706624973; cv=none; b=hvG92Mu0dOFEMF1WZv8oKxSP7u+xAhsKpdInOQIfpY3Y6G6JWNZi1FSwouWsVWLtIAHj9rneOCj/+7fNvGxmZgWHa50lA7aRO4thwZAeOqCAFzbzIWpqlGMDhMJfEYomsQ2n/veAR8gXo2JctyK62UOUG4ItOkxLY5hTTeouniQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706624973; c=relaxed/simple; bh=KnPGMMxaf6TMJMYT3i9Zl9SSMDr+33/RimwM+rsX9rs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AHhSSDTzipSZnRFXYsEx756L+VwacN3Nr4exXwLeKlfKHDjDxLsShh2+jEzQDbnc9MG8c9TGQjQcdnYAZvVIv+UHGosBEq23CKsxJ8yCOr+gE4CbwtYkpH8BHerNmEnGramjgcOo0nyndQ/x081kUhSD04zODPdC1uST5ggLoOw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gdKdehbE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B756C433F1; Tue, 30 Jan 2024 14:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706624973; bh=KnPGMMxaf6TMJMYT3i9Zl9SSMDr+33/RimwM+rsX9rs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=gdKdehbEQY9Okls+GpFDmjtaa+626FfhvMX+7nKHmRMPLswzaTX0GV8ip8cvVNmGT 6+igRmtgtwVsA104YSN7ypCJDu/jaCjjmyUVkdHQuZVZPFZcxe+LDFkaAG3KHILsQY fSK9D8YCPGCGL37uT7VTlVXMTVfOfUNIvifWBpxshYH0As6u/rzpapTy2GLqOOe+K0 AJ+WXOeoDEJzQmjxaiWWChkpHiFgsUQIyUE2ebJUaDFdb66F8a6AWvAzCU/7I0EpSD aPvuyYPBuVOB7MSikE9mvLkV3mEsuzZCaRadlxqZ0aDxuVfmQW28NS/xipXgxXx1jS zI5DAbV2K0Uzw== Message-ID: Date: Tue, 30 Jan 2024 22:29:32 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [f2fs-dev] [PATCH] f2fs-tools: allocate logs after conventional area for HM zoned devices To: Daeho Jeong Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong , Yongpeng Yang References: <20240117230032.2312067-1-daeho43@gmail.com> Content-Language: en-US From: Chao Yu Autocrypt: addr=chao@kernel.org; keydata= xsFNBFYs6bUBEADJuxYGZRMvAEySns+DKVtVQRKDYcHlmj+s9is35mtlhrLyjm35FWJY099R 6DL9bp8tAzLJOMBn9RuTsu7hbRDErCCTiyXWAsFsPkpt5jgT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KTPgB1/p52GPpoP/2LOn/5KSkGHGmdjzRoQHBTdm2YV1YwgADg52/mU68Wo6viStZqcVEnX 3ALsWeETod3qeBCJ/TR2C6hnsqsALkXMFFJTX8aRi/E4WgBqNvNgAkWGsg5XKB3JUoJmQLqe CGVCT1OSQA/gTEfB8tTZAGFwlw1D3W988CiGnnRb2EEqU4pEuBoQir0sixJzFWybf0jjEi7P pODxw/NCyIf9GNRNYByUTVKnC7C51a3b1gNs10aTUmRfQuu+iM5yST5qMp4ls/yYl5ybr7N1 zSq9iuL13I35csBOn13U5NE67zEb/pCFspZ6ByU4zxChSOTdIJSm4/DEKlqQZhh3FnVHh2Ld eG/Wbc1KVLZYX1NNbXTz7gBlVYe8aGpPNffsEsfNCGsFDGth0tC32zLT+5/r43awmxSJfx2P 5aGkpdszvvyZ4hvcDfZ7U5CBItP/tWXYV0DDl8rCFmhZZw570vlx8AnTiC1v1FzrNfvtuxm3 92Qh98hAj3cMFKtEVbLKJvrc2AO+mQlS7zl1qWblEhpZnXi05S1AoT0gDW2lwe54VfT3ySon 8Klpbp5W4eEoY21tLwuNzgUMxmycfM4GaJWNCncKuMT4qGVQO9SPFs0vgUrdBUC5Pn5ZJ46X mZA0DUz0S8BJtYGI0DUC/jAKhIgy1vAx39y7sAshwu2VILa71tXJ In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/1/29 23:47, Daeho Jeong wrote: > On Sun, Jan 28, 2024 at 5:27 PM Chao Yu wrote: >> >> On 2024/1/27 2:17, Daeho Jeong wrote: >>> On Thu, Jan 25, 2024 at 5:27 PM Chao Yu wrote: >>>> >>>> On 2024/1/26 0:25, Daeho Jeong wrote: >>>>> On Wed, Jan 24, 2024 at 7:34 PM Chao Yu wrote: >>>>>> >>>>>> +Cc Yongpeng Yang >>>>>> >>>>>> Daeho, >>>>>> >>>>>> Yongpeng reports a potential issue: if c.devices[0].total_segments is >>>>>> larger than segments of mainarea, c.cur_seg[CURSEG_HOT_NODE] will exceed >>>>>> end boundary of mainarea. Could you please check that? though it's a corner >>>>>> case. >>>>> >>>>> Can you elaborate more? >>>> >>>> Since c.cur_seg[CURSEG_HOT_NODE] is an offset started from main_blkaddr. >>> >>> Oh, Got it. >>> Then, how about this? >>> >>> c.cur_seg[CURSEG_HOT_NODE] = c.zoned_model == F2FS_ZONED_HM ? >>> (c.devices[1].start_blkaddr - >>> get_sb(main_blkaddr)) / c.blks_per_seg : 0; >> >> Better, but log header should align to start blkaddr of zone? > > It's already aligned here. Ah, thanks for the explanation. :) Thanks, > > if (c.zoned_mode && c.ndevs > 1) > zone_align_start_offset += > (c.devices[0].total_sectors * c.sector_size) % > zone_size_bytes; > > ... > > for (i = 0; i < c.ndevs; i++) { > if (i == 0) { > c.devices[i].total_segments = > (c.devices[i].total_sectors * > c.sector_size - zone_align_start_offset) / > segment_size_bytes; > 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].start_blkaddr = > c.devices[i - 1].end_blkaddr + 1; > > ... > > total_meta_zones = ZONE_ALIGN(total_meta_segments * > c.blks_per_seg); > > set_sb(main_blkaddr, get_sb(segment0_blkaddr) + total_meta_zones * > c.segs_per_zone * c.blks_per_seg); > >> >> Thanks, >> >>> >>>> If c.cur_seg[CURSEG_HOT_NODE] was assigned w/ c.devices[0].total_segments, >>>> and c.devices[0].total_segments is larger than segments of mainare, >>>> c.cur_seg[CURSEG_HOT_NODE] will exceed the end boundary of mainarea. >>>> >>>> c.cur_seg[CURSEG_HOT_NODE] = c.zoned_model == F2FS_ZONED_HM ? >>>> c.devices[0].total_segments : 0; >>>> >>>>> In the case of F2FS_ZONED_HM, we have the devices[1]. >>>>> Do you mean the case we format the filesystem intentionally smaller >>>>> than what devices have? >>>> >>>> I mean blew case: >>>> device[0]: conventional device size = 10240 MB >>>> device[1]: zone device size = 2 MB >>>> >>>> Thanks, >>>> >>>>> >>>>>> >>>>>> On 2024/1/18 7:00, Daeho Jeong wrote: >>>>>>> From: Daeho Jeong >>>>>>> >>>>>>> Make to allocate logs after conventional area for HM zoned devices to >>>>>>> spare them for file pinning support. >>>>>>> >>>>>>> Signed-off-by: Daeho Jeong >>>>>>> --- >>>>>>> mkfs/f2fs_format.c | 3 ++- >>>>>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c >>>>>>> index f2840c8..91a7f4b 100644 >>>>>>> --- a/mkfs/f2fs_format.c >>>>>>> +++ b/mkfs/f2fs_format.c >>>>>>> @@ -557,7 +557,8 @@ static int f2fs_prepare_super_block(void) >>>>>>> c.cur_seg[CURSEG_COLD_DATA] = 0; >>>>>>> c.cur_seg[CURSEG_WARM_DATA] = next_zone(CURSEG_COLD_DATA); >>>>>>> } else if (c.zoned_mode) { >>>>>>> - c.cur_seg[CURSEG_HOT_NODE] = 0; >>>>>>> + c.cur_seg[CURSEG_HOT_NODE] = c.zoned_model == F2FS_ZONED_HM ? >>>>>>> + c.devices[0].total_segments : 0; >>>>>>> c.cur_seg[CURSEG_WARM_NODE] = next_zone(CURSEG_HOT_NODE); >>>>>>> c.cur_seg[CURSEG_COLD_NODE] = next_zone(CURSEG_WARM_NODE); >>>>>>> c.cur_seg[CURSEG_HOT_DATA] = next_zone(CURSEG_COLD_NODE);