xfs: kill xfs_trans_find_item
PATCH 1/1 xfs: kill xfs_trans_find_item
xfs_trans_find_item is just and awkward way to derefence ->li_desc in the log_item structure. So replace the calls to it with the direct reference, and while we're at it also make these type-safe instead using casts.
fs/xfs/quota/xfs_trans_dquot.c +2 -5
@@ -93,12 +93,10 @@ xfs_trans_log_dquot( xfs_trans_t *tp, xfs_dquot_t *dqp) { -xfs_log_item_desc_t *lidp; +xfs_log_item_desc_t *lidp = dqp->q_logitem.qli_item.li_desc;ASSERT (dqp->q_transp == tp);ASSERT (XFS_DQ_IS_LOCKED (dqp)); - - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)(&dqp->q_logitem));ASSERT (lidp !=NULL ); tp->t_flags |=XFS_TRANS_DIRTY ;
@@ -890,9 +888,8 @@ xfs_trans_log_quotaoff_item( xfs_trans_t *tp, xfs_qoff_logitem_t *qlp) { -xfs_log_item_desc_t *lidp; +xfs_log_item_desc_t *lidp = qlp->qql_item.li_desc; - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)qlp);ASSERT (lidp !=NULL ); tp->t_flags |=XFS_TRANS_DIRTY ;
fs/xfs/xfs_buf_item.c +1 -4
@@ -441,13 +441,10 @@ xfs_buf_item_unpin_remove(* occurs later in the xfs_trans_uncommit() will try to * reference the buffer which we no longer have a hold on. */ -struct xfs_log_item_desc *lidp; -ASSERT (XFS_BUF_VALUSEMA (bip->bli_buf) <=0 );trace_xfs_buf_item_unpin_stale (bip); - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)bip); -xfs_trans_free_item (tp, lidp); +xfs_trans_free_item (tp, bip->bli_item.li_desc);/* * Since the transaction no longer refers to the buffer, the
fs/xfs/xfs_extfree_item.c +4 -4
@@ -132,18 +132,18 @@ STATIC void xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) {struct xfs_ail *ailp = efip->efi_item.li_ailp; -xfs_log_item_desc_t *lidp;spin_lock (&ailp->xa_lock);if (efip->efi_flags &XFS_EFI_CANCELED ) { +xfs_log_item_t *lip = &efip->efi_item; +/* * free the xaction descriptor pointing to this item */ - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *) efip); -xfs_trans_free_item (tp, lidp); +xfs_trans_free_item (tp, lip->li_desc);/* xfs_trans_ail_delete() drops the AIL lock. */ -xfs_trans_ail_delete (ailp, (xfs_log_item_t *)efip); +xfs_trans_ail_delete (ailp, lip);xfs_efi_item_free (efip); }else { efip->efi_flags |=XFS_EFI_COMMITTED ;
fs/xfs/xfs_trans_buf.c +3 -3
@@ -518,7 +518,7 @@ xfs_trans_brelse(xfs_trans_t *tp,* Find the item descriptor pointing to this buffer's * log item. It must be there. */ - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)bip); + lidp = bip->bli_item.li_desc;ASSERT (lidp !=NULL );trace_xfs_trans_brelse (bip);
@@ -707,7 +707,7 @@ xfs_trans_log_buf(xfs_trans_t *tp, bip->bli_format.blf_flags &= ~XFS_BLI_CANCEL ; } - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)bip); + lidp = bip->bli_item.li_desc;ASSERT (lidp !=NULL ); tp->t_flags |=XFS_TRANS_DIRTY ;
@@ -748,7 +748,7 @@ xfs_trans_binval( ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)bip); + lidp = bip->bli_item.li_desc;ASSERT (lidp !=NULL );ASSERT (atomic_read (&bip->bli_refcount) >0 );
fs/xfs/xfs_trans_extfree.c +2 -4
@@ -65,11 +65,10 @@ xfs_trans_log_efi_extent(xfs_trans_t *t xfs_fsblock_t start_block, xfs_extlen_t ext_len) { -xfs_log_item_desc_t *lidp; +xfs_log_item_desc_t *lidp = efip->efi_item.li_desc;uint next_extent;xfs_extent_t *extp; - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)efip);ASSERT (lidp !=NULL ); tp->t_flags |=XFS_TRANS_DIRTY ;
@@ -122,11 +121,10 @@ xfs_trans_log_efd_extent(xfs_trans_t *t xfs_fsblock_t start_block, xfs_extlen_t ext_len) { -xfs_log_item_desc_t *lidp; +xfs_log_item_desc_t *lidp = efdp->efd_item.li_desc;uint next_extent;xfs_extent_t *extp; - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)efdp);ASSERT (lidp !=NULL ); tp->t_flags |=XFS_TRANS_DIRTY ;
fs/xfs/xfs_trans_inode.c +1 -3
@@ -149,13 +149,11 @@ xfs_trans_log_inode( xfs_inode_t *ip, uint flags) { -xfs_log_item_desc_t *lidp; +xfs_log_item_desc_t *lidp = ip->i_itemp->ili_item.li_desc;ASSERT (ip->i_transp == tp);ASSERT (ip->i_itemp !=NULL );ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL )); - - lidp =xfs_trans_find_item (tp, (xfs_log_item_t *)(ip->i_itemp));ASSERT (lidp !=NULL ); tp->t_flags |=XFS_TRANS_DIRTY ;
fs/xfs/xfs_trans_item.c +0 -19
@@ -177,25 +177,6 @@ xfs_trans_free_item(xfs_trans_t *tp, xfs }/* -* This is called to find the descriptor corresponding to the given -* log item. It returns a pointer to the descriptor. -* The log item MUST have a corresponding descriptor in the given -* transaction. This routine does not return NULL, it panics. -* -* The descriptor pointer is kept in the log item's li_desc field. -* Just return it. -*/ -/*ARGSUSED*/ -xfs_log_item_desc_t * -xfs_trans_find_item (xfs_trans_t *tp,xfs_log_item_t *lip) -{ -ASSERT (lip->li_desc !=NULL ); - -return lip->li_desc; -} - - -/* * Return a pointer to the first descriptor in the chunk list. * This does not return NULL if there are none, it panics. *
fs/xfs/xfs_trans_priv.h +0 -2
@@ -30,8 +30,6 @@ struct xfs_log_item_desc *xfs_trans_add_ struct xfs_log_item *);void xfs_trans_free_item (struct xfs_trans *,struct xfs_log_item_desc *); -struct xfs_log_item_desc *xfs_trans_find_item (struct xfs_trans *, -struct xfs_log_item *);struct xfs_log_item_desc *xfs_trans_first_item (struct xfs_trans *);struct xfs_log_item_desc *xfs_trans_next_item (struct xfs_trans *,struct xfs_log_item_desc *);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Christoph Hellwig
xfs_trans_find_itemis just and awkward way to derefence ->li_desc in thelog_itemstructure. So replace the calls to it with the direct reference, and while we're at it also make these type-safe instead using casts.
Actually, ignore this patch for now. I have a larger one that will incorporate it.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs