Commit 7bfa31d8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder

xfs: give xfs_item_ops methods the correct prototypes

Stop the function pointer casting madness and give all the xfs_item_ops the
correct prototypes.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 9412e318
This diff is collapsed.
...@@ -33,6 +33,12 @@ ...@@ -33,6 +33,12 @@
kmem_zone_t *xfs_buf_item_zone; kmem_zone_t *xfs_buf_item_zone;
static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip)
{
return container_of(lip, struct xfs_buf_log_item, bli_item);
}
#ifdef XFS_TRANS_DEBUG #ifdef XFS_TRANS_DEBUG
/* /*
* This function uses an alternate strategy for tracking the bytes * This function uses an alternate strategy for tracking the bytes
...@@ -150,12 +156,13 @@ STATIC void xfs_buf_do_callbacks(xfs_buf_t *bp, xfs_log_item_t *lip); ...@@ -150,12 +156,13 @@ STATIC void xfs_buf_do_callbacks(xfs_buf_t *bp, xfs_log_item_t *lip);
*/ */
STATIC uint STATIC uint
xfs_buf_item_size( xfs_buf_item_size(
xfs_buf_log_item_t *bip) struct xfs_log_item *lip)
{ {
uint nvecs; struct xfs_buf_log_item *bip = BUF_ITEM(lip);
int next_bit; struct xfs_buf *bp = bip->bli_buf;
int last_bit; uint nvecs;
xfs_buf_t *bp; int next_bit;
int last_bit;
ASSERT(atomic_read(&bip->bli_refcount) > 0); ASSERT(atomic_read(&bip->bli_refcount) > 0);
if (bip->bli_flags & XFS_BLI_STALE) { if (bip->bli_flags & XFS_BLI_STALE) {
...@@ -169,7 +176,6 @@ xfs_buf_item_size( ...@@ -169,7 +176,6 @@ xfs_buf_item_size(
return 1; return 1;
} }
bp = bip->bli_buf;
ASSERT(bip->bli_flags & XFS_BLI_LOGGED); ASSERT(bip->bli_flags & XFS_BLI_LOGGED);
nvecs = 1; nvecs = 1;
last_bit = xfs_next_bit(bip->bli_format.blf_data_map, last_bit = xfs_next_bit(bip->bli_format.blf_data_map,
...@@ -218,13 +224,13 @@ xfs_buf_item_size( ...@@ -218,13 +224,13 @@ xfs_buf_item_size(
*/ */
STATIC void STATIC void
xfs_buf_item_format( xfs_buf_item_format(
xfs_buf_log_item_t *bip, struct xfs_log_item *lip,
xfs_log_iovec_t *log_vector) struct xfs_log_iovec *vecp)
{ {
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
uint base_size; uint base_size;
uint nvecs; uint nvecs;
xfs_log_iovec_t *vecp;
xfs_buf_t *bp;
int first_bit; int first_bit;
int last_bit; int last_bit;
int next_bit; int next_bit;
...@@ -234,8 +240,6 @@ xfs_buf_item_format( ...@@ -234,8 +240,6 @@ xfs_buf_item_format(
ASSERT(atomic_read(&bip->bli_refcount) > 0); ASSERT(atomic_read(&bip->bli_refcount) > 0);
ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
(bip->bli_flags & XFS_BLI_STALE)); (bip->bli_flags & XFS_BLI_STALE));
bp = bip->bli_buf;
vecp = log_vector;
/* /*
* The size of the base structure is the size of the * The size of the base structure is the size of the
...@@ -262,7 +266,7 @@ xfs_buf_item_format( ...@@ -262,7 +266,7 @@ xfs_buf_item_format(
*/ */
if (bip->bli_flags & XFS_BLI_INODE_BUF) { if (bip->bli_flags & XFS_BLI_INODE_BUF) {
if (!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && if (!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) &&
xfs_log_item_in_current_chkpt(&bip->bli_item))) xfs_log_item_in_current_chkpt(lip)))
bip->bli_format.blf_flags |= XFS_BLF_INODE_BUF; bip->bli_format.blf_flags |= XFS_BLF_INODE_BUF;
bip->bli_flags &= ~XFS_BLI_INODE_BUF; bip->bli_flags &= ~XFS_BLI_INODE_BUF;
} }
...@@ -365,21 +369,20 @@ xfs_buf_item_format( ...@@ -365,21 +369,20 @@ xfs_buf_item_format(
STATIC void STATIC void
xfs_buf_item_pin( xfs_buf_item_pin(
xfs_buf_log_item_t *bip) struct xfs_log_item *lip)
{ {
xfs_buf_t *bp; struct xfs_buf_log_item *bip = BUF_ITEM(lip);
bp = bip->bli_buf; ASSERT(XFS_BUF_ISBUSY(bip->bli_buf));
ASSERT(XFS_BUF_ISBUSY(bp));
ASSERT(atomic_read(&bip->bli_refcount) > 0); ASSERT(atomic_read(&bip->bli_refcount) > 0);
ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
(bip->bli_flags & XFS_BLI_STALE)); (bip->bli_flags & XFS_BLI_STALE));
atomic_inc(&bip->bli_refcount); atomic_inc(&bip->bli_refcount);
trace_xfs_buf_item_pin(bip); trace_xfs_buf_item_pin(bip);
xfs_bpin(bp); xfs_bpin(bip->bli_buf);
} }
/* /*
* This is called to unpin the buffer associated with the buf log * This is called to unpin the buffer associated with the buf log
* item which was previously pinned with a call to xfs_buf_item_pin(). * item which was previously pinned with a call to xfs_buf_item_pin().
...@@ -396,13 +399,14 @@ xfs_buf_item_pin( ...@@ -396,13 +399,14 @@ xfs_buf_item_pin(
*/ */
STATIC void STATIC void
xfs_buf_item_unpin( xfs_buf_item_unpin(
xfs_buf_log_item_t *bip, struct xfs_log_item *lip,
int remove) int remove)
{ {
struct xfs_ail *ailp; struct xfs_buf_log_item *bip = BUF_ITEM(lip);
xfs_buf_t *bp = bip->bli_buf; xfs_buf_t *bp = bip->bli_buf;
int freed; struct xfs_ail *ailp = lip->li_ailp;
int stale = bip->bli_flags & XFS_BLI_STALE; int stale = bip->bli_flags & XFS_BLI_STALE;
int freed;
ASSERT(XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *) == bip); ASSERT(XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *) == bip);
ASSERT(atomic_read(&bip->bli_refcount) > 0); ASSERT(atomic_read(&bip->bli_refcount) > 0);
...@@ -410,8 +414,8 @@ xfs_buf_item_unpin( ...@@ -410,8 +414,8 @@ xfs_buf_item_unpin(
trace_xfs_buf_item_unpin(bip); trace_xfs_buf_item_unpin(bip);
freed = atomic_dec_and_test(&bip->bli_refcount); freed = atomic_dec_and_test(&bip->bli_refcount);
ailp = bip->bli_item.li_ailp;
xfs_bunpin(bp); xfs_bunpin(bp);
if (freed && stale) { if (freed && stale) {
ASSERT(bip->bli_flags & XFS_BLI_STALE); ASSERT(bip->bli_flags & XFS_BLI_STALE);
ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
...@@ -429,7 +433,7 @@ xfs_buf_item_unpin( ...@@ -429,7 +433,7 @@ xfs_buf_item_unpin(
* in xfs_trans_uncommit() will ry to reference the * in xfs_trans_uncommit() will ry to reference the
* buffer which we no longer have a hold on. * buffer which we no longer have a hold on.
*/ */
xfs_trans_del_item(&bip->bli_item); xfs_trans_del_item(lip);
/* /*
* Since the transaction no longer refers to the buffer, * Since the transaction no longer refers to the buffer,
...@@ -468,11 +472,11 @@ xfs_buf_item_unpin( ...@@ -468,11 +472,11 @@ xfs_buf_item_unpin(
*/ */
STATIC uint STATIC uint
xfs_buf_item_trylock( xfs_buf_item_trylock(
xfs_buf_log_item_t *bip) struct xfs_log_item *lip)
{ {
xfs_buf_t *bp; struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
bp = bip->bli_buf;
if (XFS_BUF_ISPINNED(bp)) if (XFS_BUF_ISPINNED(bp))
return XFS_ITEM_PINNED; return XFS_ITEM_PINNED;
if (!XFS_BUF_CPSEMA(bp)) if (!XFS_BUF_CPSEMA(bp))
...@@ -509,13 +513,12 @@ xfs_buf_item_trylock( ...@@ -509,13 +513,12 @@ xfs_buf_item_trylock(
*/ */
STATIC void STATIC void
xfs_buf_item_unlock( xfs_buf_item_unlock(
xfs_buf_log_item_t *bip) struct xfs_log_item *lip)
{ {
int aborted; struct xfs_buf_log_item *bip = BUF_ITEM(lip);
xfs_buf_t *bp; struct xfs_buf *bp = bip->bli_buf;
uint hold; int aborted;
uint hold;
bp = bip->bli_buf;
/* Clear the buffer's association with this transaction. */ /* Clear the buffer's association with this transaction. */
XFS_BUF_SET_FSPRIVATE2(bp, NULL); XFS_BUF_SET_FSPRIVATE2(bp, NULL);
...@@ -526,7 +529,7 @@ xfs_buf_item_unlock( ...@@ -526,7 +529,7 @@ xfs_buf_item_unlock(
* (cancelled) buffers at unpin time, but we'll never go through the * (cancelled) buffers at unpin time, but we'll never go through the
* pin/unpin cycle if we abort inside commit. * pin/unpin cycle if we abort inside commit.
*/ */
aborted = (bip->bli_item.li_flags & XFS_LI_ABORTED) != 0; aborted = (lip->li_flags & XFS_LI_ABORTED) != 0;
/* /*
* Before possibly freeing the buf item, determine if we should * Before possibly freeing the buf item, determine if we should
...@@ -587,16 +590,16 @@ xfs_buf_item_unlock( ...@@ -587,16 +590,16 @@ xfs_buf_item_unlock(
*/ */
STATIC xfs_lsn_t STATIC xfs_lsn_t
xfs_buf_item_committed( xfs_buf_item_committed(
xfs_buf_log_item_t *bip, struct xfs_log_item *lip,
xfs_lsn_t lsn) xfs_lsn_t lsn)
{ {
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
trace_xfs_buf_item_committed(bip); trace_xfs_buf_item_committed(bip);
if ((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && if ((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && lip->li_lsn != 0)
(bip->bli_item.li_lsn != 0)) { return lip->li_lsn;
return bip->bli_item.li_lsn; return lsn;
}
return (lsn);
} }
/* /*
...@@ -606,15 +609,16 @@ xfs_buf_item_committed( ...@@ -606,15 +609,16 @@ xfs_buf_item_committed(
*/ */
STATIC void STATIC void
xfs_buf_item_push( xfs_buf_item_push(
xfs_buf_log_item_t *bip) struct xfs_log_item *lip)
{ {
xfs_buf_t *bp; struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
ASSERT(!XFS_BUF_ISDELAYWRITE(bp));
trace_xfs_buf_item_push(bip); trace_xfs_buf_item_push(bip);
bp = bip->bli_buf;
ASSERT(!XFS_BUF_ISDELAYWRITE(bp));
xfs_buf_relse(bp); xfs_buf_relse(bp);
} }
...@@ -626,22 +630,24 @@ xfs_buf_item_push( ...@@ -626,22 +630,24 @@ xfs_buf_item_push(
*/ */
STATIC void STATIC void
xfs_buf_item_pushbuf( xfs_buf_item_pushbuf(
xfs_buf_log_item_t *bip) struct xfs_log_item *lip)
{ {
xfs_buf_t *bp; struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
ASSERT(XFS_BUF_ISDELAYWRITE(bp));
trace_xfs_buf_item_pushbuf(bip); trace_xfs_buf_item_pushbuf(bip);
bp = bip->bli_buf;
ASSERT(XFS_BUF_ISDELAYWRITE(bp));
xfs_buf_delwri_promote(bp); xfs_buf_delwri_promote(bp);
xfs_buf_relse(bp); xfs_buf_relse(bp);
} }
/* ARGSUSED */
STATIC void STATIC void
xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn) xfs_buf_item_committing(
struct xfs_log_item *lip,
xfs_lsn_t commit_lsn)
{ {
} }
...@@ -649,19 +655,16 @@ xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn) ...@@ -649,19 +655,16 @@ xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn)
* This is the ops vector shared by all buf log items. * This is the ops vector shared by all buf log items.
*/ */
static struct xfs_item_ops xfs_buf_item_ops = { static struct xfs_item_ops xfs_buf_item_ops = {
.iop_size = (uint(*)(xfs_log_item_t*))xfs_buf_item_size, .iop_size = xfs_buf_item_size,
.iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) .iop_format = xfs_buf_item_format,
xfs_buf_item_format, .iop_pin = xfs_buf_item_pin,
.iop_pin = (void(*)(xfs_log_item_t*))xfs_buf_item_pin, .iop_unpin = xfs_buf_item_unpin,
.iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_buf_item_unpin, .iop_trylock = xfs_buf_item_trylock,
.iop_trylock = (uint(*)(xfs_log_item_t*))xfs_buf_item_trylock, .iop_unlock = xfs_buf_item_unlock,
.iop_unlock = (void(*)(xfs_log_item_t*))xfs_buf_item_unlock, .iop_committed = xfs_buf_item_committed,
.iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t)) .iop_push = xfs_buf_item_push,
xfs_buf_item_committed, .iop_pushbuf = xfs_buf_item_pushbuf,
.iop_push = (void(*)(xfs_log_item_t*))xfs_buf_item_push, .iop_committing = xfs_buf_item_committing
.iop_pushbuf = (void(*)(xfs_log_item_t*))xfs_buf_item_pushbuf,
.iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
xfs_buf_item_committing
}; };
......
This diff is collapsed.
...@@ -36,6 +36,12 @@ ...@@ -36,6 +36,12 @@
kmem_zone_t *xfs_ili_zone; /* inode log item zone */ kmem_zone_t *xfs_ili_zone; /* inode log item zone */
static inline struct xfs_inode_log_item *INODE_ITEM(struct xfs_log_item *lip)
{
return container_of(lip, struct xfs_inode_log_item, ili_item);
}
/* /*
* This returns the number of iovecs needed to log the given inode item. * This returns the number of iovecs needed to log the given inode item.
* *
...@@ -45,13 +51,11 @@ kmem_zone_t *xfs_ili_zone; /* inode log item zone */ ...@@ -45,13 +51,11 @@ kmem_zone_t *xfs_ili_zone; /* inode log item zone */
*/ */
STATIC uint STATIC uint
xfs_inode_item_size( xfs_inode_item_size(
xfs_inode_log_item_t *iip) struct xfs_log_item *lip)
{ {
uint nvecs; struct xfs_inode_log_item *iip = INODE_ITEM(lip);
xfs_inode_t *ip; struct xfs_inode *ip = iip->ili_inode;
uint nvecs = 2;
ip = iip->ili_inode;
nvecs = 2;
/* /*
* Only log the data/extents/b-tree root if there is something * Only log the data/extents/b-tree root if there is something
...@@ -202,20 +206,17 @@ xfs_inode_item_size( ...@@ -202,20 +206,17 @@ xfs_inode_item_size(
*/ */
STATIC void STATIC void
xfs_inode_item_format( xfs_inode_item_format(
xfs_inode_log_item_t *iip, struct xfs_log_item *lip,
xfs_log_iovec_t *log_vector) struct xfs_log_iovec *vecp)
{ {
struct xfs_inode_log_item *iip = INODE_ITEM(lip);
struct xfs_inode *ip = iip->ili_inode;
uint nvecs; uint nvecs;
xfs_log_iovec_t *vecp;
xfs_inode_t *ip;
size_t data_bytes; size_t data_bytes;
xfs_bmbt_rec_t *ext_buffer; xfs_bmbt_rec_t *ext_buffer;
int nrecs; int nrecs;
xfs_mount_t *mp; xfs_mount_t *mp;
ip = iip->ili_inode;
vecp = log_vector;
vecp->i_addr = (xfs_caddr_t)&iip->ili_format; vecp->i_addr = (xfs_caddr_t)&iip->ili_format;
vecp->i_len = sizeof(xfs_inode_log_format_t); vecp->i_len = sizeof(xfs_inode_log_format_t);
vecp->i_type = XLOG_REG_TYPE_IFORMAT; vecp->i_type = XLOG_REG_TYPE_IFORMAT;
...@@ -427,7 +428,7 @@ xfs_inode_item_format( ...@@ -427,7 +428,7 @@ xfs_inode_item_format(
* Assert that no attribute-related log flags are set. * Assert that no attribute-related log flags are set.
*/ */
if (!XFS_IFORK_Q(ip)) { if (!XFS_IFORK_Q(ip)) {
ASSERT(nvecs == iip->ili_item.li_desc->lid_size); ASSERT(nvecs == lip->li_desc->lid_size);
iip->ili_format.ilf_size = nvecs; iip->ili_format.ilf_size = nvecs;
ASSERT(!(iip->ili_format.ilf_fields & ASSERT(!(iip->ili_format.ilf_fields &
(XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT))); (XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT)));
...@@ -518,7 +519,7 @@ xfs_inode_item_format( ...@@ -518,7 +519,7 @@ xfs_inode_item_format(
break; break;
} }
ASSERT(nvecs == iip->ili_item.li_desc->lid_size); ASSERT(nvecs == lip->li_desc->lid_size);
iip->ili_format.ilf_size = nvecs; iip->ili_format.ilf_size = nvecs;
} }
...@@ -529,12 +530,14 @@ xfs_inode_item_format( ...@@ -529,12 +530,14 @@ xfs_inode_item_format(
*/ */
STATIC void STATIC void
xfs_inode_item_pin( xfs_inode_item_pin(
xfs_inode_log_item_t *iip) struct xfs_log_item *lip)
{ {
ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL)); struct xfs_inode *ip = INODE_ITEM(lip)->ili_inode;
trace_xfs_inode_pin(iip->ili_inode, _RET_IP_); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
atomic_inc(&iip->ili_inode->i_pincount);
trace_xfs_inode_pin(ip, _RET_IP_);
atomic_inc(&ip->i_pincount);
} }
...@@ -546,10 +549,10 @@ xfs_inode_item_pin( ...@@ -546,10 +549,10 @@ xfs_inode_item_pin(
*/ */
STATIC void STATIC void
xfs_inode_item_unpin( xfs_inode_item_unpin(
xfs_inode_log_item_t *iip, struct xfs_log_item *lip,
int remove) int remove)
{ {
struct xfs_inode *ip = iip->ili_inode; struct xfs_inode *ip = INODE_ITEM(lip)->ili_inode;
trace_xfs_inode_unpin(ip, _RET_IP_); trace_xfs_inode_unpin(ip, _RET_IP_);
ASSERT(atomic_read(&ip->i_pincount) > 0); ASSERT(atomic_read(&ip->i_pincount) > 0);
...@@ -572,19 +575,16 @@ xfs_inode_item_unpin( ...@@ -572,19 +575,16 @@ xfs_inode_item_unpin(
*/ */
STATIC uint STATIC uint
xfs_inode_item_trylock( xfs_inode_item_trylock(
xfs_inode_log_item_t *iip) struct xfs_log_item *lip)
{ {
register xfs_inode_t *ip; struct xfs_inode_log_item *iip = INODE_ITEM(lip);
struct xfs_inode *ip = iip->ili_inode;
ip = iip->ili_inode;
if (xfs_ipincount(ip) > 0) { if (xfs_ipincount(ip) > 0)
return XFS_ITEM_PINNED; return XFS_ITEM_PINNED;
}
if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) { if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED))
return XFS_ITEM_LOCKED; return XFS_ITEM_LOCKED;
}
if (!xfs_iflock_nowait(ip)) { if (!xfs_iflock_nowait(ip)) {
/* /*
...@@ -610,7 +610,7 @@ xfs_inode_item_trylock( ...@@ -610,7 +610,7 @@ xfs_inode_item_trylock(
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
ASSERT(iip->ili_format.ilf_fields != 0); ASSERT(iip->ili_format.ilf_fields != 0);
ASSERT(iip->ili_logged == 0); ASSERT(iip->ili_logged == 0);
ASSERT(iip->ili_item.li_flags & XFS_LI_IN_AIL); ASSERT(lip->li_flags & XFS_LI_IN_AIL);
} }
#endif #endif
return XFS_ITEM_SUCCESS; return XFS_ITEM_SUCCESS;
...@@ -624,12 +624,13 @@ xfs_inode_item_trylock( ...@@ -624,12 +624,13 @@ xfs_inode_item_trylock(
*/ */
STATIC void STATIC void
xfs_inode_item_unlock( xfs_inode_item_unlock(
xfs_inode_log_item_t *iip) struct xfs_log_item *lip)
{ {
uint hold; struct xfs_inode_log_item *iip = INODE_ITEM(lip);
uint iolocked; struct xfs_inode *ip = iip->ili_inode;
uint lock_flags; uint hold;
xfs_inode_t *ip; uint iolocked;
uint lock_flags;
ASSERT(iip != NULL); ASSERT(iip != NULL);
ASSERT(iip->ili_inode->i_itemp != NULL); ASSERT(iip->ili_inode->i_itemp != NULL);
...@@ -640,10 +641,10 @@ xfs_inode_item_unlock( ...@@ -640,10 +641,10 @@ xfs_inode_item_unlock(
ASSERT((!(iip->ili_inode->i_itemp->ili_flags & ASSERT((!(iip->ili_inode->i_itemp->ili_flags &
XFS_ILI_IOLOCKED_SHARED)) || XFS_ILI_IOLOCKED_SHARED)) ||
xfs_isilocked(iip->ili_inode, XFS_IOLOCK_SHARED)); xfs_isilocked(iip->ili_inode, XFS_IOLOCK_SHARED));
/* /*
* Clear the transaction pointer in the inode. * Clear the transaction pointer in the inode.
*/ */
ip = iip->ili_inode;
ip->i_transp = NULL; ip->i_transp = NULL;
/* /*
...@@ -706,13 +707,12 @@ xfs_inode_item_unlock( ...@@ -706,13 +707,12 @@ xfs_inode_item_unlock(
* is the only one that matters. Therefore, simply return the * is the only one that matters. Therefore, simply return the
* given lsn. * given lsn.
*/ */
/*ARGSUSED*/
STATIC xfs_lsn_t STATIC xfs_lsn_t
xfs_inode_item_committed( xfs_inode_item_committed(
xfs_inode_log_item_t *iip, struct xfs_log_item *lip,
xfs_lsn_t lsn) xfs_lsn_t lsn)
{ {
return (lsn); return lsn;
} }
/* /*
...@@ -724,13 +724,12 @@ xfs_inode_item_committed( ...@@ -724,13 +724,12 @@ xfs_inode_item_committed(
*/ */
STATIC void STATIC void
xfs_inode_item_pushbuf( xfs_inode_item_pushbuf(
xfs_inode_log_item_t *iip) struct xfs_log_item *lip)
{ {
xfs_inode_t *ip; struct xfs_inode_log_item *iip = INODE_ITEM(lip);
xfs_mount_t *mp; struct xfs_inode *ip = iip->ili_inode;
xfs_buf_t *bp; struct xfs_buf *bp;
ip = iip->ili_inode;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
/* /*
...@@ -738,14 +737,13 @@ xfs_inode_item_pushbuf( ...@@ -738,14 +737,13 @@ xfs_inode_item_pushbuf(
* inode was taken off the AIL. So, just get out. * inode was taken off the AIL. So, just get out.
*/ */
if (completion_done(&ip->i_flush) || if (completion_done(&ip->i_flush) ||
((iip->ili_item.li_flags & XFS_LI_IN_AIL) == 0)) { !(lip->li_flags & XFS_LI_IN_AIL)) {
xfs_iunlock(ip, XFS_ILOCK_SHARED); xfs_iunlock(ip, XFS_ILOCK_SHARED);
return; return;
} }
mp = ip->i_mount; bp = xfs_incore(ip->i_mount->m_ddev_targp, iip->ili_format.ilf_blkno,
bp = xfs_incore(mp->m_ddev_targp, iip->ili_format.ilf_blkno, iip->ili_format.ilf_len, XBF_TRYLOCK);
iip->ili_format.ilf_len, XBF_TRYLOCK);
xfs_iunlock(ip, XFS_ILOCK_SHARED); xfs_iunlock(ip, XFS_ILOCK_SHARED);
if (!bp) if (!bp)
...@@ -753,10 +751,8 @@ xfs_inode_item_pushbuf( ...@@ -753,10 +751,8 @@ xfs_inode_item_pushbuf(
if (XFS_BUF_ISDELAYWRITE(bp)) if (XFS_BUF_ISDELAYWRITE(bp))
xfs_buf_delwri_promote(bp); xfs_buf_delwri_promote(bp);
xfs_buf_relse(bp); xfs_buf_relse(bp);
return;
} }
/* /*
* This is called to asynchronously write the inode associated with this * This is called to asynchronously write the inode associated with this
* inode log item out to disk. The inode will already have been locked by * inode log item out to disk. The inode will already have been locked by
...@@ -764,14 +760,14 @@ xfs_inode_item_pushbuf( ...@@ -764,14 +760,14 @@ xfs_inode_item_pushbuf(
*/ */
STATIC void STATIC void
xfs_inode_item_push( xfs_inode_item_push(
xfs_inode_log_item_t *iip) struct xfs_log_item *lip)
{ {
xfs_inode_t *ip; struct xfs_inode_log_item *iip = INODE_ITEM(lip);
struct xfs_inode *ip = iip->ili_inode;
ip = iip->ili_inode;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
ASSERT(!completion_done(&ip->i_flush)); ASSERT(!completion_done(&ip->i_flush));
/* /*
* Since we were able to lock the inode's flush lock and * Since we were able to lock the inode's flush lock and
* we found it on the AIL, the inode must be dirty. This * we found it on the AIL, the inode must be dirty. This
...@@ -794,41 +790,34 @@ xfs_inode_item_push( ...@@ -794,41 +790,34 @@ xfs_inode_item_push(
*/ */
(void) xfs_iflush(ip, 0); (void) xfs_iflush(ip, 0);
xfs_iunlock(ip, XFS_ILOCK_SHARED); xfs_iunlock(ip, XFS_ILOCK_SHARED);
return;
} }
/* /*
* XXX rcc - this one really has to do something. Probably needs * XXX rcc - this one really has to do something. Probably needs
* to stamp in a new field in the incore inode. * to stamp in a new field in the incore inode.
*/ */
/* ARGSUSED */
STATIC void STATIC void
xfs_inode_item_committing( xfs_inode_item_committing(
xfs_inode_log_item_t *iip, struct xfs_log_item *lip,
xfs_lsn_t lsn) xfs_lsn_t lsn)
{ {
iip->ili_last_lsn = lsn; INODE_ITEM(lip)->ili_last_lsn = lsn;
return;
} }
/* /*
* This is the ops vector shared by all buf log items. * This is the ops vector shared by all buf log items.
*/ */
static struct xfs_item_ops xfs_inode_item_ops = { static struct xfs_item_ops xfs_inode_item_ops = {
.iop_size = (uint(*)(xfs_log_item_t*))xfs_inode_item_size, .iop_size = xfs_inode_item_size,
.iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) .iop_format = xfs_inode_item_format,
xfs_inode_item_format, .iop_pin = xfs_inode_item_pin,
.iop_pin = (void(*)(xfs_log_item_t*))xfs_inode_item_pin, .iop_unpin = xfs_inode_item_unpin,
.iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_inode_item_unpin, .iop_trylock = xfs_inode_item_trylock,
.iop_trylock = (uint(*)(xfs_log_item_t*))xfs_inode_item_trylock, .iop_unlock = xfs_inode_item_unlock,
.iop_unlock = (void(*)(xfs_log_item_t*))xfs_inode_item_unlock, .iop_committed = xfs_inode_item_committed,
.iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t)) .iop_push = xfs_inode_item_push,
xfs_inode_item_committed, .iop_pushbuf = xfs_inode_item_pushbuf,
.iop_push = (void(*)(xfs_log_item_t*))xfs_inode_item_push, .iop_committing = xfs_inode_item_committing
.iop_pushbuf = (void(*)(xfs_log_item_t*))xfs_inode_item_pushbuf,
.iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
xfs_inode_item_committing
}; };
...@@ -837,10 +826,10 @@ static struct xfs_item_ops xfs_inode_item_ops = { ...@@ -837,10 +826,10 @@ static struct xfs_item_ops xfs_inode_item_ops = {
*/ */
void void
xfs_inode_item_init( xfs_inode_item_init(
xfs_inode_t *ip, struct xfs_inode *ip,
xfs_mount_t *mp) struct xfs_mount *mp)
{ {
xfs_inode_log_item_t *iip; struct xfs_inode_log_item *iip;
ASSERT(ip->i_itemp == NULL); ASSERT(ip->i_itemp == NULL);
iip = ip->i_itemp = kmem_zone_zalloc(xfs_ili_zone, KM_SLEEP); iip = ip->i_itemp = kmem_zone_zalloc(xfs_ili_zone, KM_SLEEP);
......
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