Source kernel commit:
fb1755a645972ed096047583600838f6cf414e2b
By splitting the b_fspriv field into two different fields (b_log_item
and b_li_list). It's possible to get rid of an old ABI workaround, by
using the new b_log_item field to store xfs_buf_log_item separated from
the log items attached to the buffer, which will be linked in the new
b_li_list field.
This way, there is no more need to reorder the log items list to place
the buf_log_item at the beginning of the list, simplifying a bit the
logic to handle buffer IO.
This also opens the possibility to change buffer's log items list into a
proper list_head.
b_log_item field is still defined as a void *, because it is still used
by the log buffers to store xlog_in_core structures, and there is no
need to add an extra field on xfs_buf just for xlog_in_core.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
[darrick: minor style changes]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[sandeen: b_li_list unused in userspace]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
pthread_mutex_t b_lock;
pthread_t b_holder;
unsigned int b_recur;
- void *b_fspriv;
+ void *b_log_item;
void *b_transp;
void *b_addr;
int b_error;
/*
* Allocate a new buf log item to go with the given buffer.
- * Set the buffer's b_fsprivate field to point to the new
+ * Set the buffer's b_log_item field to point to the new
* buf log item. If there are other item's attached to the
* buffer (see xfs_buf_attach_iodone() below), then put the
* buf log item at the front.
* nothing to do here so return.
*/
XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb);
- if (bp->b_fspriv != NULL) {
- lip = bp->b_fspriv;
+ if (bp->b_log_item != NULL) {
+ lip = bp->b_log_item;
if (lip->li_type == XFS_LI_BUF) {
#ifdef LI_DEBUG
fprintf(stderr,
bip->bli_format.blf_type = XFS_LI_BUF;
bip->bli_format.blf_blkno = (int64_t)XFS_BUF_ADDR(bp);
bip->bli_format.blf_len = (unsigned short)BTOBB(XFS_BUF_COUNT(bp));
- bp->b_fspriv = bip;
+ bp->b_log_item = bip;
}
xfs_trans_t *tp,
xfs_buf_t *bp)
{
- xfs_buf_log_item_t *bip = bp->b_fspriv;;
+ xfs_buf_log_item_t *bip = bp->b_log_item;
ASSERT(bp->bp_transp == tp);
ASSERT(bip != NULL);
struct xfs_trans *tp,
struct xfs_buf *bp)
{
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
ASSERT(bp->bp_transp == tp);
ASSERT(bip != NULL);
uint first,
uint last)
{
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp)));
struct xfs_trans *tp,
struct xfs_buf *bp)
{
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
bool ret;
ret = (bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY);
return;
}
ASSERT(bp->bp_transp == tp);
- bip = bp->b_fspriv;
+ bip = bp->b_log_item;
ASSERT(bip->bli_item.li_type == XFS_LI_BUF);
if (bip->bli_recur > 0) {
bip->bli_recur--;
xfs_trans_t *tp,
xfs_buf_t *bp)
{
- xfs_buf_log_item_t *bip = bp->b_fspriv;
+ xfs_buf_log_item_t *bip = bp->b_log_item;
#ifdef XACT_DEBUG
fprintf(stderr, "binval'd buffer %p, transaction %p\n", bp, tp);
#endif
#endif
xfs_buf_item_init(bp, tp->t_mountp);
- bip = bp->b_fspriv;
+ bip = bp->b_log_item;
xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
bp->b_transp = tp;
}
xfs_trans_t *tp,
xfs_buf_t *bp)
{
- xfs_buf_log_item_t *bip =bp->b_fspriv;
+ xfs_buf_log_item_t *bip = bp->b_log_item;
ASSERT(bp->bp_transp == tp);
- ASSERT(bp->b_fspriv != NULL);
+ ASSERT(bip != NULL);
#ifdef XACT_DEBUG
fprintf(stderr, "bhold'd buffer %p, transaction %p\n", bp, tp);
#endif
bp = xfs_trans_buf_item_match(tp, btp, map, nmaps);
if (bp != NULL) {
ASSERT(bp->bp_transp == tp);
- bip = bp->b_fspriv;
+ bip = bp->b_log_item;
ASSERT(bip != NULL);
bip->bli_recur++;
return bp;
#endif
xfs_buf_item_init(bp, tp->t_mountp);
- bip = bp->b_fspriv;
+ bip = bp->b_log_item;
bip->bli_recur = 0;
xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
bp = xfs_trans_buf_item_match(tp, mp->m_dev, &map, 1);
if (bp != NULL) {
ASSERT(bp->bp_transp == tp);
- bip = bp->b_fspriv;
+ bip = bp->b_log_item;
ASSERT(bip != NULL);
bip->bli_recur++;
return bp;
#endif
xfs_buf_item_init(bp, mp);
- bip = bp->b_fspriv;
+ bip = bp->b_log_item;
bip->bli_recur = 0;
xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
bp = xfs_trans_buf_item_match(tp, btp, map, nmaps);
if (bp != NULL) {
ASSERT(bp->bp_transp == tp);
- ASSERT(bp->b_fspriv != NULL);
- bip = bp->b_fspriv;
+ ASSERT(bp->b_log_item != NULL);
+ bip = bp->b_log_item;
bip->bli_recur++;
goto done;
}
#endif
xfs_buf_item_init(bp, tp->t_mountp);
- bip = bp->b_fspriv;
+ bip = bp->b_log_item;
bip->bli_recur = 0;
xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
return;
}
- bp->b_fspriv = iip;
+ bp->b_log_item = iip;
error = libxfs_iflush_int(ip, bp);
if (error) {
fprintf(stderr, _("%s: warning - iflush_int failed (%d)\n"),
}
ip->i_transp = NULL; /* disassociate from transaction */
- bp->b_fspriv = NULL; /* remove log item */
+ bp->b_log_item = NULL; /* remove log item */
bp->b_transp = NULL; /* remove xact ptr */
libxfs_writebuf(bp, 0);
#ifdef XACT_DEBUG
bp = bip->bli_buf;
ASSERT(bp != NULL);
- bp->b_fspriv = NULL; /* remove log item */
+ bp->b_log_item = NULL; /* remove log item */
bp->b_transp = NULL; /* remove xact ptr */
hold = (bip->bli_flags & XFS_BLI_HOLD);
xfs_dinode_t *dip;
xfs_mount_t *mp;
- ASSERT(bp-b_fspriv != NULL);
+ ASSERT(bp-b_log_item != NULL);
ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE ||
ip->i_d.di_nextents > ip->i_df.if_ext_max);
ASSERT(ip->i_d.di_version > 1);
xfs_agfl_write_verify(
struct xfs_buf *bp)
{
- struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_mount *mp = bp->b_target->bt_mount;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
xfs_failaddr_t fa;
/* no verification of non-crc AGFLs */
xfs_agf_write_verify(
struct xfs_buf *bp)
{
- struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_mount *mp = bp->b_target->bt_mount;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
xfs_failaddr_t fa;
fa = xfs_agf_verify(bp);
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr;
xfs_failaddr_t fa;
struct xfs_buf *bp)
{
struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
if (!xfs_sb_version_hascrc(&bp->b_target->bt_mount->m_sb))
return;
struct xfs_buf *bp)
{
struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
if (!xfs_sb_version_hascrc(&bp->b_target->bt_mount->m_sb))
return;
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
xfs_failaddr_t fa;
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
xfs_failaddr_t fa;
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
xfs_failaddr_t fa;
uint16_t magic)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr;
xfs_failaddr_t fa;
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
xfs_failaddr_t fa;
xfs_agi_write_verify(
struct xfs_buf *bp)
{
- struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_mount *mp = bp->b_target->bt_mount;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
xfs_failaddr_t fa;
fa = xfs_agi_verify(bp);
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
int error;
error = xfs_sb_verify(bp, false);
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_target->bt_mount;
- struct xfs_buf_log_item *bip = bp->b_fspriv;
+ struct xfs_buf_log_item *bip = bp->b_log_item;
xfs_failaddr_t fa;
/* no verification of non-crc buffers */