diff options
author | Christoph Hellwig <hch@infradead.org> | 2013-12-13 11:00:43 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2013-12-13 11:00:43 +1100 |
commit | 1234351cba958cd5d4338172ccfc869a687cd736 (patch) | |
tree | 4ac537e061808787a266a4d1fcfb0e09d185af2e /fs/xfs/xfs_buf_item.c | |
parent | 3de559fbd04d67473b9be2bd183823c40c4b7557 (diff) | |
download | op-kernel-dev-1234351cba958cd5d4338172ccfc869a687cd736.zip op-kernel-dev-1234351cba958cd5d4338172ccfc869a687cd736.tar.gz |
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 <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_buf_item.c')
-rw-r--r-- | fs/xfs/xfs_buf_item.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index a30c1fb..d49419d 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; } |