diff mbox

btrfs: properly access unaligned checksum buffer

Message ID 1300462105-30680-1-git-send-email-dsterba@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

David Sterba March 18, 2011, 3:28 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e1aa8d6..8065863 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -198,7 +198,11 @@  u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
 
 void btrfs_csum_final(u32 crc, char *result)
 {
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 	*(__le32 *)result = ~cpu_to_le32(crc);
+#else
+	put_unaligned_le32(~crc, result);
+#endif
 }
 
 /*