Commit d6cf1305 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: convert m_dirblkfsbs to xfs_da_geometry

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 7dda6e86
...@@ -1098,10 +1098,11 @@ xfs_bmap_add_attrfork_local( ...@@ -1098,10 +1098,11 @@ xfs_bmap_add_attrfork_local(
if (S_ISDIR(ip->i_d.di_mode)) { if (S_ISDIR(ip->i_d.di_mode)) {
memset(&dargs, 0, sizeof(dargs)); memset(&dargs, 0, sizeof(dargs));
dargs.geo = ip->i_mount->m_dir_geo;
dargs.dp = ip; dargs.dp = ip;
dargs.firstblock = firstblock; dargs.firstblock = firstblock;
dargs.flist = flist; dargs.flist = flist;
dargs.total = ip->i_mount->m_dirblkfsbs; dargs.total = dargs.geo->fsbcount;
dargs.whichfork = XFS_DATA_FORK; dargs.whichfork = XFS_DATA_FORK;
dargs.trans = tp; dargs.trans = tp;
return xfs_dir2_sf_to_block(&dargs); return xfs_dir2_sf_to_block(&dargs);
......
...@@ -2090,20 +2090,12 @@ xfs_da_grow_inode( ...@@ -2090,20 +2090,12 @@ xfs_da_grow_inode(
xfs_dablk_t *new_blkno) xfs_dablk_t *new_blkno)
{ {
xfs_fileoff_t bno; xfs_fileoff_t bno;
int count;
int error; int error;
trace_xfs_da_grow_inode(args); trace_xfs_da_grow_inode(args);
if (args->whichfork == XFS_DATA_FORK) { bno = args->geo->leafblk;
bno = args->geo->leafblk; error = xfs_da_grow_inode_int(args, &bno, args->geo->fsbcount);
count = args->dp->i_mount->m_dirblkfsbs;
} else {
bno = 0;
count = 1;
}
error = xfs_da_grow_inode_int(args, &bno, count);
if (!error) if (!error)
*new_blkno = (xfs_dablk_t)bno; *new_blkno = (xfs_dablk_t)bno;
return error; return error;
...@@ -2170,7 +2162,7 @@ xfs_da3_swap_lastblock( ...@@ -2170,7 +2162,7 @@ xfs_da3_swap_lastblock(
/* /*
* Read the last block in the btree space. * Read the last block in the btree space.
*/ */
last_blkno = (xfs_dablk_t)lastoff - mp->m_dirblkfsbs; last_blkno = (xfs_dablk_t)lastoff - args->geo->fsbcount;
error = xfs_da3_node_read(tp, dp, last_blkno, -1, &last_buf, w); error = xfs_da3_node_read(tp, dp, last_blkno, -1, &last_buf, w);
if (error) if (error)
return error; return error;
...@@ -2357,10 +2349,7 @@ xfs_da_shrink_inode( ...@@ -2357,10 +2349,7 @@ xfs_da_shrink_inode(
w = args->whichfork; w = args->whichfork;
tp = args->trans; tp = args->trans;
mp = dp->i_mount; mp = dp->i_mount;
if (w == XFS_DATA_FORK) count = args->geo->fsbcount;
count = mp->m_dirblkfsbs;
else
count = 1;
for (;;) { for (;;) {
/* /*
* Remove extents. If we get ENOSPC for a dir we have to move * Remove extents. If we get ENOSPC for a dir we have to move
...@@ -2479,7 +2468,10 @@ xfs_dabuf_map( ...@@ -2479,7 +2468,10 @@ xfs_dabuf_map(
ASSERT(map && *map); ASSERT(map && *map);
ASSERT(*nmaps == 1); ASSERT(*nmaps == 1);
nfsb = (whichfork == XFS_DATA_FORK) ? mp->m_dirblkfsbs : 1; if (whichfork == XFS_DATA_FORK)
nfsb = mp->m_dir_geo->fsbcount;
else
nfsb = mp->m_attr_geo->fsbcount;
/* /*
* Caller doesn't have a mapping. -2 means don't complain * Caller doesn't have a mapping. -2 means don't complain
......
...@@ -146,7 +146,6 @@ xfs_da_mount( ...@@ -146,7 +146,6 @@ xfs_da_mount(
/* XXX: these are to be removed as code is converted to use geo */ /* XXX: these are to be removed as code is converted to use geo */
mp->m_dirblksize = mp->m_dir_geo->blksize; mp->m_dirblksize = mp->m_dir_geo->blksize;
mp->m_dirblkfsbs = mp->m_dir_geo->fsbcount;
mp->m_dir_node_ents = mp->m_dir_geo->node_ents; mp->m_dir_node_ents = mp->m_dir_geo->node_ents;
mp->m_dir_magicpct = mp->m_dir_geo->magicpct; mp->m_dir_magicpct = mp->m_dir_geo->magicpct;
mp->m_attr_node_ents = mp->m_attr_geo->node_ents; mp->m_attr_node_ents = mp->m_attr_geo->node_ents;
...@@ -628,7 +627,7 @@ xfs_dir2_grow_inode( ...@@ -628,7 +627,7 @@ xfs_dir2_grow_inode(
* Set lowest possible block in the space requested. * Set lowest possible block in the space requested.
*/ */
bno = XFS_B_TO_FSBT(mp, space * XFS_DIR2_SPACE_SIZE); bno = XFS_B_TO_FSBT(mp, space * XFS_DIR2_SPACE_SIZE);
count = mp->m_dirblkfsbs; count = args->geo->fsbcount;
error = xfs_da_grow_inode_int(args, &bno, count); error = xfs_da_grow_inode_int(args, &bno, count);
if (error) if (error)
...@@ -719,7 +718,7 @@ xfs_dir2_shrink_inode( ...@@ -719,7 +718,7 @@ xfs_dir2_shrink_inode(
/* /*
* Unmap the fsblock(s). * Unmap the fsblock(s).
*/ */
if ((error = xfs_bunmapi(tp, dp, da, mp->m_dirblkfsbs, if ((error = xfs_bunmapi(tp, dp, da, args->geo->fsbcount,
XFS_BMAPI_METADATA, 0, args->firstblock, args->flist, XFS_BMAPI_METADATA, 0, args->firstblock, args->flist,
&done))) { &done))) {
/* /*
......
...@@ -1715,7 +1715,7 @@ xfs_dir2_node_to_leaf( ...@@ -1715,7 +1715,7 @@ xfs_dir2_node_to_leaf(
if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) { if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) {
return error; return error;
} }
fo -= mp->m_dirblkfsbs; fo -= args->geo->fsbcount;
/* /*
* If there are freespace blocks other than the first one, * If there are freespace blocks other than the first one,
* take this opportunity to remove trailing empty freespace blocks * take this opportunity to remove trailing empty freespace blocks
...@@ -1727,7 +1727,7 @@ xfs_dir2_node_to_leaf( ...@@ -1727,7 +1727,7 @@ xfs_dir2_node_to_leaf(
return error; return error;
} }
if (rval) if (rval)
fo -= mp->m_dirblkfsbs; fo -= args->geo->fsbcount;
else else
return 0; return 0;
} }
......
...@@ -314,12 +314,12 @@ xfs_dir2_leaf_readbuf( ...@@ -314,12 +314,12 @@ xfs_dir2_leaf_readbuf(
if (bp) { if (bp) {
xfs_trans_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
bp = NULL; bp = NULL;
mip->map_blocks -= mp->m_dirblkfsbs; mip->map_blocks -= geo->fsbcount;
/* /*
* Loop to get rid of the extents for the * Loop to get rid of the extents for the
* directory block. * directory block.
*/ */
for (i = mp->m_dirblkfsbs; i > 0; ) { for (i = geo->fsbcount; i > 0; ) {
j = min_t(int, map->br_blockcount, i); j = min_t(int, map->br_blockcount, i);
map->br_blockcount -= j; map->br_blockcount -= j;
map->br_startblock += j; map->br_startblock += j;
...@@ -410,7 +410,7 @@ xfs_dir2_leaf_readbuf( ...@@ -410,7 +410,7 @@ xfs_dir2_leaf_readbuf(
*/ */
mip->curdb = xfs_dir2_da_to_db(geo, map->br_startoff); mip->curdb = xfs_dir2_da_to_db(geo, map->br_startoff);
error = xfs_dir3_data_read(NULL, dp, map->br_startoff, error = xfs_dir3_data_read(NULL, dp, map->br_startoff,
map->br_blockcount >= mp->m_dirblkfsbs ? map->br_blockcount >= geo->fsbcount ?
XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1, &bp); XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1, &bp);
/* /*
...@@ -424,7 +424,7 @@ xfs_dir2_leaf_readbuf( ...@@ -424,7 +424,7 @@ xfs_dir2_leaf_readbuf(
* was previously ra. * was previously ra.
*/ */
if (mip->ra_current) if (mip->ra_current)
mip->ra_current -= mp->m_dirblkfsbs; mip->ra_current -= geo->fsbcount;
/* /*
* Do we need more readahead? * Do we need more readahead?
...@@ -432,13 +432,13 @@ xfs_dir2_leaf_readbuf( ...@@ -432,13 +432,13 @@ xfs_dir2_leaf_readbuf(
blk_start_plug(&plug); blk_start_plug(&plug);
for (mip->ra_index = mip->ra_offset = i = 0; for (mip->ra_index = mip->ra_offset = i = 0;
mip->ra_want > mip->ra_current && i < mip->map_blocks; mip->ra_want > mip->ra_current && i < mip->map_blocks;
i += mp->m_dirblkfsbs) { i += geo->fsbcount) {
ASSERT(mip->ra_index < mip->map_valid); ASSERT(mip->ra_index < mip->map_valid);
/* /*
* Read-ahead a contiguous directory block. * Read-ahead a contiguous directory block.
*/ */
if (i > mip->ra_current && if (i > mip->ra_current &&
map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) { map[mip->ra_index].br_blockcount >= geo->fsbcount) {
xfs_dir3_data_readahead(dp, xfs_dir3_data_readahead(dp,
map[mip->ra_index].br_startoff + mip->ra_offset, map[mip->ra_index].br_startoff + mip->ra_offset,
XFS_FSB_TO_DADDR(mp, XFS_FSB_TO_DADDR(mp,
...@@ -461,12 +461,12 @@ xfs_dir2_leaf_readbuf( ...@@ -461,12 +461,12 @@ xfs_dir2_leaf_readbuf(
/* /*
* Advance offset through the mapping table. * Advance offset through the mapping table.
*/ */
for (j = 0; j < mp->m_dirblkfsbs; j += length ) { for (j = 0; j < geo->fsbcount; j += length ) {
/* /*
* The rest of this extent but not more than a dir * The rest of this extent but not more than a dir
* block. * block.
*/ */
length = min_t(int, mp->m_dirblkfsbs, length = min_t(int, geo->fsbcount,
map[mip->ra_index].br_blockcount - map[mip->ra_index].br_blockcount -
mip->ra_offset); mip->ra_offset);
mip->ra_offset += length; mip->ra_offset += length;
......
...@@ -155,7 +155,6 @@ typedef struct xfs_mount { ...@@ -155,7 +155,6 @@ typedef struct xfs_mount {
const struct xfs_dir_ops *m_dir_inode_ops; /* vector of dir inode ops */ const struct xfs_dir_ops *m_dir_inode_ops; /* vector of dir inode ops */
const struct xfs_dir_ops *m_nondir_inode_ops; /* !dir inode ops */ const struct xfs_dir_ops *m_nondir_inode_ops; /* !dir inode ops */
int m_dirblksize; /* directory block sz--bytes */ int m_dirblksize; /* directory block sz--bytes */
int m_dirblkfsbs; /* directory block sz--fsbs */
uint m_chsize; /* size of next field */ uint m_chsize; /* size of next field */
atomic_t m_active_trans; /* number trans frozen */ atomic_t m_active_trans; /* number trans frozen */
#ifdef HAVE_PERCPU_SB #ifdef HAVE_PERCPU_SB
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_format.h" #include "xfs_da_format.h"
#include "xfs_da_btree.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_format.h" #include "xfs_da_format.h"
#include "xfs_da_btree.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
(((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \ (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \
XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \ XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \
XFS_EXTENTADD_SPACE_RES(mp,w)) XFS_EXTENTADD_SPACE_RES(mp,w))
#define XFS_DAENTER_1B(mp,w) ((w) == XFS_DATA_FORK ? (mp)->m_dirblkfsbs : 1) #define XFS_DAENTER_1B(mp,w) \
((w) == XFS_DATA_FORK ? (mp)->m_dir_geo->fsbcount : 1)
#define XFS_DAENTER_DBS(mp,w) \ #define XFS_DAENTER_DBS(mp,w) \
(XFS_DA_NODE_MAXDEPTH + (((w) == XFS_DATA_FORK) ? 2 : 0)) (XFS_DA_NODE_MAXDEPTH + (((w) == XFS_DATA_FORK) ? 2 : 0))
#define XFS_DAENTER_BLOCKS(mp,w) \ #define XFS_DAENTER_BLOCKS(mp,w) \
...@@ -55,7 +56,7 @@ ...@@ -55,7 +56,7 @@
* Space reservation values for various transactions. * Space reservation values for various transactions.
*/ */
#define XFS_ADDAFORK_SPACE_RES(mp) \ #define XFS_ADDAFORK_SPACE_RES(mp) \
((mp)->m_dirblkfsbs + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK)) ((mp)->m_dir_geo->fsbcount + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK))
#define XFS_ATTRRM_SPACE_RES(mp) \ #define XFS_ATTRRM_SPACE_RES(mp) \
XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK) XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK)
/* This macro is not used - see inline code in xfs_attr_set */ /* This macro is not used - see inline code in xfs_attr_set */
......
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