diff mbox series

[05/13] btrfs-progs: lowmem: check unaligned disk_bytenr for extent_data

Message ID 20181023094147.7906-6-suy.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: fixes of file extent in original and lowmem check | expand

Commit Message

Su Yue Oct. 23, 2018, 9:41 a.m. UTC
Add support to check unaligned disk_bytenr for extent_data.

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

Comments

Qu Wenruo Oct. 24, 2018, 12:13 a.m. UTC | #1
On 2018/10/23 下午5:41, Su Yue wrote:
> Add support to check unaligned disk_bytenr for extent_data.
> 
> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>  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 35fe1adf58e6..e8a2e825c0f3 100644
> --- a/check/mode-lowmem.c
> +++ b/check/mode-lowmem.c
> @@ -3103,7 +3103,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",
>
diff mbox series

Patch

diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 35fe1adf58e6..e8a2e825c0f3 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -3103,7 +3103,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",