diff mbox series

[03/14] btrfs: mark the len field in struct btrfs_ordered_sum as unsigned

Message ID 20230524150317.1767981-4-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/14] btrfs: optimize out btrfs_is_zoned for !CONFIG_BLK_DEV_ZONED | expand

Commit Message

Christoph Hellwig May 24, 2023, 3:03 p.m. UTC
len can't ever be negative, so mark it as an u32 instead of int.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/ordered-data.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Thumshirn May 25, 2023, 8:33 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
David Sterba May 30, 2023, 4:45 p.m. UTC | #2
On Wed, May 24, 2023 at 05:03:06PM +0200, Christoph Hellwig wrote:
> len can't ever be negative, so mark it as an u32 instead of int.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/btrfs/ordered-data.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
> index f0f1138d23c331..2e54820a5e6ff7 100644
> --- a/fs/btrfs/ordered-data.h
> +++ b/fs/btrfs/ordered-data.h
> @@ -20,7 +20,7 @@ struct btrfs_ordered_sum {
>  	/*
>  	 * this is the length in bytes covered by the sums array below.
>  	 */
> -	int len;
> +	u32 len;

Due to the int there was one cast to be removed

--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -561,7 +561,7 @@ int btrfs_lookup_csums_list(struct btrfs_root *root, u64 start, u64 end,
                        }
 
                        sums->bytenr = start;
-                       sums->len = (int)size;
+                       sums->len = size;
diff mbox series

Patch

diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index f0f1138d23c331..2e54820a5e6ff7 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -20,7 +20,7 @@  struct btrfs_ordered_sum {
 	/*
 	 * this is the length in bytes covered by the sums array below.
 	 */
-	int len;
+	u32 len;
 	struct list_head list;
 	/* last field is a variable length array of csums */
 	u8 sums[];