Refactor the buffer item release code into a helper, which we will use
in subsequent patches to make the buffer log item lifetime match the
kernel equivalents.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
return ret;
}
+static void
+xfs_buf_item_put(
+ struct xfs_buf_log_item *bip)
+{
+ struct xfs_buf *bp = bip->bli_buf;
+
+ bp->b_log_item = NULL;
+ kmem_zone_free(xfs_buf_item_zone, bip);
+}
+
void
libxfs_trans_brelse(
xfs_trans_t *tp,
bp = bip->bli_buf;
ASSERT(bp != NULL);
- bp->b_log_item = NULL; /* remove log item */
bp->b_transp = NULL; /* remove xact ptr */
hold = (bip->bli_flags & XFS_BLI_HOLD);
#endif
libxfs_writebuf_int(bp, 0);
}
+
+ bip->bli_flags &= ~XFS_BLI_HOLD;
+ xfs_buf_item_put(bip);
if (hold)
- bip->bli_flags &= ~XFS_BLI_HOLD;
- else
- libxfs_putbuf(bp);
- /* release the buf item */
- kmem_zone_free(xfs_buf_item_zone, bip);
+ return;
+ libxfs_putbuf(bp);
}
static void