btrfs: fix missing endianess conversion in sb_write_pointer
PATCH v2 1/1 btrfs: fix missing endianess conversion in sb_write_pointer
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 <[email protected]>
---
Changes since v1:
- use btrfs_super_generation instead of le64_to_cpu
fs/btrfs/zoned.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/zoned.c +2 -1
@@ -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;
Signature · 1 line
2.30.2
Looks good,
Reviewed-by Johannes Thumshirn <[email protected]>
Quoted 5 lines · Christoph Hellwig
generation is an on-disk
__le64value, so usebtrfs_super_generationto convert it to host endian before comparing it.Fixes 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")Signed-off-by Christoph Hellwig <[email protected]>
Reviewed-by Qu Wenruo <[email protected]>
Thanks,
Qu
Quoted 22 lines
---
Changes since v1:
- usebtrfs_super_generationinstead ofle64_to_cpufs/btrfs/zoned.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/btrfs/zoned.c +2
-1@@ -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;
Quoted 6 lines · Christoph Hellwig
generation is an on-disk
__le64value, so usebtrfs_super_generationto convert it to host endian before comparing it.Fixes 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")Signed-off-by Christoph Hellwig <[email protected]>---
Added to misc-next, thanks.