提交 9597df6b 编写于 作者: C Christoph Hellwig 提交者: Dave Chinner

xfs: remove duplicate code in xlog_cil_insert_format_items

Share code that was previously duplicated in two branches.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 f9b395a8
...@@ -254,29 +254,22 @@ xlog_cil_insert_format_items( ...@@ -254,29 +254,22 @@ xlog_cil_insert_format_items(
*/ */
*diff_iovecs -= lv->lv_niovecs; *diff_iovecs -= lv->lv_niovecs;
*diff_len -= lv->lv_buf_len; *diff_len -= lv->lv_buf_len;
} else {
/* Ensure the lv is set up according to ->iop_size */ /* allocate new data chunk */
lv->lv_niovecs = niovecs; lv = kmem_zalloc(buf_size, KM_SLEEP|KM_NOFS);
lv->lv_buf = (char *)lv + buf_size - nbytes; lv->lv_item = lip;
lv->lv_size = buf_size;
lv->lv_buf_len = xlog_cil_lv_item_format(lip, lv); if (ordered) {
goto insert; /* track as an ordered logvec */
ASSERT(lip->li_lv == NULL);
lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
goto insert;
}
lv->lv_iovecp = (struct xfs_log_iovec *)&lv[1];
} }
/* allocate new data chunk */ /* Ensure the lv is set up according to ->iop_size */
lv = kmem_zalloc(buf_size, KM_SLEEP|KM_NOFS);
lv->lv_item = lip;
lv->lv_size = buf_size;
lv->lv_niovecs = niovecs; lv->lv_niovecs = niovecs;
if (ordered) {
/* track as an ordered logvec */
ASSERT(lip->li_lv == NULL);
lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
goto insert;
}
/* The allocated iovec region lies beyond the log vector. */
lv->lv_iovecp = (struct xfs_log_iovec *)&lv[1];
/* The allocated data region lies beyond the iovec region */ /* The allocated data region lies beyond the iovec region */
lv->lv_buf = (char *)lv + buf_size - nbytes; lv->lv_buf = (char *)lv + buf_size - nbytes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册