From 1234351cba958cd5d4338172ccfc869a687cd736 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 13 Dec 2013 11:00:43 +1100 Subject: xfs: introduce xlog_copy_iovec Add a helper to abstract out filling the log iovecs in the log item format handlers. This will allow us to change the way we do the log item formatting more easily. The copy in the name is a bit confusing for now as it just assigns a pointer and lets the CIL code perform the copy, but that will change soon. Signed-off-by: Christoph Hellwig Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- fs/xfs/xfs_buf_item.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'fs/xfs/xfs_buf_item.c') diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index a30c1fb1bec6..d49419d4bb46 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -182,20 +182,18 @@ xfs_buf_item_size( trace_xfs_buf_item_size(bip); } -static inline struct xfs_log_iovec * +static inline void xfs_buf_item_copy_iovec( - struct xfs_log_iovec *vecp, + struct xfs_log_iovec **vecp, struct xfs_buf *bp, uint offset, int first_bit, uint nbits) { offset += first_bit * XFS_BLF_CHUNK; - - vecp->i_type = XLOG_REG_TYPE_BCHUNK; - vecp->i_addr = xfs_buf_offset(bp, offset); - vecp->i_len = nbits * XFS_BLF_CHUNK; - return vecp + 1; + xlog_copy_iovec(vecp, XLOG_REG_TYPE_BCHUNK, + xfs_buf_offset(bp, offset), + nbits * XFS_BLF_CHUNK); } static inline bool @@ -210,10 +208,10 @@ xfs_buf_item_straddle( XFS_BLF_CHUNK); } -static struct xfs_log_iovec * +static void xfs_buf_item_format_segment( struct xfs_buf_log_item *bip, - struct xfs_log_iovec *vecp, + struct xfs_log_iovec **vecp, uint offset, struct xfs_buf_log_format *blfp) { @@ -245,10 +243,7 @@ xfs_buf_item_format_segment( goto out; } - vecp->i_addr = blfp; - vecp->i_len = base_size; - vecp->i_type = XLOG_REG_TYPE_BFORMAT; - vecp++; + xlog_copy_iovec(vecp, XLOG_REG_TYPE_BFORMAT, blfp, base_size); nvecs = 1; if (bip->bli_flags & XFS_BLI_STALE) { @@ -291,8 +286,8 @@ xfs_buf_item_format_segment( break; } else if (next_bit != last_bit + 1 || xfs_buf_item_straddle(bp, offset, next_bit, last_bit)) { - vecp = xfs_buf_item_copy_iovec(vecp, bp, offset, - first_bit, nbits); + xfs_buf_item_copy_iovec(vecp, bp, offset, + first_bit, nbits); nvecs++; first_bit = next_bit; last_bit = next_bit; @@ -304,7 +299,6 @@ xfs_buf_item_format_segment( } out: blfp->blf_size = nvecs; - return vecp; } /* @@ -360,8 +354,8 @@ xfs_buf_item_format( } for (i = 0; i < bip->bli_format_count; i++) { - vecp = xfs_buf_item_format_segment(bip, vecp, offset, - &bip->bli_formats[i]); + xfs_buf_item_format_segment(bip, &vecp, offset, + &bip->bli_formats[i]); offset += bp->b_maps[i].bm_len; } -- cgit v1.2.1