aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2015-04-12 21:26:02 -0400
committerDave Chinner <david@fromorbit.com>2015-04-12 21:26:02 -0400
commit2f6612415436bab4d923a61d8df399b134247810 (patch)
treef80ddfe18af6c2f4cffa59bf91caf979e1eb71ae /fs/xfs
parentbbe051c841d522bf2aaa1d362b57fe47457187bf (diff)
xfs: pass attr geometry to attr leaf header conversion functions
The firstused field of the xfs_attr3_leaf_hdr structure is subject to an overflow when fs blocksize is 64k. In preparation to handle this overflow in the header conversion functions, pass the attribute geometry to the functions that convert the in-core structure to and from the on-disk structure. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_attr_leaf.c63
-rw-r--r--fs/xfs/libxfs/xfs_attr_leaf.h6
-rw-r--r--fs/xfs/xfs_attr_inactive.c3
-rw-r--r--fs/xfs/xfs_attr_list.c9
4 files changed, 46 insertions, 35 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index 15105dbc9e28..3337516feeb0 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -88,6 +88,7 @@ STATIC int xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index);
88 88
89void 89void
90xfs_attr3_leaf_hdr_from_disk( 90xfs_attr3_leaf_hdr_from_disk(
91 struct xfs_da_geometry *geo,
91 struct xfs_attr3_icleaf_hdr *to, 92 struct xfs_attr3_icleaf_hdr *to,
92 struct xfs_attr_leafblock *from) 93 struct xfs_attr_leafblock *from)
93{ 94{
@@ -129,6 +130,7 @@ xfs_attr3_leaf_hdr_from_disk(
129 130
130void 131void
131xfs_attr3_leaf_hdr_to_disk( 132xfs_attr3_leaf_hdr_to_disk(
133 struct xfs_da_geometry *geo,
132 struct xfs_attr_leafblock *to, 134 struct xfs_attr_leafblock *to,
133 struct xfs_attr3_icleaf_hdr *from) 135 struct xfs_attr3_icleaf_hdr *from)
134{ 136{
@@ -178,7 +180,7 @@ xfs_attr3_leaf_verify(
178 struct xfs_attr_leafblock *leaf = bp->b_addr; 180 struct xfs_attr_leafblock *leaf = bp->b_addr;
179 struct xfs_attr3_icleaf_hdr ichdr; 181 struct xfs_attr3_icleaf_hdr ichdr;
180 182
181 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 183 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
182 184
183 if (xfs_sb_version_hascrc(&mp->m_sb)) { 185 if (xfs_sb_version_hascrc(&mp->m_sb)) {
184 struct xfs_da3_node_hdr *hdr3 = bp->b_addr; 186 struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
@@ -757,9 +759,10 @@ xfs_attr_shortform_allfit(
757 struct xfs_attr3_icleaf_hdr leafhdr; 759 struct xfs_attr3_icleaf_hdr leafhdr;
758 int bytes; 760 int bytes;
759 int i; 761 int i;
762 struct xfs_mount *mp = bp->b_target->bt_mount;
760 763
761 leaf = bp->b_addr; 764 leaf = bp->b_addr;
762 xfs_attr3_leaf_hdr_from_disk(&leafhdr, leaf); 765 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
763 entry = xfs_attr3_leaf_entryp(leaf); 766 entry = xfs_attr3_leaf_entryp(leaf);
764 767
765 bytes = sizeof(struct xfs_attr_sf_hdr); 768 bytes = sizeof(struct xfs_attr_sf_hdr);
@@ -812,7 +815,7 @@ xfs_attr3_leaf_to_shortform(
812 memcpy(tmpbuffer, bp->b_addr, args->geo->blksize); 815 memcpy(tmpbuffer, bp->b_addr, args->geo->blksize);
813 816
814 leaf = (xfs_attr_leafblock_t *)tmpbuffer; 817 leaf = (xfs_attr_leafblock_t *)tmpbuffer;
815 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 818 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
816 entry = xfs_attr3_leaf_entryp(leaf); 819 entry = xfs_attr3_leaf_entryp(leaf);
817 820
818 /* XXX (dgc): buffer is about to be marked stale - why zero it? */ 821 /* XXX (dgc): buffer is about to be marked stale - why zero it? */
@@ -923,7 +926,7 @@ xfs_attr3_leaf_to_node(
923 btree = dp->d_ops->node_tree_p(node); 926 btree = dp->d_ops->node_tree_p(node);
924 927
925 leaf = bp2->b_addr; 928 leaf = bp2->b_addr;
926 xfs_attr3_leaf_hdr_from_disk(&icleafhdr, leaf); 929 xfs_attr3_leaf_hdr_from_disk(args->geo, &icleafhdr, leaf);
927 entries = xfs_attr3_leaf_entryp(leaf); 930 entries = xfs_attr3_leaf_entryp(leaf);
928 931
929 /* both on-disk, don't endian-flip twice */ 932 /* both on-disk, don't endian-flip twice */
@@ -988,7 +991,7 @@ xfs_attr3_leaf_create(
988 } 991 }
989 ichdr.freemap[0].size = ichdr.firstused - ichdr.freemap[0].base; 992 ichdr.freemap[0].size = ichdr.firstused - ichdr.freemap[0].base;
990 993
991 xfs_attr3_leaf_hdr_to_disk(leaf, &ichdr); 994 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
992 xfs_trans_log_buf(args->trans, bp, 0, args->geo->blksize - 1); 995 xfs_trans_log_buf(args->trans, bp, 0, args->geo->blksize - 1);
993 996
994 *bpp = bp; 997 *bpp = bp;
@@ -1073,7 +1076,7 @@ xfs_attr3_leaf_add(
1073 trace_xfs_attr_leaf_add(args); 1076 trace_xfs_attr_leaf_add(args);
1074 1077
1075 leaf = bp->b_addr; 1078 leaf = bp->b_addr;
1076 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 1079 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
1077 ASSERT(args->index >= 0 && args->index <= ichdr.count); 1080 ASSERT(args->index >= 0 && args->index <= ichdr.count);
1078 entsize = xfs_attr_leaf_newentsize(args, NULL); 1081 entsize = xfs_attr_leaf_newentsize(args, NULL);
1079 1082
@@ -1126,7 +1129,7 @@ xfs_attr3_leaf_add(
1126 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0); 1129 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0);
1127 1130
1128out_log_hdr: 1131out_log_hdr:
1129 xfs_attr3_leaf_hdr_to_disk(leaf, &ichdr); 1132 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
1130 xfs_trans_log_buf(args->trans, bp, 1133 xfs_trans_log_buf(args->trans, bp,
1131 XFS_DA_LOGRANGE(leaf, &leaf->hdr, 1134 XFS_DA_LOGRANGE(leaf, &leaf->hdr,
1132 xfs_attr3_leaf_hdr_size(leaf))); 1135 xfs_attr3_leaf_hdr_size(leaf)));
@@ -1294,7 +1297,7 @@ xfs_attr3_leaf_compact(
1294 ichdr_dst->freemap[0].base; 1297 ichdr_dst->freemap[0].base;
1295 1298
1296 /* write the header back to initialise the underlying buffer */ 1299 /* write the header back to initialise the underlying buffer */
1297 xfs_attr3_leaf_hdr_to_disk(leaf_dst, ichdr_dst); 1300 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf_dst, ichdr_dst);
1298 1301
1299 /* 1302 /*
1300 * Copy all entry's in the same (sorted) order, 1303 * Copy all entry's in the same (sorted) order,
@@ -1344,9 +1347,10 @@ xfs_attr_leaf_order(
1344{ 1347{
1345 struct xfs_attr3_icleaf_hdr ichdr1; 1348 struct xfs_attr3_icleaf_hdr ichdr1;
1346 struct xfs_attr3_icleaf_hdr ichdr2; 1349 struct xfs_attr3_icleaf_hdr ichdr2;
1350 struct xfs_mount *mp = leaf1_bp->b_target->bt_mount;
1347 1351
1348 xfs_attr3_leaf_hdr_from_disk(&ichdr1, leaf1_bp->b_addr); 1352 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr1, leaf1_bp->b_addr);
1349 xfs_attr3_leaf_hdr_from_disk(&ichdr2, leaf2_bp->b_addr); 1353 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr2, leaf2_bp->b_addr);
1350 return xfs_attr3_leaf_order(leaf1_bp, &ichdr1, leaf2_bp, &ichdr2); 1354 return xfs_attr3_leaf_order(leaf1_bp, &ichdr1, leaf2_bp, &ichdr2);
1351} 1355}
1352 1356
@@ -1388,8 +1392,8 @@ xfs_attr3_leaf_rebalance(
1388 ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC); 1392 ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC);
1389 leaf1 = blk1->bp->b_addr; 1393 leaf1 = blk1->bp->b_addr;
1390 leaf2 = blk2->bp->b_addr; 1394 leaf2 = blk2->bp->b_addr;
1391 xfs_attr3_leaf_hdr_from_disk(&ichdr1, leaf1); 1395 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr1, leaf1);
1392 xfs_attr3_leaf_hdr_from_disk(&ichdr2, leaf2); 1396 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr2, leaf2);
1393 ASSERT(ichdr2.count == 0); 1397 ASSERT(ichdr2.count == 0);
1394 args = state->args; 1398 args = state->args;
1395 1399
@@ -1490,8 +1494,8 @@ xfs_attr3_leaf_rebalance(
1490 ichdr1.count, count); 1494 ichdr1.count, count);
1491 } 1495 }
1492 1496
1493 xfs_attr3_leaf_hdr_to_disk(leaf1, &ichdr1); 1497 xfs_attr3_leaf_hdr_to_disk(state->args->geo, leaf1, &ichdr1);
1494 xfs_attr3_leaf_hdr_to_disk(leaf2, &ichdr2); 1498 xfs_attr3_leaf_hdr_to_disk(state->args->geo, leaf2, &ichdr2);
1495 xfs_trans_log_buf(args->trans, blk1->bp, 0, args->geo->blksize - 1); 1499 xfs_trans_log_buf(args->trans, blk1->bp, 0, args->geo->blksize - 1);
1496 xfs_trans_log_buf(args->trans, blk2->bp, 0, args->geo->blksize - 1); 1500 xfs_trans_log_buf(args->trans, blk2->bp, 0, args->geo->blksize - 1);
1497 1501
@@ -1684,7 +1688,7 @@ xfs_attr3_leaf_toosmall(
1684 */ 1688 */
1685 blk = &state->path.blk[ state->path.active-1 ]; 1689 blk = &state->path.blk[ state->path.active-1 ];
1686 leaf = blk->bp->b_addr; 1690 leaf = blk->bp->b_addr;
1687 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 1691 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf);
1688 bytes = xfs_attr3_leaf_hdr_size(leaf) + 1692 bytes = xfs_attr3_leaf_hdr_size(leaf) +
1689 ichdr.count * sizeof(xfs_attr_leaf_entry_t) + 1693 ichdr.count * sizeof(xfs_attr_leaf_entry_t) +
1690 ichdr.usedbytes; 1694 ichdr.usedbytes;
@@ -1740,7 +1744,7 @@ xfs_attr3_leaf_toosmall(
1740 if (error) 1744 if (error)
1741 return error; 1745 return error;
1742 1746
1743 xfs_attr3_leaf_hdr_from_disk(&ichdr2, bp->b_addr); 1747 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr2, bp->b_addr);
1744 1748
1745 bytes = state->args->geo->blksize - 1749 bytes = state->args->geo->blksize -
1746 (state->args->geo->blksize >> 2) - 1750 (state->args->geo->blksize >> 2) -
@@ -1805,7 +1809,7 @@ xfs_attr3_leaf_remove(
1805 trace_xfs_attr_leaf_remove(args); 1809 trace_xfs_attr_leaf_remove(args);
1806 1810
1807 leaf = bp->b_addr; 1811 leaf = bp->b_addr;
1808 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 1812 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
1809 1813
1810 ASSERT(ichdr.count > 0 && ichdr.count < args->geo->blksize / 8); 1814 ASSERT(ichdr.count > 0 && ichdr.count < args->geo->blksize / 8);
1811 ASSERT(args->index >= 0 && args->index < ichdr.count); 1815 ASSERT(args->index >= 0 && args->index < ichdr.count);
@@ -1923,7 +1927,7 @@ xfs_attr3_leaf_remove(
1923 } else { 1927 } else {
1924 ichdr.holes = 1; /* mark as needing compaction */ 1928 ichdr.holes = 1; /* mark as needing compaction */
1925 } 1929 }
1926 xfs_attr3_leaf_hdr_to_disk(leaf, &ichdr); 1930 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
1927 xfs_trans_log_buf(args->trans, bp, 1931 xfs_trans_log_buf(args->trans, bp,
1928 XFS_DA_LOGRANGE(leaf, &leaf->hdr, 1932 XFS_DA_LOGRANGE(leaf, &leaf->hdr,
1929 xfs_attr3_leaf_hdr_size(leaf))); 1933 xfs_attr3_leaf_hdr_size(leaf)));
@@ -1957,8 +1961,8 @@ xfs_attr3_leaf_unbalance(
1957 1961
1958 drop_leaf = drop_blk->bp->b_addr; 1962 drop_leaf = drop_blk->bp->b_addr;
1959 save_leaf = save_blk->bp->b_addr; 1963 save_leaf = save_blk->bp->b_addr;
1960 xfs_attr3_leaf_hdr_from_disk(&drophdr, drop_leaf); 1964 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &drophdr, drop_leaf);
1961 xfs_attr3_leaf_hdr_from_disk(&savehdr, save_leaf); 1965 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &savehdr, save_leaf);
1962 entry = xfs_attr3_leaf_entryp(drop_leaf); 1966 entry = xfs_attr3_leaf_entryp(drop_leaf);
1963 1967
1964 /* 1968 /*
@@ -2012,7 +2016,7 @@ xfs_attr3_leaf_unbalance(
2012 tmphdr.firstused = state->args->geo->blksize; 2016 tmphdr.firstused = state->args->geo->blksize;
2013 2017
2014 /* write the header to the temp buffer to initialise it */ 2018 /* write the header to the temp buffer to initialise it */
2015 xfs_attr3_leaf_hdr_to_disk(tmp_leaf, &tmphdr); 2019 xfs_attr3_leaf_hdr_to_disk(state->args->geo, tmp_leaf, &tmphdr);
2016 2020
2017 if (xfs_attr3_leaf_order(save_blk->bp, &savehdr, 2021 if (xfs_attr3_leaf_order(save_blk->bp, &savehdr,
2018 drop_blk->bp, &drophdr)) { 2022 drop_blk->bp, &drophdr)) {
@@ -2039,7 +2043,7 @@ xfs_attr3_leaf_unbalance(
2039 kmem_free(tmp_leaf); 2043 kmem_free(tmp_leaf);
2040 } 2044 }
2041 2045
2042 xfs_attr3_leaf_hdr_to_disk(save_leaf, &savehdr); 2046 xfs_attr3_leaf_hdr_to_disk(state->args->geo, save_leaf, &savehdr);
2043 xfs_trans_log_buf(state->args->trans, save_blk->bp, 0, 2047 xfs_trans_log_buf(state->args->trans, save_blk->bp, 0,
2044 state->args->geo->blksize - 1); 2048 state->args->geo->blksize - 1);
2045 2049
@@ -2085,7 +2089,7 @@ xfs_attr3_leaf_lookup_int(
2085 trace_xfs_attr_leaf_lookup(args); 2089 trace_xfs_attr_leaf_lookup(args);
2086 2090
2087 leaf = bp->b_addr; 2091 leaf = bp->b_addr;
2088 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 2092 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2089 entries = xfs_attr3_leaf_entryp(leaf); 2093 entries = xfs_attr3_leaf_entryp(leaf);
2090 ASSERT(ichdr.count < args->geo->blksize / 8); 2094 ASSERT(ichdr.count < args->geo->blksize / 8);
2091 2095
@@ -2190,7 +2194,7 @@ xfs_attr3_leaf_getvalue(
2190 int valuelen; 2194 int valuelen;
2191 2195
2192 leaf = bp->b_addr; 2196 leaf = bp->b_addr;
2193 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 2197 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2194 ASSERT(ichdr.count < args->geo->blksize / 8); 2198 ASSERT(ichdr.count < args->geo->blksize / 8);
2195 ASSERT(args->index < ichdr.count); 2199 ASSERT(args->index < ichdr.count);
2196 2200
@@ -2391,8 +2395,9 @@ xfs_attr_leaf_lasthash(
2391{ 2395{
2392 struct xfs_attr3_icleaf_hdr ichdr; 2396 struct xfs_attr3_icleaf_hdr ichdr;
2393 struct xfs_attr_leaf_entry *entries; 2397 struct xfs_attr_leaf_entry *entries;
2398 struct xfs_mount *mp = bp->b_target->bt_mount;
2394 2399
2395 xfs_attr3_leaf_hdr_from_disk(&ichdr, bp->b_addr); 2400 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr);
2396 entries = xfs_attr3_leaf_entryp(bp->b_addr); 2401 entries = xfs_attr3_leaf_entryp(bp->b_addr);
2397 if (count) 2402 if (count)
2398 *count = ichdr.count; 2403 *count = ichdr.count;
@@ -2486,7 +2491,7 @@ xfs_attr3_leaf_clearflag(
2486 ASSERT(entry->flags & XFS_ATTR_INCOMPLETE); 2491 ASSERT(entry->flags & XFS_ATTR_INCOMPLETE);
2487 2492
2488#ifdef DEBUG 2493#ifdef DEBUG
2489 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 2494 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2490 ASSERT(args->index < ichdr.count); 2495 ASSERT(args->index < ichdr.count);
2491 ASSERT(args->index >= 0); 2496 ASSERT(args->index >= 0);
2492 2497
@@ -2550,7 +2555,7 @@ xfs_attr3_leaf_setflag(
2550 2555
2551 leaf = bp->b_addr; 2556 leaf = bp->b_addr;
2552#ifdef DEBUG 2557#ifdef DEBUG
2553 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 2558 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2554 ASSERT(args->index < ichdr.count); 2559 ASSERT(args->index < ichdr.count);
2555 ASSERT(args->index >= 0); 2560 ASSERT(args->index >= 0);
2556#endif 2561#endif
@@ -2629,11 +2634,11 @@ xfs_attr3_leaf_flipflags(
2629 entry2 = &xfs_attr3_leaf_entryp(leaf2)[args->index2]; 2634 entry2 = &xfs_attr3_leaf_entryp(leaf2)[args->index2];
2630 2635
2631#ifdef DEBUG 2636#ifdef DEBUG
2632 xfs_attr3_leaf_hdr_from_disk(&ichdr1, leaf1); 2637 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr1, leaf1);
2633 ASSERT(args->index < ichdr1.count); 2638 ASSERT(args->index < ichdr1.count);
2634 ASSERT(args->index >= 0); 2639 ASSERT(args->index >= 0);
2635 2640
2636 xfs_attr3_leaf_hdr_from_disk(&ichdr2, leaf2); 2641 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr2, leaf2);
2637 ASSERT(args->index2 < ichdr2.count); 2642 ASSERT(args->index2 < ichdr2.count);
2638 ASSERT(args->index2 >= 0); 2643 ASSERT(args->index2 >= 0);
2639 2644
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h
index e2929da7c3ba..025c4b820c03 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.h
+++ b/fs/xfs/libxfs/xfs_attr_leaf.h
@@ -100,9 +100,11 @@ int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
100int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, 100int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
101 xfs_dablk_t bno, xfs_daddr_t mappedbno, 101 xfs_dablk_t bno, xfs_daddr_t mappedbno,
102 struct xfs_buf **bpp); 102 struct xfs_buf **bpp);
103void xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to, 103void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
104 struct xfs_attr3_icleaf_hdr *to,
104 struct xfs_attr_leafblock *from); 105 struct xfs_attr_leafblock *from);
105void xfs_attr3_leaf_hdr_to_disk(struct xfs_attr_leafblock *to, 106void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
107 struct xfs_attr_leafblock *to,
106 struct xfs_attr3_icleaf_hdr *from); 108 struct xfs_attr3_icleaf_hdr *from);
107 109
108#endif /* __XFS_ATTR_LEAF_H__ */ 110#endif /* __XFS_ATTR_LEAF_H__ */
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c
index 83af4c149635..f9c1c64782d3 100644
--- a/fs/xfs/xfs_attr_inactive.c
+++ b/fs/xfs/xfs_attr_inactive.c
@@ -132,9 +132,10 @@ xfs_attr3_leaf_inactive(
132 int size; 132 int size;
133 int tmp; 133 int tmp;
134 int i; 134 int i;
135 struct xfs_mount *mp = bp->b_target->bt_mount;
135 136
136 leaf = bp->b_addr; 137 leaf = bp->b_addr;
137 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 138 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
138 139
139 /* 140 /*
140 * Count the number of "remote" value extents. 141 * Count the number of "remote" value extents.
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index a43d370d2c58..65fb37a18e92 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -225,6 +225,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
225 int error, i; 225 int error, i;
226 struct xfs_buf *bp; 226 struct xfs_buf *bp;
227 struct xfs_inode *dp = context->dp; 227 struct xfs_inode *dp = context->dp;
228 struct xfs_mount *mp = dp->i_mount;
228 229
229 trace_xfs_attr_node_list(context); 230 trace_xfs_attr_node_list(context);
230 231
@@ -256,7 +257,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
256 case XFS_ATTR_LEAF_MAGIC: 257 case XFS_ATTR_LEAF_MAGIC:
257 case XFS_ATTR3_LEAF_MAGIC: 258 case XFS_ATTR3_LEAF_MAGIC:
258 leaf = bp->b_addr; 259 leaf = bp->b_addr;
259 xfs_attr3_leaf_hdr_from_disk(&leafhdr, leaf); 260 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo,
261 &leafhdr, leaf);
260 entries = xfs_attr3_leaf_entryp(leaf); 262 entries = xfs_attr3_leaf_entryp(leaf);
261 if (cursor->hashval > be32_to_cpu( 263 if (cursor->hashval > be32_to_cpu(
262 entries[leafhdr.count - 1].hashval)) { 264 entries[leafhdr.count - 1].hashval)) {
@@ -340,7 +342,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
340 xfs_trans_brelse(NULL, bp); 342 xfs_trans_brelse(NULL, bp);
341 return error; 343 return error;
342 } 344 }
343 xfs_attr3_leaf_hdr_from_disk(&leafhdr, leaf); 345 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
344 if (context->seen_enough || leafhdr.forw == 0) 346 if (context->seen_enough || leafhdr.forw == 0)
345 break; 347 break;
346 cursor->blkno = leafhdr.forw; 348 cursor->blkno = leafhdr.forw;
@@ -368,11 +370,12 @@ xfs_attr3_leaf_list_int(
368 struct xfs_attr_leaf_entry *entry; 370 struct xfs_attr_leaf_entry *entry;
369 int retval; 371 int retval;
370 int i; 372 int i;
373 struct xfs_mount *mp = context->dp->i_mount;
371 374
372 trace_xfs_attr_list_leaf(context); 375 trace_xfs_attr_list_leaf(context);
373 376
374 leaf = bp->b_addr; 377 leaf = bp->b_addr;
375 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 378 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
376 entries = xfs_attr3_leaf_entryp(leaf); 379 entries = xfs_attr3_leaf_entryp(leaf);
377 380
378 cursor = context->cursor; 381 cursor = context->cursor;