From: Dave Chinner <dchinner@xxxxxxxxxx> Each log item type does manual initialisation of the log item. Delayed logging introduces new fields that need initialisation, so factor all the open coded initialisation into a common function first. Source kernel commit: 43f5efc5b59db1b66e39fe9fdfc4ba6a27152afa Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> [sandeen: merge to userspace] Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> Reviewed-by: Allison Collins <allison.henderson@xxxxxxxxxx> Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- libxfs/libxfs_priv.h | 1 + libxfs/logitem.c | 8 ++------ libxfs/util.c | 12 ++++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index d668a15..a8c0f0b 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -564,6 +564,7 @@ int libxfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb, bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t); +void xfs_log_item_init(struct xfs_mount *, struct xfs_log_item *, int); #define xfs_log_in_recovery(mp) (false) /* xfs_icache.c */ diff --git a/libxfs/logitem.c b/libxfs/logitem.c index e862ab4..14c62f6 100644 --- a/libxfs/logitem.c +++ b/libxfs/logitem.c @@ -103,9 +103,7 @@ xfs_buf_item_init( fprintf(stderr, "adding buf item %p for not-logged buffer %p\n", bip, bp); #endif - bip->bli_item.li_type = XFS_LI_BUF; - bip->bli_item.li_mountp = mp; - INIT_LIST_HEAD(&bip->bli_item.li_trans); + xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF); bip->bli_buf = bp; bip->__bli_format.blf_type = XFS_LI_BUF; bip->__bli_format.blf_blkno = (int64_t)XFS_BUF_ADDR(bp); @@ -149,8 +147,6 @@ xfs_inode_item_init( ip->i_ino, iip); #endif - iip->ili_item.li_type = XFS_LI_INODE; - iip->ili_item.li_mountp = mp; - INIT_LIST_HEAD(&iip->ili_item.li_trans); + xfs_log_item_init(mp, &iip->ili_item, XFS_LI_INODE); iip->ili_inode = ip; } diff --git a/libxfs/util.c b/libxfs/util.c index 8c9954f..0496dcb 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -692,6 +692,18 @@ xfs_log_check_lsn( return true; } +void +xfs_log_item_init( + struct xfs_mount *mp, + struct xfs_log_item *item, + int type) +{ + item->li_mountp = mp; + item->li_type = type; + + INIT_LIST_HEAD(&item->li_trans); +} + static struct xfs_buftarg * xfs_find_bdev_for_inode( struct xfs_inode *ip) -- 1.8.3.1