zram03: drop obsolete sysfs interfaces
PATCH v2 1/1 zram03: drop obsolete sysfs interfaces
Due to upstream linux commit c87d1655c29500b459fb135258a93f8309ada9c7 ("zram: remove obsolete sysfs attrs"), some sysfs interfaces are not available anymore.
Check kernel version, and remove dumping them on >= 4.10 kernel to avoid test case failure.
---
v1 --> v2:
Check kernel version to dump proper stats per Li Wang's suggestion
testcases/kernel/device-drivers/zram/zram03.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
testcases/kernel/device-drivers/zram/zram03.c +10 -6
@@ -185,11 +185,15 @@ static void print(char *string)static void dump_info (void ) {"initstate" ); -"compr_data_size" ); -"orig_data_size" );"disksize" ); -"mem_used_total" ); -"num_reads" ); -"num_writes" ); -"zero_pages" ); + +if ((tst_kvercmp (4 ,10 ,0 )) <0 ) { +/* The below stats are not available on 4.10 or newer kernel */ +"compr_data_size" ); +"orig_data_size" ); +"mem_used_total" ); +"num_reads" ); +"num_writes" ); +"zero_pages" ); + } }
Signature · 1 line
1.8.3.1
PATCH v2 1/1 zram03: drop obsolete sysfs interfaces
Hi Yang,
Quoted 3 lines
Due to upstream linux commit
c87d1655c29500b459fb135258a93f8309ada9c7("zram: remove obsolete sysfs attrs"), some sysfs interfaces are not available anymore.
From the commit is seen, that most of them (missing num_reads and num_writes) has been accessible for some time from /sys/block/zram<id>/mm_stat. And indeed the docs [1] confirm that. Maybe it'd make sense to parse this file and use the data.
/sys/block/zram<id>/mm_stat was added in 4f2109f608815 (v4.1-rc1) Interesting, it's also in Centos7 3.10.0-693 kernel, it must have been backported there (obviously not in 3.16 from Debian).
[1] https://www.kernel.org/doc/Documentation/blockdev/zram.txt
Kind regards,
Petr
Quoted 38 lines
Check kernel version, and remove dumping them on >= 4.10 kernel to avoid test case failure.
Suggested-by Li Wang <[email protected]>Signed-off-by Yang Shi <[email protected]>---
v1 --> v2:
Check kernel version to dump proper stats per Li Wang's suggestiontestcases/kernel/device-drivers/zram/zram03.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)testcases/kernel/device-drivers/zram/zram03.c +10
-6@@ -185,11 +185,15 @@ static void print(char *string)static void dump_info (void ) {"initstate" ); -"compr_data_size" ); -"orig_data_size" );"disksize" ); -"mem_used_total" ); -"num_reads" ); -"num_writes" ); -"zero_pages" ); + +if ((tst_kvercmp (4 ,10 ,0 )) <0 ) { +/* The below stats are not available on 4.10 or newer kernel */ +"compr_data_size" ); +"orig_data_size" ); +"mem_used_total" ); +"num_reads" ); +"num_writes" ); +"zero_pages" ); + } }
PATCH v2 1/1 zram03: drop obsolete sysfs interfaces
Quoted 10 lines · Petr Vorel
Hi Yang,
Quoted 3 lines
Due to upstream linux commit
c87d1655c29500b459fb135258a93f8309ada9c7("zram: remove obsolete sysfs attrs"), some sysfs interfaces are not available anymore.From the commit is seen, that most of them (missing
num_readsandnum_writes) has been accessible for some time from /sys/block/zram<id>/mm_stat. And indeed the docs [1] confirm that. Maybe it'd make sense to parse this file and use the data.
Quoted 5 lines
/sys/block/zram<id>/mm_stat was added in
4f2109f608815(v4.1-rc1) Interesting, it's also in Centos7 3.10.0-693 kernel, it must have been backported there (obviously not in 3.16 from Debian).[1] https://www.kernel.org/doc/Documentation/blockdev/zram.txt
Hi Petr,
I am sorry for missing this patch.
I got the same issue and have sent another patch to fix it as you suggested. Could you help me review the following patch:
http://lists.linux.it/pipermail/ltp/2018-July/008702.html
Thanks,
Xiao Yang
Quoted 39 lines
Kind regards,
PetrQuoted 35 lines
Check kernel version, and remove dumping them on>= 4.10 kernel to avoid test case failure.
Suggested-by Li Wang<[email protected]>Signed-off-by Yang Shi<[email protected]>---
v1 --> v2:
Check kernel version to dump proper stats per Li Wang's suggestiontestcases/kernel/device-drivers/zram/zram03.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)testcases/kernel/device-drivers/zram/zram03.c +10
-6@@ -185,11 +185,15 @@ static void print(char *string)static void dump_info (void ) {"initstate" ); -"compr_data_size" ); -"orig_data_size" );"disksize" ); -"mem_used_total" ); -"num_reads" ); -"num_writes" ); -"zero_pages" ); + +if ((tst_kvercmp (4 ,10 ,0 ))<0 ) { +/* The below stats are not available on 4.10 or newer kernel */ +"compr_data_size" ); +"orig_data_size" ); +"mem_used_total" ); +"num_reads" ); +"num_writes" ); +"zero_pages" ); + } }