btrfs-progs/check
Qu Wenruo 33d84be030 btrfs-progs: fix false alert on tree block crossing 64K page boundary
[BUG]
When btrfs-check is executed on even newly created fs, it can report
tree blocks crossing 64K page boundary like this:

  Opening filesystem to check...
  Checking filesystem on /dev/test/test
  UUID: 80d734c8-dcbc-411b-9623-a10bd9e7767f
  [1/7] checking root items
  [2/7] checking extents
  WARNING: tree block [30523392, 30539776) crosses 64K page boudnary, may cause problem for 64K page system
  [3/7] checking free space cache
  [4/7] checking fs roots
  [5/7] checking only csums items (without verifying data)
  [6/7] checking root refs
  [7/7] checking quota groups skipped (not enabled on this FS)
  found 131072 bytes used, no error found
  total csum bytes: 0
  total tree bytes: 131072
  total fs tree bytes: 32768
  total extent tree bytes: 16384
  btree space waste bytes: 125199
  file data blocks allocated: 0
   referenced 0

[CAUSE]
Tree block [30523392, 30539776) is at the last 16K slot of page.
As 30523392 % 65536 = 49152, and 30539776 % 65536 = 0.

The cross boundary check is using exclusive end, which causes false
alerts.

[FIX]
Use inclusive end to do the cross 64K boundary check.

Reported-by: Wang Yugui <wangyugui@e16-tech.com>
Issue: #352
Issue: #354
Fixes: fc38ae7f48 ("btrfs-progs: check: detect and warn about tree blocks crossing 64K page boundary")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2021-03-15 15:40:48 +01:00
..
common.h btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00
main.c btrfs-progs: check: detect and warn about tree blocks crossing 64K page boundary 2021-02-19 15:24:42 +01:00
mode-common.c btrfs-progs: check: properly exclude leaves for lowmem mode 2021-01-13 22:33:10 +01:00
mode-common.h btrfs-progs: fix false alert on tree block crossing 64K page boundary 2021-03-15 15:40:48 +01:00
mode-lowmem.c btrfs-progs: check: detect and warn about tree blocks crossing 64K page boundary 2021-02-19 15:24:42 +01:00
mode-lowmem.h btrfs-progs: check: drop unused fs_info 2020-08-31 17:01:03 +02:00
mode-original.h btrfs-progs: check/original: Add check and repair for invalid inode generation 2019-11-18 19:21:07 +01:00
qgroup-verify.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
qgroup-verify.h btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00