Commit f3ca8738 authored by Christoph Hellwig's avatar Christoph Hellwig

xfs: remove i_transp

Remove the transaction pointer in the inode.  It's only used to avoid
passing down an argument in the bmap code, and for a few asserts in
the transaction code right now.

Also use the local variable ip in a few more places in xfs_inode_item_unlock,
so that it isn't only used for debug builds after the above change.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 7a249cf8
...@@ -59,7 +59,7 @@ xfs_trans_dqjoin( ...@@ -59,7 +59,7 @@ xfs_trans_dqjoin(
xfs_trans_add_item(tp, &dqp->q_logitem.qli_item); xfs_trans_add_item(tp, &dqp->q_logitem.qli_item);
/* /*
* Initialize i_transp so we can later determine if this dquot is * Initialize d_transp so we can later determine if this dquot is
* associated with this transaction. * associated with this transaction.
*/ */
dqp->q_transp = tp; dqp->q_transp = tp;
......
...@@ -94,6 +94,7 @@ xfs_bmap_add_attrfork_local( ...@@ -94,6 +94,7 @@ xfs_bmap_add_attrfork_local(
*/ */
STATIC int /* error */ STATIC int /* error */
xfs_bmap_add_extent_delay_real( xfs_bmap_add_extent_delay_real(
struct xfs_trans *tp, /* transaction pointer */
xfs_inode_t *ip, /* incore inode pointer */ xfs_inode_t *ip, /* incore inode pointer */
xfs_extnum_t *idx, /* extent number to update/insert */ xfs_extnum_t *idx, /* extent number to update/insert */
xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
...@@ -439,6 +440,7 @@ xfs_bmap_add_attrfork_local( ...@@ -439,6 +440,7 @@ xfs_bmap_add_attrfork_local(
*/ */
STATIC int /* error */ STATIC int /* error */
xfs_bmap_add_extent( xfs_bmap_add_extent(
struct xfs_trans *tp, /* transaction pointer */
xfs_inode_t *ip, /* incore inode pointer */ xfs_inode_t *ip, /* incore inode pointer */
xfs_extnum_t *idx, /* extent number to update/insert */ xfs_extnum_t *idx, /* extent number to update/insert */
xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
...@@ -524,7 +526,7 @@ xfs_bmap_add_extent( ...@@ -524,7 +526,7 @@ xfs_bmap_add_extent(
if (cur) if (cur)
ASSERT(cur->bc_private.b.flags & ASSERT(cur->bc_private.b.flags &
XFS_BTCUR_BPRV_WASDEL); XFS_BTCUR_BPRV_WASDEL);
error = xfs_bmap_add_extent_delay_real(ip, error = xfs_bmap_add_extent_delay_real(tp, ip,
idx, &cur, new, &da_new, idx, &cur, new, &da_new,
first, flist, &logflags); first, flist, &logflags);
} else { } else {
...@@ -561,7 +563,7 @@ xfs_bmap_add_extent( ...@@ -561,7 +563,7 @@ xfs_bmap_add_extent(
int tmp_logflags; /* partial log flag return val */ int tmp_logflags; /* partial log flag return val */
ASSERT(cur == NULL); ASSERT(cur == NULL);
error = xfs_bmap_extents_to_btree(ip->i_transp, ip, first, error = xfs_bmap_extents_to_btree(tp, ip, first,
flist, &cur, da_old > 0, &tmp_logflags, whichfork); flist, &cur, da_old > 0, &tmp_logflags, whichfork);
logflags |= tmp_logflags; logflags |= tmp_logflags;
if (error) if (error)
...@@ -604,6 +606,7 @@ xfs_bmap_add_extent( ...@@ -604,6 +606,7 @@ xfs_bmap_add_extent(
*/ */
STATIC int /* error */ STATIC int /* error */
xfs_bmap_add_extent_delay_real( xfs_bmap_add_extent_delay_real(
struct xfs_trans *tp, /* transaction pointer */
xfs_inode_t *ip, /* incore inode pointer */ xfs_inode_t *ip, /* incore inode pointer */
xfs_extnum_t *idx, /* extent number to update/insert */ xfs_extnum_t *idx, /* extent number to update/insert */
xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
...@@ -901,7 +904,7 @@ xfs_bmap_add_extent_delay_real( ...@@ -901,7 +904,7 @@ xfs_bmap_add_extent_delay_real(
} }
if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS && if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
ip->i_d.di_nextents > ip->i_df.if_ext_max) { ip->i_d.di_nextents > ip->i_df.if_ext_max) {
error = xfs_bmap_extents_to_btree(ip->i_transp, ip, error = xfs_bmap_extents_to_btree(tp, ip,
first, flist, &cur, 1, &tmp_rval, first, flist, &cur, 1, &tmp_rval,
XFS_DATA_FORK); XFS_DATA_FORK);
rval |= tmp_rval; rval |= tmp_rval;
...@@ -984,7 +987,7 @@ xfs_bmap_add_extent_delay_real( ...@@ -984,7 +987,7 @@ xfs_bmap_add_extent_delay_real(
} }
if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS && if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
ip->i_d.di_nextents > ip->i_df.if_ext_max) { ip->i_d.di_nextents > ip->i_df.if_ext_max) {
error = xfs_bmap_extents_to_btree(ip->i_transp, ip, error = xfs_bmap_extents_to_btree(tp, ip,
first, flist, &cur, 1, &tmp_rval, first, flist, &cur, 1, &tmp_rval,
XFS_DATA_FORK); XFS_DATA_FORK);
rval |= tmp_rval; rval |= tmp_rval;
...@@ -1052,7 +1055,7 @@ xfs_bmap_add_extent_delay_real( ...@@ -1052,7 +1055,7 @@ xfs_bmap_add_extent_delay_real(
} }
if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS && if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
ip->i_d.di_nextents > ip->i_df.if_ext_max) { ip->i_d.di_nextents > ip->i_df.if_ext_max) {
error = xfs_bmap_extents_to_btree(ip->i_transp, ip, error = xfs_bmap_extents_to_btree(tp, ip,
first, flist, &cur, 1, &tmp_rval, first, flist, &cur, 1, &tmp_rval,
XFS_DATA_FORK); XFS_DATA_FORK);
rval |= tmp_rval; rval |= tmp_rval;
...@@ -2871,8 +2874,8 @@ xfs_bmap_del_extent( ...@@ -2871,8 +2874,8 @@ xfs_bmap_del_extent(
len = del->br_blockcount; len = del->br_blockcount;
do_div(bno, mp->m_sb.sb_rextsize); do_div(bno, mp->m_sb.sb_rextsize);
do_div(len, mp->m_sb.sb_rextsize); do_div(len, mp->m_sb.sb_rextsize);
if ((error = xfs_rtfree_extent(ip->i_transp, bno, error = xfs_rtfree_extent(tp, bno, (xfs_extlen_t)len);
(xfs_extlen_t)len))) if (error)
goto done; goto done;
do_fx = 0; do_fx = 0;
nblks = len * mp->m_sb.sb_rextsize; nblks = len * mp->m_sb.sb_rextsize;
...@@ -4662,7 +4665,7 @@ xfs_bmapi( ...@@ -4662,7 +4665,7 @@ xfs_bmapi(
if (!wasdelay && (flags & XFS_BMAPI_PREALLOC)) if (!wasdelay && (flags & XFS_BMAPI_PREALLOC))
got.br_state = XFS_EXT_UNWRITTEN; got.br_state = XFS_EXT_UNWRITTEN;
} }
error = xfs_bmap_add_extent(ip, &lastx, &cur, &got, error = xfs_bmap_add_extent(tp, ip, &lastx, &cur, &got,
firstblock, flist, &tmp_logflags, firstblock, flist, &tmp_logflags,
whichfork); whichfork);
logflags |= tmp_logflags; logflags |= tmp_logflags;
...@@ -4763,7 +4766,7 @@ xfs_bmapi( ...@@ -4763,7 +4766,7 @@ xfs_bmapi(
mval->br_state = (mval->br_state == XFS_EXT_UNWRITTEN) mval->br_state = (mval->br_state == XFS_EXT_UNWRITTEN)
? XFS_EXT_NORM ? XFS_EXT_NORM
: XFS_EXT_UNWRITTEN; : XFS_EXT_UNWRITTEN;
error = xfs_bmap_add_extent(ip, &lastx, &cur, mval, error = xfs_bmap_add_extent(tp, ip, &lastx, &cur, mval,
firstblock, flist, &tmp_logflags, firstblock, flist, &tmp_logflags,
whichfork); whichfork);
logflags |= tmp_logflags; logflags |= tmp_logflags;
...@@ -5117,7 +5120,7 @@ xfs_bunmapi( ...@@ -5117,7 +5120,7 @@ xfs_bunmapi(
del.br_blockcount = mod; del.br_blockcount = mod;
} }
del.br_state = XFS_EXT_UNWRITTEN; del.br_state = XFS_EXT_UNWRITTEN;
error = xfs_bmap_add_extent(ip, &lastx, &cur, &del, error = xfs_bmap_add_extent(tp, ip, &lastx, &cur, &del,
firstblock, flist, &logflags, firstblock, flist, &logflags,
XFS_DATA_FORK); XFS_DATA_FORK);
if (error) if (error)
...@@ -5175,18 +5178,18 @@ xfs_bunmapi( ...@@ -5175,18 +5178,18 @@ xfs_bunmapi(
} }
prev.br_state = XFS_EXT_UNWRITTEN; prev.br_state = XFS_EXT_UNWRITTEN;
lastx--; lastx--;
error = xfs_bmap_add_extent(ip, &lastx, &cur, error = xfs_bmap_add_extent(tp, ip, &lastx,
&prev, firstblock, flist, &logflags, &cur, &prev, firstblock, flist,
XFS_DATA_FORK); &logflags, XFS_DATA_FORK);
if (error) if (error)
goto error0; goto error0;
goto nodelete; goto nodelete;
} else { } else {
ASSERT(del.br_state == XFS_EXT_NORM); ASSERT(del.br_state == XFS_EXT_NORM);
del.br_state = XFS_EXT_UNWRITTEN; del.br_state = XFS_EXT_UNWRITTEN;
error = xfs_bmap_add_extent(ip, &lastx, &cur, error = xfs_bmap_add_extent(tp, ip, &lastx,
&del, firstblock, flist, &logflags, &cur, &del, firstblock, flist,
XFS_DATA_FORK); &logflags, XFS_DATA_FORK);
if (error) if (error)
goto error0; goto error0;
goto nodelete; goto nodelete;
......
...@@ -1261,7 +1261,6 @@ xfs_itruncate_extents( ...@@ -1261,7 +1261,6 @@ xfs_itruncate_extents(
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
ASSERT(new_size <= ip->i_size); ASSERT(new_size <= ip->i_size);
ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
ASSERT(ip->i_transp == tp);
ASSERT(ip->i_itemp != NULL); ASSERT(ip->i_itemp != NULL);
ASSERT(ip->i_itemp->ili_lock_flags == 0); ASSERT(ip->i_itemp->ili_lock_flags == 0);
ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); ASSERT(!XFS_NOT_DQATTACHED(mp, ip));
...@@ -1436,7 +1435,6 @@ xfs_iunlink( ...@@ -1436,7 +1435,6 @@ xfs_iunlink(
ASSERT(ip->i_d.di_nlink == 0); ASSERT(ip->i_d.di_nlink == 0);
ASSERT(ip->i_d.di_mode != 0); ASSERT(ip->i_d.di_mode != 0);
ASSERT(ip->i_transp == tp);
mp = tp->t_mountp; mp = tp->t_mountp;
...@@ -1828,7 +1826,6 @@ xfs_ifree( ...@@ -1828,7 +1826,6 @@ xfs_ifree(
xfs_buf_t *ibp; xfs_buf_t *ibp;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
ASSERT(ip->i_transp == tp);
ASSERT(ip->i_d.di_nlink == 0); ASSERT(ip->i_d.di_nlink == 0);
ASSERT(ip->i_d.di_nextents == 0); ASSERT(ip->i_d.di_nextents == 0);
ASSERT(ip->i_d.di_anextents == 0); ASSERT(ip->i_d.di_anextents == 0);
......
...@@ -241,7 +241,6 @@ typedef struct xfs_inode { ...@@ -241,7 +241,6 @@ typedef struct xfs_inode {
xfs_ifork_t i_df; /* data fork */ xfs_ifork_t i_df; /* data fork */
/* Transaction and locking information. */ /* Transaction and locking information. */
struct xfs_trans *i_transp; /* ptr to owning transaction*/
struct xfs_inode_log_item *i_itemp; /* logging information */ struct xfs_inode_log_item *i_itemp; /* logging information */
mrlock_t i_lock; /* inode lock */ mrlock_t i_lock; /* inode lock */
mrlock_t i_iolock; /* inode IO lock */ mrlock_t i_iolock; /* inode IO lock */
......
...@@ -632,13 +632,8 @@ xfs_inode_item_unlock( ...@@ -632,13 +632,8 @@ xfs_inode_item_unlock(
struct xfs_inode *ip = iip->ili_inode; struct xfs_inode *ip = iip->ili_inode;
unsigned short lock_flags; unsigned short lock_flags;
ASSERT(iip->ili_inode->i_itemp != NULL); ASSERT(ip->i_itemp != NULL);
ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
/*
* Clear the transaction pointer in the inode.
*/
ip->i_transp = NULL;
/* /*
* If the inode needed a separate buffer with which to log * If the inode needed a separate buffer with which to log
...@@ -664,8 +659,8 @@ xfs_inode_item_unlock( ...@@ -664,8 +659,8 @@ xfs_inode_item_unlock(
lock_flags = iip->ili_lock_flags; lock_flags = iip->ili_lock_flags;
iip->ili_lock_flags = 0; iip->ili_lock_flags = 0;
if (lock_flags) { if (lock_flags) {
xfs_iunlock(iip->ili_inode, lock_flags); xfs_iunlock(ip, lock_flags);
IRELE(iip->ili_inode); IRELE(ip);
} }
} }
......
...@@ -55,7 +55,6 @@ xfs_trans_ijoin( ...@@ -55,7 +55,6 @@ xfs_trans_ijoin(
{ {
xfs_inode_log_item_t *iip; xfs_inode_log_item_t *iip;
ASSERT(ip->i_transp == NULL);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
if (ip->i_itemp == NULL) if (ip->i_itemp == NULL)
xfs_inode_item_init(ip, ip->i_mount); xfs_inode_item_init(ip, ip->i_mount);
...@@ -68,12 +67,6 @@ xfs_trans_ijoin( ...@@ -68,12 +67,6 @@ xfs_trans_ijoin(
xfs_trans_add_item(tp, &iip->ili_item); xfs_trans_add_item(tp, &iip->ili_item);
xfs_trans_inode_broot_debug(ip); xfs_trans_inode_broot_debug(ip);
/*
* Initialize i_transp so we can find it with xfs_inode_incore()
* in xfs_trans_iget() above.
*/
ip->i_transp = tp;
} }
/* /*
...@@ -111,7 +104,6 @@ xfs_trans_ichgtime( ...@@ -111,7 +104,6 @@ xfs_trans_ichgtime(
ASSERT(tp); ASSERT(tp);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
ASSERT(ip->i_transp == tp);
tv = current_fs_time(inode->i_sb); tv = current_fs_time(inode->i_sb);
...@@ -140,7 +132,6 @@ xfs_trans_log_inode( ...@@ -140,7 +132,6 @@ xfs_trans_log_inode(
xfs_inode_t *ip, xfs_inode_t *ip,
uint flags) uint flags)
{ {
ASSERT(ip->i_transp == tp);
ASSERT(ip->i_itemp != NULL); ASSERT(ip->i_itemp != NULL);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
......
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