diff options
| author | Qu Wenruo <wqu@suse.com> | 2026-09-10 11:35:52 +0930 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-10-12 19:16:21 +0200 |
| commit | 44edf5160b3479877fb8f76b4ebe72af676138ed (patch) | |
| tree | 1feabeb780720591d84c9d4db9515eac60d21943 /tools/perf/scripts/python | |
| parent | 5a593fe11e9f08bb743a13a283e71da971cbffbc (diff) | |
| download | linux-44edf5160b3479877fb8f76b4ebe72af676138ed.tar.gz linux-44edf5160b3479877fb8f76b4ebe72af676138ed.zip | |
btrfs: fix off-by-one end related to inode_need_compress()
In most cases btrfs uses @end as the inclusive end bytenr for a range,
and this applies to inode_need_compress().
However we have several sites not following the inclusive bytenr:
- run_delalloc_inline()
Which assigned @blocksize as @end for inode_need_compress()
This makes inode_need_compress() always skip the disk_i_size check.
- heuristic_collect_sample()
Which assigned "start + BTRFS_MAX_UNCOMPRESSED" to @end, which is
the exclusive bytenr.
Neither is really causing any real problem, as
heuristic_collect_sample() has proper checks to avoid reading anything
beyond @end, and the sampling read size is 16 bytes, so it has enough
headroom to handle that off-by-one problem.
But still I do not like anything out of the common scheme, so fix the
off-by-one @end for both call sites, and add extra ASSERT()s to catch
such unaligned parameters.
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
