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 4FD57199E94 for ; Tue, 6 Jan 2026 09:31:15 +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=1767691877; cv=none; b=Dw8ldjeZFkV+6oh/3fcsOkYwrvE63I9ff551B1T03xxF5oN9Gq7vY/1+whMweXp5z9v+dq5KRUKzttn5x5KdAzxBcO7byRmHF+kn7/kM8+z8cYbV7g0+bOy5cnosmXIuQaqN29aytsQlSncNpWSSkx+DZslUraVOO5Uimjb3Qhs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767691877; c=relaxed/simple; bh=7AISoZfUTtJ8qU2F5kq1TdtJ/wFsXo1uQ3IwmK9NNGo=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=PziJjFZw64NPHrvmEqHJBcIOpGULAxdmgd20wchkC2kbjnW7cZwFXBnSDIoSSylzun/GABXjDnzcG/IzHKLurK+L1VJ3UuR2lFuKyggx39zyMwmhY6O6BrZx2BQVI8cRCOB6ez0Al0DtAleTXSYmhO4zFT1d61B/APES5OydXZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dwmTDmpW; 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="dwmTDmpW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B0A1C116C6; Tue, 6 Jan 2026 09:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767691875; bh=7AISoZfUTtJ8qU2F5kq1TdtJ/wFsXo1uQ3IwmK9NNGo=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=dwmTDmpW0BAt9PRsXQKdexoK2XecVcgoH6T7YEkfyZRK619FypwFgHg55/9Er5n89 zzvQIxZAdEQELq4ZJnQkIqZxJuhXSZtuRu2igDFQNC6uazIxzWrGNrZUCobek2Dmt3 Lr4kUCE9eqLYdWXGQt6EP6tbWQk6eFOWOZgnrJzBuY2nWlTo6nWN9Z2G+1jZOf3NLC Dky3A1R8TAyXOgo+b9YC4TttPjW/tRXKjQNU7F442EvHSGPHK7eLww9fhokV2wQrC9 A9mM/qXheQChW/iB0EuPbcRIma6oGh73aigeV9deEWfw4oHBhiUVmP58V84SjdA/6Z U1mpN39Q4C8tQ== Message-ID: <5ca2ef6a-ce46-4d80-b2e0-ff35c628e0ba@kernel.org> Date: Tue, 6 Jan 2026 17:31:20 +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, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 4/5] f2fs: add 'folio_in_bio' to handle readahead folios with no BIO submission To: Nanzhe Zhao , Kim Jaegeuk References: <20260105153101.152892-1-nzzhao@126.com> <20260105153101.152892-5-nzzhao@126.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260105153101.152892-5-nzzhao@126.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/5/2026 11:31 PM, Nanzhe Zhao wrote: > f2fs_read_data_large_folio() can build a single read BIO across multiple > folios during readahead. If a folio ends up having none of its subpages > added to the BIO (e.g. all subpages are zeroed / treated as holes), it > will never be seen by f2fs_finish_read_bio(), so folio_end_read() is > never called. This leaves the folio locked and not marked uptodate. > > Track whether the current folio has been added to a BIO via a local > 'folio_in_bio' bool flag, and when iterating readahead folios, explicitly > mark the folio uptodate (on success) and unlock it when nothing was added. > > Signed-off-by: Nanzhe Zhao > --- > fs/f2fs/data.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index 66ab7a43a56f..ac569a396914 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -2430,6 +2430,7 @@ static int f2fs_read_data_large_folio(struct inode *inode, > unsigned nrpages; > struct f2fs_folio_state *ffs; > int ret = 0; > + bool folio_in_bio = false; No need to initialize folio_in_bio? > > if (!IS_IMMUTABLE(inode)) > return -EOPNOTSUPP; > @@ -2445,6 +2446,7 @@ static int f2fs_read_data_large_folio(struct inode *inode, > if (!folio) > goto out; > > + folio_in_bio = false folio_in_bio = false; > index = folio->index; > offset = 0; > ffs = NULL; > @@ -2530,6 +2532,7 @@ static int f2fs_read_data_large_folio(struct inode *inode, > offset << PAGE_SHIFT)) > goto submit_and_realloc; > > + folio_in_bio = true; > inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA); > f2fs_update_iostat(F2FS_I_SB(inode), NULL, FS_DATA_READ_IO, > F2FS_BLKSIZE); > @@ -2539,6 +2542,11 @@ static int f2fs_read_data_large_folio(struct inode *inode, > } > trace_f2fs_read_folio(folio, DATA); > if (rac) { > + if (!folio_in_bio) { > + if (!ret) > + folio_mark_uptodate(folio); > + folio_unlock(folio); > + } err_out: /* Nothing was submitted. */ if (!bio) { if (!ret) folio_mark_uptodate(folio); folio_unlock(folio); ^^^^^^^^^^^^ If all folios in rac have not been mapped (hole case), will we unlock the folio twice? Thanks, return ret; } > folio = readahead_folio(rac); > goto next_folio; > } > -- > 2.34.1 >