Commit 2e12b904 authored by Eric Sandeen's avatar Eric Sandeen Committed by Stephen Lord

[XFS] use get/put_unaligned() to avoid unaligned accesses in

the extents code on 64-bit machines

SGI Modid: 2.5.x-xfs:slinx:141495a
parent 99428c84
......@@ -31,6 +31,7 @@
*/
#include <xfs.h>
#include <asm/unaligned.h> /* for get_unaligned, put_unaligned */
kmem_zone_t *xfs_ifork_zone;
......@@ -664,8 +665,10 @@ xfs_iformat_extents(
ep = ifp->if_u1.if_extents;
#if ARCH_CONVERT != ARCH_NOCONVERT
for (i = 0; i < nex; i++, ep++, dp++) {
ep->l0 = INT_GET(dp->l0, ARCH_CONVERT);
ep->l1 = INT_GET(dp->l1, ARCH_CONVERT);
ep->l0 = INT_GET(get_unaligned((u64*)&dp->l0),
ARCH_CONVERT);
ep->l1 = INT_GET(get_unaligned((u64*)&dp->l1),
ARCH_CONVERT);
}
#else
memcpy(ep, dp, size);
......@@ -2704,8 +2707,10 @@ xfs_iextents_copy(
#if ARCH_CONVERT != ARCH_NOCONVERT
/* Translate to on disk format */
dest_ep->l0 = INT_GET(ep->l0, ARCH_CONVERT);
dest_ep->l1 = INT_GET(ep->l1, ARCH_CONVERT);
put_unaligned(INT_GET(ep->l0, ARCH_CONVERT),
(u64*)&dest_ep->l0);
put_unaligned(INT_GET(ep->l1, ARCH_CONVERT),
(u64*)&dest_ep->l1);
#else
*dest_ep = *ep;
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment