From nobody Mon Feb 9 12:24:30 2026 Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.7]) (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 D9FE3303C83 for ; Mon, 5 Jan 2026 15:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767627112; cv=none; b=ph0K9X9j+km7RSeJ1qaCJ9cjIdcQkssOHJ9jviFLNuYeu+536muZpLEQLwZqJuByoSiuv1gpfH/tRNaEdQJI+Al8KTU9msmnhsMDANfS4xdVVlgQlZmCMkfMS8PYWCTZu2tFu7ddisXOFVv1xKnN0MCd0S4Hj8LrVv/R9dzoXzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767627112; c=relaxed/simple; bh=RclqDzYOshdunGEdgy2OuyIlcMpf8NdEsURFgfoq9HU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=svCZm6tcd89vxiY6JHUuE2K7bxUw1/zscfTodtzfQSV9FR2zHc8Jri5h78bvgIQ4Y5vDpltY1UB2zpyVq7yqeEiX4zi1f1LMbg6On9P81uuo8//Lhes3f42waOFfPOtM+VvNtq9KlKKXWV4qoG3cYZWjrLxeXIQAQv7yEBAUYLk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com; spf=pass smtp.mailfrom=126.com; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b=btf4AX9f; arc=none smtp.client-ip=220.197.31.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="btf4AX9f" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=bF FmAVAmIX+RPOqrfHAqM7ezbKNEISuZL8Xxh41Ccqw=; b=btf4AX9fjc1P66WLjq otpUXAaoMUL3RMDHCCxt6p4B7BtzM8F+ByqjyurnLlB6j06LlGnVup6NpiUIw1rO d5ySJplZCIFiqR/MOmNVH2ComQ0NbXBm24z7dCCEF5fnU9gVAsvnCuN31+6NFU8i j0QriKjA38gITw1/SoJwye1H0= Received: from YLLaptop.. (unknown []) by gzga-smtp-mtada-g0-1 (Coremail) with SMTP id _____wD3t6092Vtp4nHABA--.665S6; Mon, 05 Jan 2026 23:31:12 +0800 (CST) From: Nanzhe Zhao To: Kim Jaegeuk Cc: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nanzhe Zhao Subject: [PATCH v1 4/5] f2fs: add 'folio_in_bio' to handle readahead folios with no BIO submission Date: Mon, 5 Jan 2026 23:31:00 +0800 Message-Id: <20260105153101.152892-5-nzzhao@126.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260105153101.152892-1-nzzhao@126.com> References: <20260105153101.152892-1-nzzhao@126.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3t6092Vtp4nHABA--.665S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7Aw4xurWrCw4DKryrXryUAwb_yoW8Cry8pr ykKF95KFZ8JFW8ur48t3Z0vw1Sk348Wa1UGFWfCw1fAasxXas5KFyvq3WY9F1UtFn5J3WI qF4FvryUWFsrtF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRkwIgUUUUU= X-CM-SenderInfo: xq22xtbr6rjloofrz/xtbBsAG3h2lb2UFHhQAA3p Content-Type: text/plain; charset="utf-8" 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 *i= node, unsigned nrpages; struct f2fs_folio_state *ffs; int ret =3D 0; + bool folio_in_bio =3D false; if (!IS_IMMUTABLE(inode)) return -EOPNOTSUPP; @@ -2445,6 +2446,7 @@ static int f2fs_read_data_large_folio(struct inode *i= node, if (!folio) goto out; + folio_in_bio =3D false index =3D folio->index; offset =3D 0; ffs =3D NULL; @@ -2530,6 +2532,7 @@ static int f2fs_read_data_large_folio(struct inode *i= node, offset << PAGE_SHIFT)) goto submit_and_realloc; + folio_in_bio =3D 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); + } folio =3D readahead_folio(rac); goto next_folio; } -- 2.34.1