From: Carlos Maiolino Date: Tue, 27 Feb 2018 04:43:19 +0000 (-0600) Subject: Split buffer's b_fspriv field X-Git-Tag: v4.16.0-rc1~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=37d086ca9ac33917d90aa883decef8bb24524ba1;p=thirdparty%2Fxfsprogs-dev.git Split buffer's b_fspriv field 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 Reviewed-by: Bill O'Donnell Reviewed-by: Darrick J. Wong [darrick: minor style changes] Signed-off-by: Darrick J. Wong [sandeen: b_li_list unused in userspace] Signed-off-by: Eric Sandeen --- diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 6087fe084..6308a742b 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -69,7 +69,7 @@ typedef struct xfs_buf { 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; diff --git a/libxfs/logitem.c b/libxfs/logitem.c index 0c50fcf16..39ac19232 100644 --- a/libxfs/logitem.c +++ b/libxfs/logitem.c @@ -73,7 +73,7 @@ xfs_trans_buf_item_match( /* * 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. @@ -97,8 +97,8 @@ xfs_buf_item_init( * 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, @@ -121,7 +121,7 @@ xfs_buf_item_init( 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; } diff --git a/libxfs/trans.c b/libxfs/trans.c index f330d4b74..0e7b7ae0a 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -306,7 +306,7 @@ libxfs_trans_inode_alloc_buf( 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); @@ -372,7 +372,7 @@ libxfs_trans_dirty_buf( 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); @@ -400,7 +400,7 @@ libxfs_trans_log_buf( 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))); @@ -420,7 +420,7 @@ libxfs_trans_ordered_buf( 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); @@ -444,7 +444,7 @@ libxfs_trans_brelse( 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--; @@ -467,7 +467,7 @@ libxfs_trans_binval( 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 @@ -500,7 +500,7 @@ libxfs_trans_bjoin( #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; } @@ -510,10 +510,10 @@ libxfs_trans_bhold( 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 @@ -538,7 +538,7 @@ libxfs_trans_get_buf_map( 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; @@ -552,7 +552,7 @@ libxfs_trans_get_buf_map( #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); @@ -578,7 +578,7 @@ libxfs_trans_getsb( 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; @@ -590,7 +590,7 @@ libxfs_trans_getsb( #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); @@ -629,8 +629,8 @@ libxfs_trans_read_buf_map( 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; } @@ -647,7 +647,7 @@ libxfs_trans_read_buf_map( #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); @@ -735,7 +735,7 @@ inode_item_done( 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"), @@ -744,7 +744,7 @@ inode_item_done( } 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 @@ -763,7 +763,7 @@ buf_item_done( 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); diff --git a/libxfs/util.c b/libxfs/util.c index 5e06424ff..2d3b72177 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -466,7 +466,7 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp) 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); diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 89a2a94ce..86e3d3450 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -586,8 +586,8 @@ static void 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 */ @@ -2483,8 +2483,8 @@ static void 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); diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index d0bf4cf77..c3682ebfa 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -304,7 +304,7 @@ xfs_attr3_leaf_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_buf_log_item *bip = bp->b_log_item; struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr; xfs_failaddr_t fa; diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c index 375c04f6e..1ec9ce13d 100644 --- a/libxfs/xfs_btree.c +++ b/libxfs/xfs_btree.c @@ -269,7 +269,7 @@ xfs_btree_lblock_calc_crc( 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; @@ -307,7 +307,7 @@ xfs_btree_sblock_calc_crc( 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; diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index b442d9a4b..269edf9a2 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -177,7 +177,7 @@ xfs_da3_node_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_buf_log_item *bip = bp->b_log_item; struct xfs_da3_node_hdr *hdr3 = bp->b_addr; xfs_failaddr_t fa; diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index f69561eba..e2c524ed7 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -99,7 +99,7 @@ xfs_dir3_block_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_buf_log_item *bip = bp->b_log_item; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; xfs_failaddr_t fa; diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index 175c119e4..f78c7174b 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -317,7 +317,7 @@ xfs_dir3_data_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_buf_log_item *bip = bp->b_log_item; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; xfs_failaddr_t fa; diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c index ff2996be1..60f7eb29a 100644 --- a/libxfs/xfs_dir2_leaf.c +++ b/libxfs/xfs_dir2_leaf.c @@ -205,7 +205,7 @@ __write_verify( 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; diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index 399926457..6d7986c99 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -138,7 +138,7 @@ xfs_dir3_free_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_buf_log_item *bip = bp->b_log_item; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; xfs_failaddr_t fa; diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index e5b78027c..4233d1ea8 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -2551,8 +2551,8 @@ static void 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); diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c index bca65eeb6..e8dd4632c 100644 --- a/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c @@ -670,7 +670,7 @@ xfs_sb_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_buf_log_item *bip = bp->b_log_item; int error; error = xfs_sb_verify(bp, false); diff --git a/libxfs/xfs_symlink_remote.c b/libxfs/xfs_symlink_remote.c index 4f920f194..bcd85421c 100644 --- a/libxfs/xfs_symlink_remote.c +++ b/libxfs/xfs_symlink_remote.c @@ -145,7 +145,7 @@ xfs_symlink_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_buf_log_item *bip = bp->b_log_item; xfs_failaddr_t fa; /* no verification of non-crc buffers */