Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] readahead02: Fall back to the parent disk's BDI for partitions
@ 2026-08-21  6:32 Victor Cheng-Yen Yang via ltp
  2026-08-21  6:53 ` [LTP] " linuxtestproject.agent
  0 siblings, 1 reply; 2+ messages in thread
From: Victor Cheng-Yen Yang via ltp @ 2026-08-21  6:32 UTC (permalink / raw)
  To: ltp

Partitions (e.g. mmcblk0p3) do not have their own BDI sysfs entry;
the BDI belongs to the parent disk.

In sysfs a partition is a subdirectory of its disk, so retry one
level up. That resolves for every partition naming scheme without
parsing the device name.

Without this fix, setup_readahead_length() silently returns the
default readahead_length, causing lots of readahead() calls per
test case and a multi-hour runtime on MMC-backed FPGA boards.

Signed-off-by: Victor Cheng-Yen Yang <cyyang772@andestech.com>
---
 testcases/kernel/syscalls/readahead/readahead02.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
index b65213ad0..6707a1c63 100644
--- a/testcases/kernel/syscalls/readahead/readahead02.c
+++ b/testcases/kernel/syscalls/readahead/readahead02.c
@@ -399,8 +399,14 @@ static void setup_readahead_length(void)
 	backing_dev = basename(tmp);
 	sprintf(sys_bdi_ra_path, "/sys/class/block/%s/bdi/read_ahead_kb",
 		backing_dev);
-	if (access(sys_bdi_ra_path, F_OK))
-		return;
+
+	if (access(sys_bdi_ra_path, F_OK)) {
+		/* Partitions use the parent disk's BDI sysfs entry */
+		snprintf(sys_bdi_ra_path, sizeof(sys_bdi_ra_path),
+			"/sys/class/block/%s/../bdi/read_ahead_kb", backing_dev);
+		if (access(sys_bdi_ra_path, F_OK))
+			return;
+	}
 
 	SAFE_FILE_SCANF(sys_bdi_ra_path, "%d", &orig_bdi_limit);
 
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] readahead02: Fall back to the parent disk's BDI for partitions
  2026-08-21  6:32 [LTP] [PATCH] readahead02: Fall back to the parent disk's BDI for partitions Victor Cheng-Yen Yang via ltp
@ 2026-08-21  6:53 ` linuxtestproject.agent
  0 siblings, 0 replies; 2+ messages in thread
From: linuxtestproject.agent @ 2026-08-21  6:53 UTC (permalink / raw)
  To: Victor Cheng-Yen Yang; +Cc: ltp

Hi Victor,

On Fri, 21 Aug 2026, Victor Cheng-Yen Yang wrote:
> readahead02: Fall back to the parent disk's BDI for partitions

> +		snprintf(sys_bdi_ra_path, sizeof(sys_bdi_ra_path),
> +			"/sys/class/block/%s/../bdi/read_ahead_kb", backing_dev);
> +		if (access(sys_bdi_ra_path, F_OK))
> +			return;
> +	}
>
> 	SAFE_FILE_SCANF(sys_bdi_ra_path, "%d", &orig_bdi_limit);
>
> 	if (orig_bdi_limit)
> 		SAFE_FILE_PRINTF(sys_bdi_ra_path, "%d", orig_bdi_limit);

Could restoration track whether the value was read separately from its
numeric value? The kernel accepts zero for read_ahead_kb, so if the parent
BDI starts at zero, setup writes a positive value but cleanup skips the
restore. This leaves the parent and its sibling partitions modified after
the test.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-21  6:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  6:32 [LTP] [PATCH] readahead02: Fall back to the parent disk's BDI for partitions Victor Cheng-Yen Yang via ltp
2026-08-21  6:53 ` [LTP] " linuxtestproject.agent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox