All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer
@ 2022-11-15  9:39 Christoph Hellwig
  2022-11-15  9:41 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2022-11-15  9:39 UTC (permalink / raw)
  To: clm, josef, dsterba, naohiro.aota; +Cc: linux-btrfs

generation is an on-disk __le64 value, so use btrfs_super_generation to
convert it to host endian before comparing it.

Fixes: 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---

Changes since v1:
 - use btrfs_super_generation instead of le64_to_cpu

 fs/btrfs/zoned.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 6781c141a6b41..4b55a5c68826f 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -137,7 +137,8 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
 			super[i] = page_address(page[i]);
 		}
 
-		if (super[0]->generation > super[1]->generation)
+		if (btrfs_super_generation(super[0]) >
+		    btrfs_super_generation(super[1]))
 			sector = zones[1].start;
 		else
 			sector = zones[0].start;
-- 
2.30.2


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

* Re: [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer
  2022-11-15  9:39 [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer Christoph Hellwig
@ 2022-11-15  9:41 ` Johannes Thumshirn
  2022-11-15 10:17 ` Qu Wenruo
  2022-11-15 13:59 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2022-11-15  9:41 UTC (permalink / raw)
  To: Christoph Hellwig, clm, josef, dsterba, Naohiro Aota; +Cc: linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer
  2022-11-15  9:39 [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer Christoph Hellwig
  2022-11-15  9:41 ` Johannes Thumshirn
@ 2022-11-15 10:17 ` Qu Wenruo
  2022-11-15 13:59 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2022-11-15 10:17 UTC (permalink / raw)
  To: Christoph Hellwig, clm, josef, dsterba, naohiro.aota; +Cc: linux-btrfs



On 2022/11/15 17:39, Christoph Hellwig wrote:
> generation is an on-disk __le64 value, so use btrfs_super_generation to
> convert it to host endian before comparing it.
> 
> Fixes: 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

Thanks,
Qu

> ---
> 
> Changes since v1:
>   - use btrfs_super_generation instead of le64_to_cpu
> 
>   fs/btrfs/zoned.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index 6781c141a6b41..4b55a5c68826f 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -137,7 +137,8 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
>   			super[i] = page_address(page[i]);
>   		}
>   
> -		if (super[0]->generation > super[1]->generation)
> +		if (btrfs_super_generation(super[0]) >
> +		    btrfs_super_generation(super[1]))
>   			sector = zones[1].start;
>   		else
>   			sector = zones[0].start;

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

* Re: [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer
  2022-11-15  9:39 [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer Christoph Hellwig
  2022-11-15  9:41 ` Johannes Thumshirn
  2022-11-15 10:17 ` Qu Wenruo
@ 2022-11-15 13:59 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2022-11-15 13:59 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: clm, josef, dsterba, naohiro.aota, linux-btrfs

On Tue, Nov 15, 2022 at 10:39:44AM +0100, Christoph Hellwig wrote:
> generation is an on-disk __le64 value, so use btrfs_super_generation to
> convert it to host endian before comparing it.
> 
> Fixes: 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Added to misc-next, thanks.

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

end of thread, other threads:[~2022-11-15 14:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15  9:39 [PATCH v2] btrfs: fix missing endianess conversion in sb_write_pointer Christoph Hellwig
2022-11-15  9:41 ` Johannes Thumshirn
2022-11-15 10:17 ` Qu Wenruo
2022-11-15 13:59 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.