From 166d13688a0e2d0aa379e259af8e2ee6a401de9a Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Mon, 12 Aug 2013 20:50:04 +1000 Subject: xfs: return log item size in IOP_SIZE To begin optimising the CIL commit process, we need to have IOP_SIZE return both the number of vectors and the size of the data pointed to by the vectors. This enables us to calculate the size ofthe memory allocation needed before the formatting step and reduces the number of memory allocations per item by one. While there, kill the IOP_SIZE macro. Signed-off-by: Dave Chinner Reviewed-by: Mark Tinguely Signed-off-by: Ben Myers --- fs/xfs/xfs_log_cil.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'fs/xfs/xfs_log_cil.c') diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c index 02b9cf3f8252..4e108720a789 100644 --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c @@ -122,19 +122,23 @@ xlog_cil_prepare_log_vecs( } list_for_each_entry(lidp, &tp->t_items, lid_trans) { + struct xfs_log_item *lip = lidp->lid_item; struct xfs_log_vec *new_lv; void *ptr; int index; int len = 0; - uint niovecs; + uint niovecs = 0; + uint nbytes = 0; bool ordered = false; /* Skip items which aren't dirty in this transaction. */ if (!(lidp->lid_flags & XFS_LID_DIRTY)) continue; + /* get number of vecs and size of data to be stored */ + lip->li_ops->iop_size(lip, &niovecs, &nbytes); + /* Skip items that do not have any vectors for writing */ - niovecs = IOP_SIZE(lidp->lid_item); if (!niovecs) continue; @@ -152,7 +156,7 @@ xlog_cil_prepare_log_vecs( niovecs * sizeof(struct xfs_log_iovec), KM_SLEEP|KM_NOFS); - new_lv->lv_item = lidp->lid_item; + new_lv->lv_item = lip; new_lv->lv_niovecs = niovecs; if (ordered) { /* track as an ordered logvec */ -- cgit v1.2.3-59-g8ed1b