diff options
| author | Qu Wenruo <wqu@suse.com> | 2026-06-08 12:32:16 +0930 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-08-07 19:16:27 +0200 |
| commit | 4ac48dc0cbd65fc91c45de17c3afadab85f4bb79 (patch) | |
| tree | d6d0db87ca45f51a439052f300c9461ae5fbb9cf /tools/perf/scripts/python/netdev-times.py | |
| parent | 9366afd43023f45345b34b7dde05c53d71dfd30f (diff) | |
btrfs: refactor btrfs_dio_iomap_end()
That function has the following problems:
- Read/write handling scattered across different locations
E.g. At the beginning there is a dedicated hole read handling, but
later short read handling is at an if() branch.
- Modifying of @pos and @length parameter for short read
Although it's completely fine to modify those parameters as they are
passed by value, but it can still be confusing to read. As normally
we would assume @pos and @length to be the original range.
But for short IO handling we modify @pos/@length, and completely
ignore @written.
- Unnecessary split for ordered extent and changeset handling
Both OE and changeset are only for writes, but they are handled in two
different if (write) {} blocks.
Refactor the function so that:
- Handling of reads and writes are concentrated in their code block
Now the handling of reads are in its own small if () branch.
Leaving the more complex writes handling to take the remaining
function, and reduce the indent level.
This also removes all unnecessary "if (write)" checks.
- Do not modify @pos and @length
Let short IO handling to manually calculate the remaining range.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/netdev-times.py')
0 files changed, 0 insertions, 0 deletions
