]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Split buffer's b_fspriv field
authorCarlos Maiolino <cmaiolino@redhat.com>
Tue, 27 Feb 2018 04:43:19 +0000 (22:43 -0600)
committerEric Sandeen <sandeen@redhat.com>
Tue, 27 Feb 2018 04:43:19 +0000 (22:43 -0600)
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>
15 files changed:
libxfs/libxfs_io.h
libxfs/logitem.c
libxfs/trans.c
libxfs/util.c
libxfs/xfs_alloc.c
libxfs/xfs_attr_leaf.c
libxfs/xfs_btree.c
libxfs/xfs_da_btree.c
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_data.c
libxfs/xfs_dir2_leaf.c
libxfs/xfs_dir2_node.c
libxfs/xfs_ialloc.c
libxfs/xfs_sb.c
libxfs/xfs_symlink_remote.c

index 6087fe084a84a3be1ebacf0b84a73975ac00be29..6308a742bc2ac993c05ff3e2486690517e5db6f8 100644 (file)
@@ -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;
index 0c50fcf16b5cd7e026b797778eea4930de15fcc0..39ac19232f667ee0fb4a2ad3b73159a0b816bc03 100644 (file)
@@ -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;
 }
 
 
index f330d4b74b46684b594813234ded40dffb743062..0e7b7ae0a7b2c93b448ec3ee5ea2c62ce00f83af 100644 (file)
@@ -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);
index 5e06424ff385fba97eb2e7f9538059697cadfca6..2d3b721777e33992158b1b55494665f8afe482da 100644 (file)
@@ -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);
index 89a2a94cec068cadce8e0484f0df1fd0f101d855..86e3d3450c42e346c47589208b03f787ab7cc962 100644 (file)
@@ -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);
index d0bf4cf77e08ca11c2e0fee79df329c6549ebd4c..c3682ebfaa7b03624fa9adf796973bd9a00fcc25 100644 (file)
@@ -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;
 
index 375c04f6e6d014f0d21bd70b0375e2aa8748b2e8..1ec9ce13d0e340b210a4a0bed75bb6f39ac61efd 100644 (file)
@@ -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;
index b442d9a4b911237a0d36536494ddc7f5ce1a1cbb..269edf9a2602d72f874d2b79466bfc4f69336cf4 100644 (file)
@@ -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;
 
index f69561ebaf666ad5de05406ee6f1a6a1b965ab28..e2c524ed75bd594a6e88c56c2b0a3bee07f6a5c1 100644 (file)
@@ -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;
 
index 175c119e4bd9bd99e9be211ace47450f7edcdc8b..f78c7174bcfa5fc51e3142355c7e611858eaa27f 100644 (file)
@@ -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;
 
index ff2996be15b9106bf57c167a398cb70001c0aa8d..60f7eb29a94e8dc8a8bff0e9c641b2c0d42e642e 100644 (file)
@@ -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;
 
index 399926457acd43e1e3097df4cfb7d83b822ddf00..6d7986c99652fc796f992f4b51278274e784f202 100644 (file)
@@ -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;
 
index e5b78027cd03479f8a31485b863d452d1421e900..4233d1ea86a31539a68a863d99641139c34c49ba 100644 (file)
@@ -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);
index bca65eeb66443e49d0487a22807ed06d6565364a..e8dd4632cd9a4e4828e8f1af3008b6fbaf4945df 100644 (file)
@@ -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);
index 4f920f19416a343ba251315d2805f3bdf6e3c691..bcd85421c1d470714956cd59595bce7772297f99 100644 (file)
@@ -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 */