diff options
author | Yu Kuai <yukuai3@huawei.com> | 2023-09-27 14:12:41 +0800 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2023-09-27 13:54:26 -0700 |
commit | cf1b6d4441fffd0ba8ae4ced6a12f578c95ca049 (patch) | |
tree | ea69d822457495a10c3ff2ec463422cceebdaae8 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | 3d8d32873c7b6d9cec5b40c2ddb8c7c55961694f (diff) |
md: simplify md_seq_ops
Before this patch, the implementation is hacky and hard to understand:
1) md_seq_start set pos to 1;
2) md_seq_show found pos is 1, then print Personalities;
3) md_seq_next found pos is 1, then it update pos to the first mddev;
4) md_seq_show found pos is not 1 or 2, show mddev;
5) md_seq_next found pos is not 1 or 2, update pos to next mddev;
6) loop 4-5 until the last mddev, then md_seq_next update pos to 2;
7) md_seq_show found pos is 2, then print unused devices;
8) md_seq_next found pos is 2, stop;
This patch remove the magic value and use seq_list_start/next/stop()
directly, and move printing "Personalities" to md_seq_start(),
"unsed devices" to md_seq_stop():
1) md_seq_start print Personalities, and then set pos to first mddev;
2) md_seq_show show mddev;
3) md_seq_next update pos to next mddev;
4) loop 2-3 until the last mddev;
5) md_seq_stop print unsed devices;
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230927061241.1552837-3-yukuai1@huaweicloud.com
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions