linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: chris.mason@oracle.com
Cc: linux-btrfs@vger.kernel.org, adrien.dessemond@gmail.com,
	David Sterba <dsterba@suse.cz>
Subject: [PATCH] btrfs: properly access unaligned checksum buffer
Date: Fri, 18 Mar 2011 16:28:25 +0100	[thread overview]
Message-ID: <1300462105-30680-1-git-send-email-dsterba@suse.cz> (raw)

fixes https://bugzilla.kernel.org/show_bug.cgi?id=29142
reported on SPARC64, warnings like:

[ 1523.941667] Kernel unaligned access at TPC[100e4034]
btrfs_csum_final+0x38/0x3c [btrfs]

Reported-by: Adrien Dessemond <adrien.dessemond@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Tested-by: Adrien Dessemond <adrien.dessemond@gmail.com>
---
 fs/btrfs/disk-io.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

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
 }
 
 /*
-- 
1.7.4.1.176.g501cc


             reply	other threads:[~2011-03-18 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 15:28 David Sterba [this message]
2011-03-18 15:56 ` [PATCH] btrfs: properly access unaligned checksum buffer Chris Mason
2011-03-18 22:56   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300462105-30680-1-git-send-email-dsterba@suse.cz \
    --to=dsterba@suse.cz \
    --cc=adrien.dessemond@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).