From: Su Yue <suy.f...@cn.fujitsu.com>

Add support to check unaligned disk_bytenr for extent_data.

Signed-off-by: Su Yue <suy.f...@cn.fujitsu.com>
Reviewed-by: Qu Wenruo <w...@suse.com>
Signed-off-by: Qu Wenruo <w...@suse.com>
---
 check/mode-lowmem.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 7bcb833a567e..746835654d82 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -3167,7 +3167,14 @@ static int check_extent_data_item(struct btrfs_root 
*root,
        extent_num_bytes = btrfs_file_extent_num_bytes(eb, fi);
        offset = btrfs_file_extent_offset(eb, fi);
 
-       /* Check unaligned disk_num_bytes and num_bytes */
+       /* Check unaligned disk_bytenr, disk_num_bytes and num_bytes */
+       if (!IS_ALIGNED(disk_bytenr, root->fs_info->sectorsize)) {
+               error(
+"file extent [%llu, %llu] has unaligned disk bytenr: %llu, should be aligned 
to %u",
+                       fi_key.objectid, fi_key.offset, disk_bytenr,
+                       root->fs_info->sectorsize);
+               err |= BYTES_UNALIGNED;
+       }
        if (!IS_ALIGNED(disk_num_bytes, root->fs_info->sectorsize)) {
                error(
 "file extent [%llu, %llu] has unaligned disk num bytes: %llu, should be 
aligned to %u",
-- 
2.21.0

Reply via email to