aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_da_btree.c22
-rw-r--r--fs/xfs/xfs_dir2.c7
-rw-r--r--fs/xfs/xfs_dir2_block.c6
-rw-r--r--fs/xfs/xfs_dir2_data.c9
-rw-r--r--fs/xfs/xfs_dir2_leaf.c12
-rw-r--r--fs/xfs/xfs_dir2_readdir.c18
-rw-r--r--fs/xfs/xfs_dir2_sf.c2
-rw-r--r--fs/xfs/xfs_mount.h3
8 files changed, 37 insertions, 42 deletions
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 9eec594cc25a..1009a319a786 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -598,7 +598,7 @@ xfs_da3_root_split(
598 * Set up the new root node. 598 * Set up the new root node.
599 */ 599 */
600 error = xfs_da3_node_create(args, 600 error = xfs_da3_node_create(args,
601 (args->whichfork == XFS_DATA_FORK) ? mp->m_dirleafblk : 0, 601 (args->whichfork == XFS_DATA_FORK) ? args->geo->leafblk : 0,
602 level + 1, &bp, args->whichfork); 602 level + 1, &bp, args->whichfork);
603 if (error) 603 if (error)
604 return error; 604 return error;
@@ -616,10 +616,10 @@ xfs_da3_root_split(
616#ifdef DEBUG 616#ifdef DEBUG
617 if (oldroot->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || 617 if (oldroot->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
618 oldroot->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)) { 618 oldroot->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)) {
619 ASSERT(blk1->blkno >= mp->m_dirleafblk && 619 ASSERT(blk1->blkno >= args->geo->leafblk &&
620 blk1->blkno < mp->m_dirfreeblk); 620 blk1->blkno < args->geo->freeblk);
621 ASSERT(blk2->blkno >= mp->m_dirleafblk && 621 ASSERT(blk2->blkno >= args->geo->leafblk &&
622 blk2->blkno < mp->m_dirfreeblk); 622 blk2->blkno < args->geo->freeblk);
623 } 623 }
624#endif 624#endif
625 625
@@ -894,8 +894,8 @@ xfs_da3_node_add(
894 ASSERT(oldblk->index >= 0 && oldblk->index <= nodehdr.count); 894 ASSERT(oldblk->index >= 0 && oldblk->index <= nodehdr.count);
895 ASSERT(newblk->blkno != 0); 895 ASSERT(newblk->blkno != 0);
896 if (state->args->whichfork == XFS_DATA_FORK) 896 if (state->args->whichfork == XFS_DATA_FORK)
897 ASSERT(newblk->blkno >= state->mp->m_dirleafblk && 897 ASSERT(newblk->blkno >= state->args->geo->leafblk &&
898 newblk->blkno < state->mp->m_dirfreeblk); 898 newblk->blkno < state->args->geo->freeblk);
899 899
900 /* 900 /*
901 * We may need to make some room before we insert the new node. 901 * We may need to make some room before we insert the new node.
@@ -1472,7 +1472,7 @@ xfs_da3_node_lookup_int(
1472 * Descend thru the B-tree searching each level for the right 1472 * Descend thru the B-tree searching each level for the right
1473 * node to use, until the right hashval is found. 1473 * node to use, until the right hashval is found.
1474 */ 1474 */
1475 blkno = (args->whichfork == XFS_DATA_FORK)? state->mp->m_dirleafblk : 0; 1475 blkno = (args->whichfork == XFS_DATA_FORK)? args->geo->leafblk : 0;
1476 for (blk = &state->path.blk[0], state->path.active = 1; 1476 for (blk = &state->path.blk[0], state->path.active = 1;
1477 state->path.active <= XFS_DA_NODE_MAXDEPTH; 1477 state->path.active <= XFS_DA_NODE_MAXDEPTH;
1478 blk++, state->path.active++) { 1478 blk++, state->path.active++) {
@@ -2096,7 +2096,7 @@ xfs_da_grow_inode(
2096 trace_xfs_da_grow_inode(args); 2096 trace_xfs_da_grow_inode(args);
2097 2097
2098 if (args->whichfork == XFS_DATA_FORK) { 2098 if (args->whichfork == XFS_DATA_FORK) {
2099 bno = args->dp->i_mount->m_dirleafblk; 2099 bno = args->geo->leafblk;
2100 count = args->dp->i_mount->m_dirblkfsbs; 2100 count = args->dp->i_mount->m_dirblkfsbs;
2101 } else { 2101 } else {
2102 bno = 0; 2102 bno = 0;
@@ -2158,7 +2158,7 @@ xfs_da3_swap_lastblock(
2158 w = args->whichfork; 2158 w = args->whichfork;
2159 ASSERT(w == XFS_DATA_FORK); 2159 ASSERT(w == XFS_DATA_FORK);
2160 mp = dp->i_mount; 2160 mp = dp->i_mount;
2161 lastoff = mp->m_dirfreeblk; 2161 lastoff = args->geo->freeblk;
2162 error = xfs_bmap_last_before(tp, dp, &lastoff, w); 2162 error = xfs_bmap_last_before(tp, dp, &lastoff, w);
2163 if (error) 2163 if (error)
2164 return error; 2164 return error;
@@ -2247,7 +2247,7 @@ xfs_da3_swap_lastblock(
2247 sizeof(sib_info->back))); 2247 sizeof(sib_info->back)));
2248 sib_buf = NULL; 2248 sib_buf = NULL;
2249 } 2249 }
2250 par_blkno = mp->m_dirleafblk; 2250 par_blkno = args->geo->leafblk;
2251 level = -1; 2251 level = -1;
2252 /* 2252 /*
2253 * Walk down the tree looking for the parent of the moved block. 2253 * Walk down the tree looking for the parent of the moved block.
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index 886a67d92f63..77d6882c46b0 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -147,9 +147,6 @@ xfs_da_mount(
147 /* XXX: these are to be removed as code is converted to use geo */ 147 /* XXX: these are to be removed as code is converted to use geo */
148 mp->m_dirblksize = mp->m_dir_geo->blksize; 148 mp->m_dirblksize = mp->m_dir_geo->blksize;
149 mp->m_dirblkfsbs = mp->m_dir_geo->fsbcount; 149 mp->m_dirblkfsbs = mp->m_dir_geo->fsbcount;
150 mp->m_dirdatablk = mp->m_dir_geo->datablk;
151 mp->m_dirleafblk = mp->m_dir_geo->leafblk;
152 mp->m_dirfreeblk = mp->m_dir_geo->freeblk;
153 mp->m_dir_node_ents = mp->m_dir_geo->node_ents; 150 mp->m_dir_node_ents = mp->m_dir_geo->node_ents;
154 mp->m_dir_magicpct = mp->m_dir_geo->magicpct; 151 mp->m_dir_magicpct = mp->m_dir_geo->magicpct;
155 mp->m_attr_node_ents = mp->m_attr_geo->node_ents; 152 mp->m_attr_node_ents = mp->m_attr_geo->node_ents;
@@ -690,7 +687,7 @@ xfs_dir2_isleaf(
690 mp = dp->i_mount; 687 mp = dp->i_mount;
691 if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK))) 688 if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK)))
692 return rval; 689 return rval;
693 *vp = last == mp->m_dirleafblk + (1 << mp->m_sb.sb_dirblklog); 690 *vp = last == mp->m_dir_geo->leafblk + (1 << mp->m_sb.sb_dirblklog);
694 return 0; 691 return 0;
695} 692}
696 693
@@ -763,7 +760,7 @@ xfs_dir2_shrink_inode(
763 */ 760 */
764 return error; 761 return error;
765 } 762 }
766 if (db == mp->m_dirdatablk) 763 if (db == args->geo->datablk)
767 ASSERT(bno == 0); 764 ASSERT(bno == 0);
768 else 765 else
769 ASSERT(bno > 0); 766 ASSERT(bno > 0);
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index bc08216089d8..d950cde3afeb 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -136,7 +136,7 @@ xfs_dir3_block_read(
136 struct xfs_mount *mp = dp->i_mount; 136 struct xfs_mount *mp = dp->i_mount;
137 int err; 137 int err;
138 138
139 err = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, bpp, 139 err = xfs_da_read_buf(tp, dp, mp->m_dir_geo->datablk, -1, bpp,
140 XFS_DATA_FORK, &xfs_dir3_block_buf_ops); 140 XFS_DATA_FORK, &xfs_dir3_block_buf_ops);
141 if (!err && tp) 141 if (!err && tp)
142 xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_DIR_BLOCK_BUF); 142 xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_DIR_BLOCK_BUF);
@@ -969,7 +969,7 @@ xfs_dir2_leaf_to_block(
969 * Read the data block if we don't already have it, give up if it fails. 969 * Read the data block if we don't already have it, give up if it fails.
970 */ 970 */
971 if (!dbp) { 971 if (!dbp) {
972 error = xfs_dir3_data_read(tp, dp, mp->m_dirdatablk, -1, &dbp); 972 error = xfs_dir3_data_read(tp, dp, args->geo->datablk, -1, &dbp);
973 if (error) 973 if (error)
974 return error; 974 return error;
975 } 975 }
@@ -1034,7 +1034,7 @@ xfs_dir2_leaf_to_block(
1034 /* 1034 /*
1035 * Pitch the old leaf block. 1035 * Pitch the old leaf block.
1036 */ 1036 */
1037 error = xfs_da_shrink_inode(args, mp->m_dirleafblk, lbp); 1037 error = xfs_da_shrink_inode(args, args->geo->leafblk, lbp);
1038 if (error) 1038 if (error)
1039 return error; 1039 return error;
1040 1040
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index d355ec7d35cd..6c23f86e0148 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -63,8 +63,10 @@ __xfs_dir3_data_check(
63 int stale; /* count of stale leaves */ 63 int stale; /* count of stale leaves */
64 struct xfs_name name; 64 struct xfs_name name;
65 const struct xfs_dir_ops *ops; 65 const struct xfs_dir_ops *ops;
66 struct xfs_da_geometry *geo;
66 67
67 mp = bp->b_target->bt_mount; 68 mp = bp->b_target->bt_mount;
69 geo = mp->m_dir_geo;
68 70
69 /* 71 /*
70 * We can be passed a null dp here from a verifier, so we need to go the 72 * We can be passed a null dp here from a verifier, so we need to go the
@@ -172,10 +174,9 @@ __xfs_dir3_data_check(
172 lastfree = 0; 174 lastfree = 0;
173 if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 175 if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
174 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { 176 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) {
175 addr = xfs_dir2_db_off_to_dataptr(mp->m_dir_geo, 177 addr = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
176 mp->m_dirdatablk, 178 (xfs_dir2_data_aoff_t)
177 (xfs_dir2_data_aoff_t) 179 ((char *)dep - (char *)hdr));
178 ((char *)dep - (char *)hdr));
179 name.name = dep->name; 180 name.name = dep->name;
180 name.len = dep->namelen; 181 name.len = dep->namelen;
181 hash = mp->m_dirnameops->hashname(&name); 182 hash = mp->m_dirnameops->hashname(&name);
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 2b3ddd061d0e..3eb8b240d018 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -641,7 +641,7 @@ xfs_dir2_leaf_addname(
641 tp = args->trans; 641 tp = args->trans;
642 mp = dp->i_mount; 642 mp = dp->i_mount;
643 643
644 error = xfs_dir3_leaf_read(tp, dp, mp->m_dirleafblk, -1, &lbp); 644 error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, -1, &lbp);
645 if (error) 645 if (error)
646 return error; 646 return error;
647 647
@@ -1232,7 +1232,7 @@ xfs_dir2_leaf_lookup_int(
1232 tp = args->trans; 1232 tp = args->trans;
1233 mp = dp->i_mount; 1233 mp = dp->i_mount;
1234 1234
1235 error = xfs_dir3_leaf_read(tp, dp, mp->m_dirleafblk, -1, &lbp); 1235 error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, -1, &lbp);
1236 if (error) 1236 if (error)
1237 return error; 1237 return error;
1238 1238
@@ -1429,7 +1429,7 @@ xfs_dir2_leaf_removename(
1429 */ 1429 */
1430 if (be16_to_cpu(bf[0].length) == 1430 if (be16_to_cpu(bf[0].length) ==
1431 mp->m_dirblksize - dp->d_ops->data_entry_offset) { 1431 mp->m_dirblksize - dp->d_ops->data_entry_offset) {
1432 ASSERT(db != mp->m_dirdatablk); 1432 ASSERT(db != args->geo->datablk);
1433 if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { 1433 if ((error = xfs_dir2_shrink_inode(args, db, dbp))) {
1434 /* 1434 /*
1435 * Nope, can't get rid of it because it caused 1435 * Nope, can't get rid of it because it caused
@@ -1470,7 +1470,7 @@ xfs_dir2_leaf_removename(
1470 /* 1470 /*
1471 * If the data block was not the first one, drop it. 1471 * If the data block was not the first one, drop it.
1472 */ 1472 */
1473 else if (db != mp->m_dirdatablk) 1473 else if (db != args->geo->datablk)
1474 dbp = NULL; 1474 dbp = NULL;
1475 1475
1476 xfs_dir3_leaf_check(dp, lbp); 1476 xfs_dir3_leaf_check(dp, lbp);
@@ -1722,7 +1722,7 @@ xfs_dir2_node_to_leaf(
1722 * that may have been left behind during no-space-reservation 1722 * that may have been left behind during no-space-reservation
1723 * operations. 1723 * operations.
1724 */ 1724 */
1725 while (fo > mp->m_dirfreeblk) { 1725 while (fo > args->geo->freeblk) {
1726 if ((error = xfs_dir2_node_trim_free(args, fo, &rval))) { 1726 if ((error = xfs_dir2_node_trim_free(args, fo, &rval))) {
1727 return error; 1727 return error;
1728 } 1728 }
@@ -1752,7 +1752,7 @@ xfs_dir2_node_to_leaf(
1752 /* 1752 /*
1753 * Read the freespace block. 1753 * Read the freespace block.
1754 */ 1754 */
1755 error = xfs_dir2_free_read(tp, dp, mp->m_dirfreeblk, &fbp); 1755 error = xfs_dir2_free_read(tp, dp, args->geo->freeblk, &fbp);
1756 if (error) 1756 if (error)
1757 return error; 1757 return error;
1758 free = fbp->b_addr; 1758 free = fbp->b_addr;
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index c2a63878d27c..0c8c09cf313f 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -111,18 +111,18 @@ xfs_dir2_sf_getdents(
111 /* 111 /*
112 * If the block number in the offset is out of range, we're done. 112 * If the block number in the offset is out of range, we're done.
113 */ 113 */
114 if (xfs_dir2_dataptr_to_db(geo, ctx->pos) > mp->m_dirdatablk) 114 if (xfs_dir2_dataptr_to_db(geo, ctx->pos) > geo->datablk)
115 return 0; 115 return 0;
116 116
117 /* 117 /*
118 * Precalculate offsets for . and .. as we will always need them. 118 * Precalculate offsets for . and .. as we will always need them.
119 * 119 *
120 * XXX(hch): the second argument is sometimes 0 and sometimes 120 * XXX(hch): the second argument is sometimes 0 and sometimes
121 * mp->m_dirdatablk. 121 * geo->datablk
122 */ 122 */
123 dot_offset = xfs_dir2_db_off_to_dataptr(geo, mp->m_dirdatablk, 123 dot_offset = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
124 dp->d_ops->data_dot_offset); 124 dp->d_ops->data_dot_offset);
125 dotdot_offset = xfs_dir2_db_off_to_dataptr(geo, mp->m_dirdatablk, 125 dotdot_offset = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
126 dp->d_ops->data_dotdot_offset); 126 dp->d_ops->data_dotdot_offset);
127 127
128 /* 128 /*
@@ -151,7 +151,7 @@ xfs_dir2_sf_getdents(
151 for (i = 0; i < sfp->count; i++) { 151 for (i = 0; i < sfp->count; i++) {
152 __uint8_t filetype; 152 __uint8_t filetype;
153 153
154 off = xfs_dir2_db_off_to_dataptr(geo, mp->m_dirdatablk, 154 off = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
155 xfs_dir2_sf_get_offset(sfep)); 155 xfs_dir2_sf_get_offset(sfep));
156 156
157 if (ctx->pos > off) { 157 if (ctx->pos > off) {
@@ -168,7 +168,7 @@ xfs_dir2_sf_getdents(
168 sfep = dp->d_ops->sf_nextentry(sfp, sfep); 168 sfep = dp->d_ops->sf_nextentry(sfp, sfep);
169 } 169 }
170 170
171 ctx->pos = xfs_dir2_db_off_to_dataptr(geo, mp->m_dirdatablk + 1, 0) & 171 ctx->pos = xfs_dir2_db_off_to_dataptr(geo, geo->datablk + 1, 0) &
172 0x7fffffff; 172 0x7fffffff;
173 return 0; 173 return 0;
174} 174}
@@ -199,7 +199,7 @@ xfs_dir2_block_getdents(
199 /* 199 /*
200 * If the block number in the offset is out of range, we're done. 200 * If the block number in the offset is out of range, we're done.
201 */ 201 */
202 if (xfs_dir2_dataptr_to_db(geo, ctx->pos) > mp->m_dirdatablk) 202 if (xfs_dir2_dataptr_to_db(geo, ctx->pos) > geo->datablk)
203 return 0; 203 return 0;
204 204
205 error = xfs_dir3_block_read(NULL, dp, &bp); 205 error = xfs_dir3_block_read(NULL, dp, &bp);
@@ -248,7 +248,7 @@ xfs_dir2_block_getdents(
248 if ((char *)dep - (char *)hdr < wantoff) 248 if ((char *)dep - (char *)hdr < wantoff)
249 continue; 249 continue;
250 250
251 cook = xfs_dir2_db_off_to_dataptr(geo, mp->m_dirdatablk, 251 cook = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
252 (char *)dep - (char *)hdr); 252 (char *)dep - (char *)hdr);
253 253
254 ctx->pos = cook & 0x7fffffff; 254 ctx->pos = cook & 0x7fffffff;
@@ -268,7 +268,7 @@ xfs_dir2_block_getdents(
268 * Reached the end of the block. 268 * Reached the end of the block.
269 * Set the offset to a non-existent block 1 and return. 269 * Set the offset to a non-existent block 1 and return.
270 */ 270 */
271 ctx->pos = xfs_dir2_db_off_to_dataptr(geo, mp->m_dirdatablk + 1, 0) & 271 ctx->pos = xfs_dir2_db_off_to_dataptr(geo, geo->datablk + 1, 0) &
272 0x7fffffff; 272 0x7fffffff;
273 xfs_trans_brelse(NULL, bp); 273 xfs_trans_brelse(NULL, bp);
274 return 0; 274 return 0;
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 4dc4193bdf1e..10f4c2a23bc4 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -247,7 +247,7 @@ xfs_dir2_block_to_sf(
247 247
248 /* now we are done with the block, we can shrink the inode */ 248 /* now we are done with the block, we can shrink the inode */
249 logflags = XFS_ILOG_CORE; 249 logflags = XFS_ILOG_CORE;
250 error = xfs_dir2_shrink_inode(args, mp->m_dirdatablk, bp); 250 error = xfs_dir2_shrink_inode(args, args->geo->datablk, bp);
251 if (error) { 251 if (error) {
252 ASSERT(error != ENOSPC); 252 ASSERT(error != ENOSPC);
253 goto out; 253 goto out;
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 27cce7b4875d..0a32de0b94da 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -156,9 +156,6 @@ typedef struct xfs_mount {
156 const struct xfs_dir_ops *m_nondir_inode_ops; /* !dir inode ops */ 156 const struct xfs_dir_ops *m_nondir_inode_ops; /* !dir inode ops */
157 int m_dirblksize; /* directory block sz--bytes */ 157 int m_dirblksize; /* directory block sz--bytes */
158 int m_dirblkfsbs; /* directory block sz--fsbs */ 158 int m_dirblkfsbs; /* directory block sz--fsbs */
159 xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */
160 xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v2 */
161 xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v2 */
162 uint m_chsize; /* size of next field */ 159 uint m_chsize; /* size of next field */
163 atomic_t m_active_trans; /* number trans frozen */ 160 atomic_t m_active_trans; /* number trans frozen */
164#ifdef HAVE_PERCPU_SB 161#ifdef HAVE_PERCPU_SB