public inbox for linux-btrfs@vger.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

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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox