]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: defrag: replace hard coded PAGE_SIZE with sectorsize
authorQu Wenruo <wqu@suse.com>
Fri, 6 Aug 2021 08:12:34 +0000 (16:12 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Oct 2021 17:06:15 +0000 (19:06 +0200)
commit4dda683d260976e47847e03ad1e6b74365da0d02
tree30a2d33ea7df8c184339ba7ebe36582a6706902d
parent4473bf1d657ca1130dc477ba00b448b654c7dd87
btrfs: defrag: replace hard coded PAGE_SIZE with sectorsize

When testing subpage defrag support, I always find some strange inode
nbytes error, after a lot of debugging, it turns out that
defrag_lookup_extent() is using PAGE_SIZE as size for
lookup_extent_mapping().

Since lookup_extent_mapping() is calling __lookup_extent_mapping() with
@strict == 1, this means any extent map smaller than one page will be
ignored, prevent subpage defrag to grab a correct extent map.

There are quite some PAGE_SIZE usage in ioctl.c, but most of them are
correct usages, and can be one of the following cases:

- ioctl structure size check
  We want ioctl structure to be contained inside one page.

- real page operations

The remaining cases in defrag_lookup_extent() and
check_defrag_in_cache() will be addressed in this patch.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c