Commit 1611e861 authored by Nathan Scott's avatar Nathan Scott

[XFS] Fix some remaining unaligned access issues on 64 bit platforms.

SGI Modid: 2.5.x-xfs:slinx:143601a
parent 3dd61759
......@@ -96,11 +96,12 @@ xfs_validate_extents(
xfs_exntfmt_t fmt)
{
xfs_bmbt_irec_t irec;
int i;
xfs_bmbt_rec_t rec;
int i;
for (i = 0; i < nrecs; i++) {
memcpy(&rec, ep, sizeof(rec));
rec.l0 = get_unaligned((__uint64_t*)&ep->l0);
rec.l1 = get_unaligned((__uint64_t*)&ep->l1);
if (disk)
xfs_bmbt_disk_get_all(&rec, &irec);
else
......@@ -691,21 +692,16 @@ xfs_iformat_extents(
ifp->if_bytes = size;
ifp->if_real_bytes = real_size;
if (size) {
xfs_validate_extents(
(xfs_bmbt_rec_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT),
nex, 1, XFS_EXTFMT_INODE(ip));
dp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT);
dp = (xfs_bmbt_rec_t *)
XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT);
xfs_validate_extents(dp, nex, 1, XFS_EXTFMT_INODE(ip));
ep = ifp->if_u1.if_extents;
#if ARCH_CONVERT != ARCH_NOCONVERT
for (i = 0; i < nex; i++, ep++, dp++) {
ep->l0 = INT_GET(get_unaligned((u64*)&dp->l0),
ep->l0 = INT_GET(get_unaligned((__uint64_t*)&dp->l0),
ARCH_CONVERT);
ep->l1 = INT_GET(get_unaligned((u64*)&dp->l1),
ep->l1 = INT_GET(get_unaligned((__uint64_t*)&dp->l1),
ARCH_CONVERT);
}
#else
memcpy(ep, dp, size);
#endif
xfs_bmap_trace_exlist("xfs_iformat_extents", ip, nex,
whichfork);
if (whichfork != XFS_DATA_FORK ||
......@@ -2733,15 +2729,11 @@ xfs_iextents_copy(
continue;
}
#if ARCH_CONVERT != ARCH_NOCONVERT
/* Translate to on disk format */
put_unaligned(INT_GET(ep->l0, ARCH_CONVERT),
(u64*)&dest_ep->l0);
(__uint64_t*)&dest_ep->l0);
put_unaligned(INT_GET(ep->l1, ARCH_CONVERT),
(u64*)&dest_ep->l1);
#else
*dest_ep = *ep;
#endif
(__uint64_t*)&dest_ep->l1);
dest_ep++;
ep++;
copied++;
......
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