linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: make 1-bit bit-fields unsigned int
@ 2021-11-10 19:20 Colin Ian King
  2021-11-10 20:34 ` Josef Bacik
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin Ian King @ 2021-11-10 19:20 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba, Qu Wenruo, linux-btrfs
  Cc: kernel-janitors, linux-kernel

The bitfields have_csum and io_error are currently signed which is
not recommended as the representation is an implementation defined
behaviour. Fix this by making the bit-fields unsigned ints.

Fixes: 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/btrfs/scrub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index cf82ea6f54fb..8f6ceea33969 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -73,8 +73,8 @@ struct scrub_page {
 	u64			physical_for_dev_replace;
 	atomic_t		refs;
 	u8			mirror_num;
-	int			have_csum:1;
-	int			io_error:1;
+	unsigned int		have_csum:1;
+	unsigned int		io_error:1;
 	u8			csum[BTRFS_CSUM_SIZE];
 
 	struct scrub_recover	*recover;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: make 1-bit bit-fields unsigned int
  2021-11-10 19:20 [PATCH] btrfs: make 1-bit bit-fields unsigned int Colin Ian King
@ 2021-11-10 20:34 ` Josef Bacik
  2021-11-10 23:47 ` Qu Wenruo
  2021-11-11 11:31 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Josef Bacik @ 2021-11-10 20:34 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Chris Mason, David Sterba, Qu Wenruo, linux-btrfs,
	kernel-janitors, linux-kernel

On Wed, Nov 10, 2021 at 07:20:08PM +0000, Colin Ian King wrote:
> The bitfields have_csum and io_error are currently signed which is
> not recommended as the representation is an implementation defined
> behaviour. Fix this by making the bit-fields unsigned ints.
> 
> Fixes: 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: make 1-bit bit-fields unsigned int
  2021-11-10 19:20 [PATCH] btrfs: make 1-bit bit-fields unsigned int Colin Ian King
  2021-11-10 20:34 ` Josef Bacik
@ 2021-11-10 23:47 ` Qu Wenruo
  2021-11-11 11:31 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2021-11-10 23:47 UTC (permalink / raw)
  To: Colin Ian King, Chris Mason, Josef Bacik, David Sterba,
	Qu Wenruo, linux-btrfs
  Cc: kernel-janitors, linux-kernel



On 2021/11/11 03:20, Colin Ian King wrote:
> The bitfields have_csum and io_error are currently signed which is
> not recommended as the representation is an implementation defined
> behaviour. Fix this by making the bit-fields unsigned ints.
>
> Fixes: 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

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

Thanks,
Qu
> ---
>   fs/btrfs/scrub.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index cf82ea6f54fb..8f6ceea33969 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -73,8 +73,8 @@ struct scrub_page {
>   	u64			physical_for_dev_replace;
>   	atomic_t		refs;
>   	u8			mirror_num;
> -	int			have_csum:1;
> -	int			io_error:1;
> +	unsigned int		have_csum:1;
> +	unsigned int		io_error:1;
>   	u8			csum[BTRFS_CSUM_SIZE];
>
>   	struct scrub_recover	*recover;
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: make 1-bit bit-fields unsigned int
  2021-11-10 19:20 [PATCH] btrfs: make 1-bit bit-fields unsigned int Colin Ian King
  2021-11-10 20:34 ` Josef Bacik
  2021-11-10 23:47 ` Qu Wenruo
@ 2021-11-11 11:31 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2021-11-11 11:31 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Chris Mason, Josef Bacik, David Sterba, Qu Wenruo, linux-btrfs,
	kernel-janitors, linux-kernel

On Wed, Nov 10, 2021 at 07:20:08PM +0000, Colin Ian King wrote:
> The bitfields have_csum and io_error are currently signed which is
> not recommended as the representation is an implementation defined
> behaviour. Fix this by making the bit-fields unsigned ints.
> 
> Fixes: 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Added to misc-next, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-11 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 19:20 [PATCH] btrfs: make 1-bit bit-fields unsigned int Colin Ian King
2021-11-10 20:34 ` Josef Bacik
2021-11-10 23:47 ` Qu Wenruo
2021-11-11 11:31 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).