btrfs-progs: use proper unaligned helper in btrfs_csum_final
authorDavid Sterba <dsterba@suse.com>
Thu, 28 Jul 2016 17:36:50 +0000 (19:36 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 29 Jul 2016 13:04:54 +0000 (15:04 +0200)
This will not cause unaligned access as the checksum is at the beginning
of btrfs_header and thus aligned to a page, but for clarity use the
helper.

Signed-off-by: David Sterba <dsterba@suse.com>
disk-io.c

index fbce506..3647ecc 100644 (file)
--- a/disk-io.c
+++ b/disk-io.c
@@ -125,7 +125,7 @@ u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
 
 void btrfs_csum_final(u32 crc, char *result)
 {
-       *(__le32 *)result = ~cpu_to_le32(crc);
+       put_unaligned_le32(~crc, result);
 }
 
 static int __csum_tree_block_size(struct extent_buffer *buf, u16 csum_size,