aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2013-12-12 19:00:42 -0500
committerDave Chinner <david@fromorbit.com>2013-12-12 19:00:42 -0500
commit9597df6b26a1988a5a04762711149f98ec6ab388 (patch)
tree576228ddbba2315adaf2d1b5bddd694ef7c81d9d
parentf9b395a8ef8f34d19cae2cde361e19c96e097fad (diff)
xfs: remove duplicate code in xlog_cil_insert_format_items
Share code that was previously duplicated in two branches. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_log_cil.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 5eb51fc5eb84..0a7a8cef6019 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -254,29 +254,22 @@ xlog_cil_insert_format_items(
254 */ 254 */
255 *diff_iovecs -= lv->lv_niovecs; 255 *diff_iovecs -= lv->lv_niovecs;
256 *diff_len -= lv->lv_buf_len; 256 *diff_len -= lv->lv_buf_len;
257 257 } else {
258 /* Ensure the lv is set up according to ->iop_size */ 258 /* allocate new data chunk */
259 lv->lv_niovecs = niovecs; 259 lv = kmem_zalloc(buf_size, KM_SLEEP|KM_NOFS);
260 lv->lv_buf = (char *)lv + buf_size - nbytes; 260 lv->lv_item = lip;
261 261 lv->lv_size = buf_size;
262 lv->lv_buf_len = xlog_cil_lv_item_format(lip, lv); 262 if (ordered) {
263 goto insert; 263 /* track as an ordered logvec */
264 ASSERT(lip->li_lv == NULL);
265 lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
266 goto insert;
267 }
268 lv->lv_iovecp = (struct xfs_log_iovec *)&lv[1];
264 } 269 }
265 270
266 /* allocate new data chunk */ 271 /* Ensure the lv is set up according to ->iop_size */
267 lv = kmem_zalloc(buf_size, KM_SLEEP|KM_NOFS);
268 lv->lv_item = lip;
269 lv->lv_size = buf_size;
270 lv->lv_niovecs = niovecs; 272 lv->lv_niovecs = niovecs;
271 if (ordered) {
272 /* track as an ordered logvec */
273 ASSERT(lip->li_lv == NULL);
274 lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
275 goto insert;
276 }
277
278 /* The allocated iovec region lies beyond the log vector. */
279 lv->lv_iovecp = (struct xfs_log_iovec *)&lv[1];
280 273
281 /* The allocated data region lies beyond the iovec region */ 274 /* The allocated data region lies beyond the iovec region */
282 lv->lv_buf = (char *)lv + buf_size - nbytes; 275 lv->lv_buf = (char *)lv + buf_size - nbytes;