From mboxrd@z Thu Jan 1 00:00:00 1970 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 6D6D615530C for ; Tue, 17 Mar 2026 01:50: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=1773712245; cv=none; b=cCzUPzIaVM08fytx2ou9MVpxQ/fb2DKEbX7qXdUYOVcBvbmHg+BzZ0/sA/G2THKeqgFO5qiGnDcaAaLgDp8DVgTbbKXx/TgJd7UdQI6N/iFNGPgpAFemsLVTDXkojhHNAQtXnCD6ANH3reCgGO2FdKPAaMju2MeeuyZL2gX6qng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773712245; c=relaxed/simple; bh=77+S6pbGty8ki1+1cZsLqDbr/3mnZsIXW+R8WUtZUrY=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=gJmo91RuKAiwBzjDTTlA4p+cOrqBTSWaxavaioulg38iX5Sl9KMD/ssCh1XV6VzmSyzx+hBheryRxGJwrWj16+tpeI0cb5GxFT97j9pkSZXTycKjctQ260BpiH9X7FA+PKjw4XDZEY0ljYYPwmUn5sHpMZupRTtTxmAdL4H1/FU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oWcaV3Cw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oWcaV3Cw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92A47C19421; Tue, 17 Mar 2026 01:50:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773712245; bh=77+S6pbGty8ki1+1cZsLqDbr/3mnZsIXW+R8WUtZUrY=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=oWcaV3Cwmb6UADE4bjhQfGiY2G6NxvnPomB32Y7Ua6+nVbDSuofGuyS/EufOMz5RF TRRYSATW0yOf7vioxElcksJCgbv52sg3padzPLTOc+VlGYNiUSDUnRLe6POcBuhace M2N7Ov4581cFU/RReUhVK6/0I0/7ALuVbsvbufsCWT8K7tvAY7wOsith3JWhdXcsN+ GFt0GCmLBvEkY7TIPpxGs6aOiOj+iOqS/9Rs6cNaqIvCc7GSuTAT8V1eIahP2hY5cy ckfi2vBkvY2UDUg3X3jspf+HecMeO8Cls6Tt44FVsGdb8oCqp0vBM3Pktw9XU6ZLBC xt0lolMBqS3Cw== Message-ID: Date: Tue, 17 Mar 2026 09:50:40 +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 Cc: chao@kernel.org, Daeho Jeong Subject: Re: [f2fs-dev] [PATCH v2] f2fs: fix to skip empty sections in f2fs_get_victim To: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com References: <20260316185922.2184759-1-daeho43@gmail.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260316185922.2184759-1-daeho43@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2026/3/17 02:59, Daeho Jeong wrote: > From: Daeho Jeong > > In age-based victim selection (ATGC, AT_SSR, or GC_CB), f2fs_get_victim > can encounter sections with zero valid blocks. This situation often > arises when checkpoint is disabled or due to race conditions between > SIT updates and dirty list management. > > In such cases, f2fs_get_section_mtime() returns INVALID_MTIME, which > subsequently triggers a fatal f2fs_bug_on(sbi, mtime == INVALID_MTIME) > in add_victim_entry() or get_cb_cost(). > > This patch adds a check in f2fs_get_victim's selection loop to skip > sections with no valid blocks. This prevents unnecessary age > calculations for empty sections and avoids the associated kernel panic. > This change also allows removing redundant checks in add_victim_entry(). > > Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Thanks,