Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1071169rbb; Sun, 25 Feb 2024 18:40:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9zoCxvFe3NqnBSSlf8PnBXqtPue+ZSpcj0iSkN7fCZTFrWEoMl8Tl/HBIb/G5Siuky3vHR8zgJgGp6s3D6It4wC94YTYy2C1EXaEkcQ== X-Google-Smtp-Source: AGHT+IFtJnaDIkWateIzypiFliTtrdIJvfFSvMeQD7gKjdRnHCyRqzPPfPpmAKWEPiREzBEc4XyA X-Received: by 2002:a05:6a21:394c:b0:1a0:f7d0:e673 with SMTP id ac12-20020a056a21394c00b001a0f7d0e673mr2018802pzc.3.1708915250991; Sun, 25 Feb 2024 18:40:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708915250; cv=pass; d=google.com; s=arc-20160816; b=UiDz19/6kpGBwmUXjTsELAbwDw9YTl8Fqj6PxZTZcSHMpXJZlr2JV8/xzU09UEIji5 Gk8+MmYcJwlNcGxdTFBUWWFzWD8D6X0nklEh9Nl3VBd1knZ0BGVF/6ZiXkmblJ48WkmS T9zacI0isCbhd6ElE96/2kNaO27Od++qHx1MhDJh+RH7VGtP3TKxqYTj9pf+ljtcq3J9 XgdlyqCarag2sxuO8fdQzRuTeee8huIhgDIncmcS8nWut/SrXE3YJh1/1oYBE9ZYYNcz m5L9G7uXd2hiTAspHQUNAzOiN2p2pyUE1k+2ObmNIc3wM+O2AoblmVZz2zyrvqUNUkEI kKaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=cZ4kvREKEeE8AWMScKwJNIrDH2T4AukCvFXoUmAlvhc=; fh=PHq4OuhOUUP7V1I+gDdMCZNzaT4vH9shSoLBu78e8bA=; b=MxT1bXl0BaG4RSo4fPxUDBNCqe7h44hseH/XNF0XtfeY5gTOp46nO04GTzhAgGBY0/ pz+sJISo0iBPWmsg5QaVTtjhc87mk+QZSqBY8rzip5iOp0X2Z1dY3VJwrJiajXid42GR XutZ0uMmTgl8Wym0Koe6rovdBhRWVGc5p1dlJn//lZemJSNrP3soIK0SLSp06YQPkigZ UlKYBxq+tFs7Z7IJr+fSVFb4N7TY6khIKL3xdI3Pqtpw6oVywnMknKX7aKtopafTfPR7 kmtNjnuVc0Djwnskky9FXHTzu6HRmic0Ac72KOaIrMDx8eYpbhQNy2QSS+X0wd5GFCP2 K1Ww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="F6+HRb/9"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80417-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80417-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f10-20020a170902ff0a00b001dca8734d1asi342038plj.368.2024.02.25.18.40.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 18:40:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80417-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="F6+HRb/9"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80417-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80417-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 927E6281592 for ; Mon, 26 Feb 2024 02:40:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72265F4EE; Mon, 26 Feb 2024 02:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="F6+HRb/9" 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 9749C817 for ; Mon, 26 Feb 2024 02:40:45 +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=1708915245; cv=none; b=ruTV0J6OW3EOtDacZgXJQ3d53zHCtc3emhdjaneB15KibTsmfMXw0EtdIbJjv3+oeEMjp7E6AfTVv3i5K+r3ual9V62qBJHOXKZ9Yx625hW5JWVNK1jH7a0nwyceoslcoFMVBm6CirC4eK8ghJ0BqvLiQWLcQ71ynALtDvZRpag= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708915245; c=relaxed/simple; bh=DuGF9S4m4uhmiHy72DnJgIonHHmX99UDPQZHNKqVFP4=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=Xz+uC5XU3PjJMSWx3OElauLs9dkQuvur5FBzqeQ479uEJm+KFHn/Ke+TWZZSRmIAN8CeYPhLrR8cdv8HcXbBAd9AX2dMEOsDzppoSCCeymQYx4wQ9uhd5gNqX7A4D+vDHCy7MoC0VXMd7rzrMQ1aZjnRGkhkOVPNWMSvdYqqNsM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=F6+HRb/9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3693CC433F1; Mon, 26 Feb 2024 02:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708915245; bh=DuGF9S4m4uhmiHy72DnJgIonHHmX99UDPQZHNKqVFP4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=F6+HRb/9hWHnekgZ+zmflcvQfEybBYrxw8KGD0fT7IoNYR+T09ePn8ZhQqQpmAKCt T71rbKStsjrTOarQmZhP7H4NFyyLWgr6iJkv04hsYvOfZgVKPC62tyPd2EV4L9C8Bg SpnS/gVfqrZYUJKm7g6RhMSmBiQbvyIs69lA/8oLxhKW+hbL1aIElUc2GvuWAv4NUi sGPYkLTPb1K9S2zQY5LHfeEqBXhM5BESicI/1A/ThQQeEINVbVmd2EEf4r+/JCj7J1 mDvS0zf9iEmNaDgyLsZRJLnQkHpah6zgr6BjQdn2rgYh45nlJLSMtJcfzRs+o1icyv inYsj1VB/ehjA== Message-ID: Date: Mon, 26 Feb 2024 10:40:41 +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 1/5] f2fs: check number of blocks in a current section Content-Language: en-US To: Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20240223205535.307307-1-jaegeuk@kernel.org> From: Chao Yu In-Reply-To: <20240223205535.307307-1-jaegeuk@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/2/24 4:55, Jaegeuk Kim wrote: > In cfd66bb715fd ("f2fs: fix deadloop in foreground GC"), we needed to check > the number of blocks in a section instead of the segment. > > In addtion, let's check the entire node sections when checking the avaiable > node block space. It does not match one to one per temperature, but currently I tested this patch w/ testcase in [1], it doesn't complain. [1] https://bugzilla.kernel.org/show_bug.cgi?id=215914 > we don't have exact dirty page count per temperature. Hence, use a rough > estimation. Do we need more accurate per-temperature dirty node count for extreme corner case? e.g. node_blocks is counted from hot dirty nodes, and current hot_node log has no enough free space for it. Thanks, > > Fixes: cfd66bb715fd ("f2fs: fix deadloop in foreground GC") > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/segment.h | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h > index 3edd3809b6b5..15bf5edd9b3c 100644 > --- a/fs/f2fs/segment.h > +++ b/fs/f2fs/segment.h > @@ -561,23 +561,23 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi, > unsigned int node_blocks, unsigned int dent_blocks) > { > > - unsigned int segno, left_blocks; > + unsigned segno, left_blocks; > int i; > > - /* check current node segment */ > + /* check current node sections, which counts very roughly */ > + left_blocks = 0; > for (i = CURSEG_HOT_NODE; i <= CURSEG_COLD_NODE; i++) { > segno = CURSEG_I(sbi, i)->segno; > - left_blocks = f2fs_usable_blks_in_seg(sbi, segno) - > - get_seg_entry(sbi, segno)->ckpt_valid_blocks; > - > - if (node_blocks > left_blocks) > - return false; > + left_blocks += CAP_BLKS_PER_SEC(sbi) - > + get_ckpt_valid_blocks(sbi, segno, true); > } > + if (node_blocks > left_blocks) > + return false; > > - /* check current data segment */ > + /* check current data section for dentry blocks. */ > segno = CURSEG_I(sbi, CURSEG_HOT_DATA)->segno; > - left_blocks = f2fs_usable_blks_in_seg(sbi, segno) - > - get_seg_entry(sbi, segno)->ckpt_valid_blocks; > + left_blocks = CAP_BLKS_PER_SEC(sbi) - > + get_ckpt_valid_blocks(sbi, segno, true); > if (dent_blocks > left_blocks) > return false; > return true; > @@ -626,7 +626,7 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, > > if (free_secs > upper_secs) > return false; > - else if (free_secs <= lower_secs) > + if (free_secs <= lower_secs) > return true; > return !curseg_space; > }