* [LTP] [PATCH] readahead02: fix path for read_ahead_kb on raw partitions
@ 2016-09-14 13:50 Jan Stancek
2016-09-19 9:37 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2016-09-14 13:50 UTC (permalink / raw)
To: ltp
Path to read_ahead_kb is not consistent for all block devices,
for example for LVM it's:
/sys/dev/block/$maj:$min/queue/read_ahead_kb
but for raw partitions "queue" is only in "parent" device:
/sys/dev/block/$maj:$min/../queue/read_ahead_kb
This patch checks both types and reads first one it can find.
Tested on LVM and raw partitions with 4.7.3.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/readahead/readahead02.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
index 53278be7d84c..2517a333680e 100644
--- a/testcases/kernel/syscalls/readahead/readahead02.c
+++ b/testcases/kernel/syscalls/readahead/readahead02.c
@@ -194,6 +194,12 @@ static long get_device_readahead(const char *fname)
tst_brkm(TBROK | TERRNO, cleanup, "stat");
snprintf(buf, sizeof(buf), "/sys/dev/block/%d:%d/queue/read_ahead_kb",
major(st.st_dev), minor(st.st_dev));
+ if (access(buf, F_OK)) {
+ snprintf(buf, sizeof(buf),
+ "/sys/dev/block/%d:%d/../queue/read_ahead_kb",
+ major(st.st_dev), minor(st.st_dev));
+ }
+ tst_resm(TINFO, "Reading %s", buf);
SAFE_FILE_SCANF(cleanup, buf, "%ld", &ra_kb);
return ra_kb * 1024;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] readahead02: fix path for read_ahead_kb on raw partitions
2016-09-14 13:50 [LTP] [PATCH] readahead02: fix path for read_ahead_kb on raw partitions Jan Stancek
@ 2016-09-19 9:37 ` Cyril Hrubis
2016-09-19 12:46 ` Jan Stancek
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2016-09-19 9:37 UTC (permalink / raw)
To: ltp
Hi!
> Path to read_ahead_kb is not consistent for all block devices,
> for example for LVM it's:
> /sys/dev/block/$maj:$min/queue/read_ahead_kb
> but for raw partitions "queue" is only in "parent" device:
> /sys/dev/block/$maj:$min/../queue/read_ahead_kb
>
> This patch checks both types and reads first one it can find.
> Tested on LVM and raw partitions with 4.7.3.
Fixes the problem for me as well (minus the Btrfs anonymous block
devices that has to be fixed).
Acked.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] readahead02: fix path for read_ahead_kb on raw partitions
2016-09-19 9:37 ` Cyril Hrubis
@ 2016-09-19 12:46 ` Jan Stancek
0 siblings, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2016-09-19 12:46 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Monday, 19 September, 2016 11:37:55 AM
> Subject: Re: [LTP] [PATCH] readahead02: fix path for read_ahead_kb on raw partitions
>
> Hi!
> > Path to read_ahead_kb is not consistent for all block devices,
> > for example for LVM it's:
> > /sys/dev/block/$maj:$min/queue/read_ahead_kb
> > but for raw partitions "queue" is only in "parent" device:
> > /sys/dev/block/$maj:$min/../queue/read_ahead_kb
> >
> > This patch checks both types and reads first one it can find.
> > Tested on LVM and raw partitions with 4.7.3.
>
> Fixes the problem for me as well (minus the Btrfs anonymous block
> devices that has to be fixed).
>
> Acked.
Pushed.
Regards,
Jan
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-19 12:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 13:50 [LTP] [PATCH] readahead02: fix path for read_ahead_kb on raw partitions Jan Stancek
2016-09-19 9:37 ` Cyril Hrubis
2016-09-19 12:46 ` Jan Stancek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.