diff options
author | Dave Chinner <dchinner@redhat.com> | 2014-06-06 01:14:11 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-06 01:14:11 -0400 |
commit | d6cf13051f31bf1a54b65643d0e578b3ca2f0692 (patch) | |
tree | 135c8bfa288892dde3979bdf0ae3ef03d2627300 | |
parent | 7dda6e8644a31c366484bbcb564ea6c6225e5963 (diff) |
xfs: convert m_dirblkfsbs to xfs_da_geometry
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/xfs_bmap.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 24 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_readdir.c | 16 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_symlink.c | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_resv.c | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_space.h | 5 |
9 files changed, 27 insertions, 33 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 1ff0da6e2bf9..96175df211b1 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -1098,10 +1098,11 @@ xfs_bmap_add_attrfork_local( | |||
1098 | 1098 | ||
1099 | if (S_ISDIR(ip->i_d.di_mode)) { | 1099 | if (S_ISDIR(ip->i_d.di_mode)) { |
1100 | memset(&dargs, 0, sizeof(dargs)); | 1100 | memset(&dargs, 0, sizeof(dargs)); |
1101 | dargs.geo = ip->i_mount->m_dir_geo; | ||
1101 | dargs.dp = ip; | 1102 | dargs.dp = ip; |
1102 | dargs.firstblock = firstblock; | 1103 | dargs.firstblock = firstblock; |
1103 | dargs.flist = flist; | 1104 | dargs.flist = flist; |
1104 | dargs.total = ip->i_mount->m_dirblkfsbs; | 1105 | dargs.total = dargs.geo->fsbcount; |
1105 | dargs.whichfork = XFS_DATA_FORK; | 1106 | dargs.whichfork = XFS_DATA_FORK; |
1106 | dargs.trans = tp; | 1107 | dargs.trans = tp; |
1107 | return xfs_dir2_sf_to_block(&dargs); | 1108 | return xfs_dir2_sf_to_block(&dargs); |
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 1009a319a786..70b934392f73 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -2090,20 +2090,12 @@ xfs_da_grow_inode( | |||
2090 | xfs_dablk_t *new_blkno) | 2090 | xfs_dablk_t *new_blkno) |
2091 | { | 2091 | { |
2092 | xfs_fileoff_t bno; | 2092 | xfs_fileoff_t bno; |
2093 | int count; | ||
2094 | int error; | 2093 | int error; |
2095 | 2094 | ||
2096 | trace_xfs_da_grow_inode(args); | 2095 | trace_xfs_da_grow_inode(args); |
2097 | 2096 | ||
2098 | if (args->whichfork == XFS_DATA_FORK) { | 2097 | bno = args->geo->leafblk; |
2099 | bno = args->geo->leafblk; | 2098 | error = xfs_da_grow_inode_int(args, &bno, args->geo->fsbcount); |
2100 | count = args->dp->i_mount->m_dirblkfsbs; | ||
2101 | } else { | ||
2102 | bno = 0; | ||
2103 | count = 1; | ||
2104 | } | ||
2105 | |||
2106 | error = xfs_da_grow_inode_int(args, &bno, count); | ||
2107 | if (!error) | 2099 | if (!error) |
2108 | *new_blkno = (xfs_dablk_t)bno; | 2100 | *new_blkno = (xfs_dablk_t)bno; |
2109 | return error; | 2101 | return error; |
@@ -2170,7 +2162,7 @@ xfs_da3_swap_lastblock( | |||
2170 | /* | 2162 | /* |
2171 | * Read the last block in the btree space. | 2163 | * Read the last block in the btree space. |
2172 | */ | 2164 | */ |
2173 | last_blkno = (xfs_dablk_t)lastoff - mp->m_dirblkfsbs; | 2165 | last_blkno = (xfs_dablk_t)lastoff - args->geo->fsbcount; |
2174 | error = xfs_da3_node_read(tp, dp, last_blkno, -1, &last_buf, w); | 2166 | error = xfs_da3_node_read(tp, dp, last_blkno, -1, &last_buf, w); |
2175 | if (error) | 2167 | if (error) |
2176 | return error; | 2168 | return error; |
@@ -2357,10 +2349,7 @@ xfs_da_shrink_inode( | |||
2357 | w = args->whichfork; | 2349 | w = args->whichfork; |
2358 | tp = args->trans; | 2350 | tp = args->trans; |
2359 | mp = dp->i_mount; | 2351 | mp = dp->i_mount; |
2360 | if (w == XFS_DATA_FORK) | 2352 | count = args->geo->fsbcount; |
2361 | count = mp->m_dirblkfsbs; | ||
2362 | else | ||
2363 | count = 1; | ||
2364 | for (;;) { | 2353 | for (;;) { |
2365 | /* | 2354 | /* |
2366 | * Remove extents. If we get ENOSPC for a dir we have to move | 2355 | * Remove extents. If we get ENOSPC for a dir we have to move |
@@ -2479,7 +2468,10 @@ xfs_dabuf_map( | |||
2479 | ASSERT(map && *map); | 2468 | ASSERT(map && *map); |
2480 | ASSERT(*nmaps == 1); | 2469 | ASSERT(*nmaps == 1); |
2481 | 2470 | ||
2482 | nfsb = (whichfork == XFS_DATA_FORK) ? mp->m_dirblkfsbs : 1; | 2471 | if (whichfork == XFS_DATA_FORK) |
2472 | nfsb = mp->m_dir_geo->fsbcount; | ||
2473 | else | ||
2474 | nfsb = mp->m_attr_geo->fsbcount; | ||
2483 | 2475 | ||
2484 | /* | 2476 | /* |
2485 | * Caller doesn't have a mapping. -2 means don't complain | 2477 | * Caller doesn't have a mapping. -2 means don't complain |
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index 77d6882c46b0..3fbf0110eeb3 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
@@ -146,7 +146,6 @@ xfs_da_mount( | |||
146 | 146 | ||
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; | ||
150 | mp->m_dir_node_ents = mp->m_dir_geo->node_ents; | 149 | mp->m_dir_node_ents = mp->m_dir_geo->node_ents; |
151 | mp->m_dir_magicpct = mp->m_dir_geo->magicpct; | 150 | mp->m_dir_magicpct = mp->m_dir_geo->magicpct; |
152 | mp->m_attr_node_ents = mp->m_attr_geo->node_ents; | 151 | mp->m_attr_node_ents = mp->m_attr_geo->node_ents; |
@@ -628,7 +627,7 @@ xfs_dir2_grow_inode( | |||
628 | * Set lowest possible block in the space requested. | 627 | * Set lowest possible block in the space requested. |
629 | */ | 628 | */ |
630 | bno = XFS_B_TO_FSBT(mp, space * XFS_DIR2_SPACE_SIZE); | 629 | bno = XFS_B_TO_FSBT(mp, space * XFS_DIR2_SPACE_SIZE); |
631 | count = mp->m_dirblkfsbs; | 630 | count = args->geo->fsbcount; |
632 | 631 | ||
633 | error = xfs_da_grow_inode_int(args, &bno, count); | 632 | error = xfs_da_grow_inode_int(args, &bno, count); |
634 | if (error) | 633 | if (error) |
@@ -719,7 +718,7 @@ xfs_dir2_shrink_inode( | |||
719 | /* | 718 | /* |
720 | * Unmap the fsblock(s). | 719 | * Unmap the fsblock(s). |
721 | */ | 720 | */ |
722 | if ((error = xfs_bunmapi(tp, dp, da, mp->m_dirblkfsbs, | 721 | if ((error = xfs_bunmapi(tp, dp, da, args->geo->fsbcount, |
723 | XFS_BMAPI_METADATA, 0, args->firstblock, args->flist, | 722 | XFS_BMAPI_METADATA, 0, args->firstblock, args->flist, |
724 | &done))) { | 723 | &done))) { |
725 | /* | 724 | /* |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index 3eb8b240d018..a1f13103a16e 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -1715,7 +1715,7 @@ xfs_dir2_node_to_leaf( | |||
1715 | if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) { | 1715 | if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) { |
1716 | return error; | 1716 | return error; |
1717 | } | 1717 | } |
1718 | fo -= mp->m_dirblkfsbs; | 1718 | fo -= args->geo->fsbcount; |
1719 | /* | 1719 | /* |
1720 | * If there are freespace blocks other than the first one, | 1720 | * If there are freespace blocks other than the first one, |
1721 | * take this opportunity to remove trailing empty freespace blocks | 1721 | * take this opportunity to remove trailing empty freespace blocks |
@@ -1727,7 +1727,7 @@ xfs_dir2_node_to_leaf( | |||
1727 | return error; | 1727 | return error; |
1728 | } | 1728 | } |
1729 | if (rval) | 1729 | if (rval) |
1730 | fo -= mp->m_dirblkfsbs; | 1730 | fo -= args->geo->fsbcount; |
1731 | else | 1731 | else |
1732 | return 0; | 1732 | return 0; |
1733 | } | 1733 | } |
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c index 0c8c09cf313f..8cb5340071e8 100644 --- a/fs/xfs/xfs_dir2_readdir.c +++ b/fs/xfs/xfs_dir2_readdir.c | |||
@@ -314,12 +314,12 @@ xfs_dir2_leaf_readbuf( | |||
314 | if (bp) { | 314 | if (bp) { |
315 | xfs_trans_brelse(NULL, bp); | 315 | xfs_trans_brelse(NULL, bp); |
316 | bp = NULL; | 316 | bp = NULL; |
317 | mip->map_blocks -= mp->m_dirblkfsbs; | 317 | mip->map_blocks -= geo->fsbcount; |
318 | /* | 318 | /* |
319 | * Loop to get rid of the extents for the | 319 | * Loop to get rid of the extents for the |
320 | * directory block. | 320 | * directory block. |
321 | */ | 321 | */ |
322 | for (i = mp->m_dirblkfsbs; i > 0; ) { | 322 | for (i = geo->fsbcount; i > 0; ) { |
323 | j = min_t(int, map->br_blockcount, i); | 323 | j = min_t(int, map->br_blockcount, i); |
324 | map->br_blockcount -= j; | 324 | map->br_blockcount -= j; |
325 | map->br_startblock += j; | 325 | map->br_startblock += j; |
@@ -410,7 +410,7 @@ xfs_dir2_leaf_readbuf( | |||
410 | */ | 410 | */ |
411 | mip->curdb = xfs_dir2_da_to_db(geo, map->br_startoff); | 411 | mip->curdb = xfs_dir2_da_to_db(geo, map->br_startoff); |
412 | error = xfs_dir3_data_read(NULL, dp, map->br_startoff, | 412 | error = xfs_dir3_data_read(NULL, dp, map->br_startoff, |
413 | map->br_blockcount >= mp->m_dirblkfsbs ? | 413 | map->br_blockcount >= geo->fsbcount ? |
414 | XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1, &bp); | 414 | XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1, &bp); |
415 | 415 | ||
416 | /* | 416 | /* |
@@ -424,7 +424,7 @@ xfs_dir2_leaf_readbuf( | |||
424 | * was previously ra. | 424 | * was previously ra. |
425 | */ | 425 | */ |
426 | if (mip->ra_current) | 426 | if (mip->ra_current) |
427 | mip->ra_current -= mp->m_dirblkfsbs; | 427 | mip->ra_current -= geo->fsbcount; |
428 | 428 | ||
429 | /* | 429 | /* |
430 | * Do we need more readahead? | 430 | * Do we need more readahead? |
@@ -432,13 +432,13 @@ xfs_dir2_leaf_readbuf( | |||
432 | blk_start_plug(&plug); | 432 | blk_start_plug(&plug); |
433 | for (mip->ra_index = mip->ra_offset = i = 0; | 433 | for (mip->ra_index = mip->ra_offset = i = 0; |
434 | mip->ra_want > mip->ra_current && i < mip->map_blocks; | 434 | mip->ra_want > mip->ra_current && i < mip->map_blocks; |
435 | i += mp->m_dirblkfsbs) { | 435 | i += geo->fsbcount) { |
436 | ASSERT(mip->ra_index < mip->map_valid); | 436 | ASSERT(mip->ra_index < mip->map_valid); |
437 | /* | 437 | /* |
438 | * Read-ahead a contiguous directory block. | 438 | * Read-ahead a contiguous directory block. |
439 | */ | 439 | */ |
440 | if (i > mip->ra_current && | 440 | if (i > mip->ra_current && |
441 | map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) { | 441 | map[mip->ra_index].br_blockcount >= geo->fsbcount) { |
442 | xfs_dir3_data_readahead(dp, | 442 | xfs_dir3_data_readahead(dp, |
443 | map[mip->ra_index].br_startoff + mip->ra_offset, | 443 | map[mip->ra_index].br_startoff + mip->ra_offset, |
444 | XFS_FSB_TO_DADDR(mp, | 444 | XFS_FSB_TO_DADDR(mp, |
@@ -461,12 +461,12 @@ xfs_dir2_leaf_readbuf( | |||
461 | /* | 461 | /* |
462 | * Advance offset through the mapping table. | 462 | * Advance offset through the mapping table. |
463 | */ | 463 | */ |
464 | for (j = 0; j < mp->m_dirblkfsbs; j += length ) { | 464 | for (j = 0; j < geo->fsbcount; j += length ) { |
465 | /* | 465 | /* |
466 | * The rest of this extent but not more than a dir | 466 | * The rest of this extent but not more than a dir |
467 | * block. | 467 | * block. |
468 | */ | 468 | */ |
469 | length = min_t(int, mp->m_dirblkfsbs, | 469 | length = min_t(int, geo->fsbcount, |
470 | map[mip->ra_index].br_blockcount - | 470 | map[mip->ra_index].br_blockcount - |
471 | mip->ra_offset); | 471 | mip->ra_offset); |
472 | mip->ra_offset += length; | 472 | mip->ra_offset += length; |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 0a32de0b94da..a23e7b63d420 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -155,7 +155,6 @@ typedef struct xfs_mount { | |||
155 | const struct xfs_dir_ops *m_dir_inode_ops; /* vector of dir inode ops */ | 155 | const struct xfs_dir_ops *m_dir_inode_ops; /* vector of dir inode ops */ |
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 */ | ||
159 | uint m_chsize; /* size of next field */ | 158 | uint m_chsize; /* size of next field */ |
160 | atomic_t m_active_trans; /* number trans frozen */ | 159 | atomic_t m_active_trans; /* number trans frozen */ |
161 | #ifdef HAVE_PERCPU_SB | 160 | #ifdef HAVE_PERCPU_SB |
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c index 0816b4018dfc..d69363c833e1 100644 --- a/fs/xfs/xfs_symlink.c +++ b/fs/xfs/xfs_symlink.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "xfs_ag.h" | 27 | #include "xfs_ag.h" |
28 | #include "xfs_mount.h" | 28 | #include "xfs_mount.h" |
29 | #include "xfs_da_format.h" | 29 | #include "xfs_da_format.h" |
30 | #include "xfs_da_btree.h" | ||
30 | #include "xfs_dir2.h" | 31 | #include "xfs_dir2.h" |
31 | #include "xfs_inode.h" | 32 | #include "xfs_inode.h" |
32 | #include "xfs_ialloc.h" | 33 | #include "xfs_ialloc.h" |
diff --git a/fs/xfs/xfs_trans_resv.c b/fs/xfs/xfs_trans_resv.c index 52b6c3e3203e..63a42a180a67 100644 --- a/fs/xfs/xfs_trans_resv.c +++ b/fs/xfs/xfs_trans_resv.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "xfs_ag.h" | 26 | #include "xfs_ag.h" |
27 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
28 | #include "xfs_da_format.h" | 28 | #include "xfs_da_format.h" |
29 | #include "xfs_da_btree.h" | ||
29 | #include "xfs_inode.h" | 30 | #include "xfs_inode.h" |
30 | #include "xfs_bmap_btree.h" | 31 | #include "xfs_bmap_btree.h" |
31 | #include "xfs_ialloc.h" | 32 | #include "xfs_ialloc.h" |
diff --git a/fs/xfs/xfs_trans_space.h b/fs/xfs/xfs_trans_space.h index df4c1f81884c..bf9c4579334d 100644 --- a/fs/xfs/xfs_trans_space.h +++ b/fs/xfs/xfs_trans_space.h | |||
@@ -28,7 +28,8 @@ | |||
28 | (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \ | 28 | (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \ |
29 | XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \ | 29 | XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \ |
30 | XFS_EXTENTADD_SPACE_RES(mp,w)) | 30 | XFS_EXTENTADD_SPACE_RES(mp,w)) |
31 | #define XFS_DAENTER_1B(mp,w) ((w) == XFS_DATA_FORK ? (mp)->m_dirblkfsbs : 1) | 31 | #define XFS_DAENTER_1B(mp,w) \ |
32 | ((w) == XFS_DATA_FORK ? (mp)->m_dir_geo->fsbcount : 1) | ||
32 | #define XFS_DAENTER_DBS(mp,w) \ | 33 | #define XFS_DAENTER_DBS(mp,w) \ |
33 | (XFS_DA_NODE_MAXDEPTH + (((w) == XFS_DATA_FORK) ? 2 : 0)) | 34 | (XFS_DA_NODE_MAXDEPTH + (((w) == XFS_DATA_FORK) ? 2 : 0)) |
34 | #define XFS_DAENTER_BLOCKS(mp,w) \ | 35 | #define XFS_DAENTER_BLOCKS(mp,w) \ |
@@ -55,7 +56,7 @@ | |||
55 | * Space reservation values for various transactions. | 56 | * Space reservation values for various transactions. |
56 | */ | 57 | */ |
57 | #define XFS_ADDAFORK_SPACE_RES(mp) \ | 58 | #define XFS_ADDAFORK_SPACE_RES(mp) \ |
58 | ((mp)->m_dirblkfsbs + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK)) | 59 | ((mp)->m_dir_geo->fsbcount + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK)) |
59 | #define XFS_ATTRRM_SPACE_RES(mp) \ | 60 | #define XFS_ATTRRM_SPACE_RES(mp) \ |
60 | XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK) | 61 | XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK) |
61 | /* This macro is not used - see inline code in xfs_attr_set */ | 62 | /* This macro is not used - see inline code in xfs_attr_set */ |