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