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
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)
{
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) {
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;
}
out:
blfp->blf_size = nvecs;
- return vecp;
}
/*
}
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;
}
STATIC void
xfs_qm_dquot_logitem_format(
struct xfs_log_item *lip,
- struct xfs_log_iovec *logvec)
+ struct xfs_log_iovec *vecp)
{
struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip);
- logvec->i_addr = &qlip->qli_format;
- logvec->i_len = sizeof(xfs_dq_logformat_t);
- logvec->i_type = XLOG_REG_TYPE_QFORMAT;
- logvec++;
- logvec->i_addr = &qlip->qli_dquot->q_core;
- logvec->i_len = sizeof(xfs_disk_dquot_t);
- logvec->i_type = XLOG_REG_TYPE_DQUOT;
+ xlog_copy_iovec(&vecp, XLOG_REG_TYPE_QFORMAT,
+ &qlip->qli_format,
+ sizeof(struct xfs_dq_logformat));
+ xlog_copy_iovec(&vecp, XLOG_REG_TYPE_DQUOT,
+ &qlip->qli_dquot->q_core,
+ sizeof(struct xfs_disk_dquot));
qlip->qli_format.qlf_size = 2;
-
}
/*
STATIC void
xfs_qm_qoff_logitem_format(
struct xfs_log_item *lip,
- struct xfs_log_iovec *log_vector)
+ struct xfs_log_iovec *vecp)
{
struct xfs_qoff_logitem *qflip = QOFF_ITEM(lip);
ASSERT(qflip->qql_format.qf_type == XFS_LI_QUOTAOFF);
- log_vector->i_addr = &qflip->qql_format;
- log_vector->i_len = sizeof(xfs_qoff_logitem_t);
- log_vector->i_type = XLOG_REG_TYPE_QUOTAOFF;
+ xlog_copy_iovec(&vecp, XLOG_REG_TYPE_QUOTAOFF,
+ &qflip->qql_format,
+ sizeof(struct xfs_qoff_logitem));
+
qflip->qql_format.qf_size = 1;
}
#include "xfs_trace.h"
#include "xfs_trans_priv.h"
#include "xfs_dinode.h"
+#include "xfs_log.h"
kmem_zone_t *xfs_ili_zone; /* inode log item zone */
* here, so always use the physical fork size to determine the size of the
* buffer we need to allocate.
*/
-STATIC void
+STATIC int
xfs_inode_item_format_extents(
struct xfs_inode *ip,
- struct xfs_log_iovec *vecp,
+ struct xfs_log_iovec **vecp,
int whichfork,
int type)
{
xfs_bmbt_rec_t *ext_buffer;
+ int len;
ext_buffer = kmem_alloc(XFS_IFORK_SIZE(ip, whichfork), KM_SLEEP);
if (whichfork == XFS_DATA_FORK)
else
ip->i_itemp->ili_aextents_buf = ext_buffer;
- vecp->i_addr = ext_buffer;
- vecp->i_len = xfs_iextents_copy(ip, ext_buffer, whichfork);
- vecp->i_type = type;
+ len = xfs_iextents_copy(ip, ext_buffer, whichfork);
+ xlog_copy_iovec(vecp, type, ext_buffer, len);
+ return len;
}
/*
}
}
-STATIC struct xfs_log_iovec *
+STATIC void
xfs_inode_item_format_data_fork(
struct xfs_inode_log_item *iip,
- struct xfs_log_iovec *vecp,
+ struct xfs_log_iovec **vecp,
int *nvecs)
{
struct xfs_inode *ip = iip->ili_inode;
* extents, so just point to the
* real extents array.
*/
- vecp->i_addr = ip->i_df.if_u1.if_extents;
- vecp->i_len = ip->i_df.if_bytes;
- vecp->i_type = XLOG_REG_TYPE_IEXT;
+ xlog_copy_iovec(vecp, XLOG_REG_TYPE_IEXT,
+ ip->i_df.if_u1.if_extents,
+ ip->i_df.if_bytes);
+ iip->ili_format.ilf_dsize = ip->i_df.if_bytes;
} else
#endif
{
- xfs_inode_item_format_extents(ip, vecp,
- XFS_DATA_FORK, XLOG_REG_TYPE_IEXT);
+ iip->ili_format.ilf_dsize =
+ xfs_inode_item_format_extents(ip, vecp,
+ XFS_DATA_FORK, XLOG_REG_TYPE_IEXT);
+ ASSERT(iip->ili_format.ilf_dsize <= ip->i_df.if_bytes);
}
- ASSERT(vecp->i_len <= ip->i_df.if_bytes);
- iip->ili_format.ilf_dsize = vecp->i_len;
- vecp++;
(*nvecs)++;
} else {
iip->ili_fields &= ~XFS_ILOG_DEXT;
if ((iip->ili_fields & XFS_ILOG_DBROOT) &&
ip->i_df.if_broot_bytes > 0) {
ASSERT(ip->i_df.if_broot != NULL);
- vecp->i_addr = ip->i_df.if_broot;
- vecp->i_len = ip->i_df.if_broot_bytes;
- vecp->i_type = XLOG_REG_TYPE_IBROOT;
- vecp++;
+ xlog_copy_iovec(vecp, XLOG_REG_TYPE_IBROOT,
+ ip->i_df.if_broot,
+ ip->i_df.if_broot_bytes);
(*nvecs)++;
iip->ili_format.ilf_dsize = ip->i_df.if_broot_bytes;
} else {
XFS_ILOG_DEV | XFS_ILOG_UUID);
if ((iip->ili_fields & XFS_ILOG_DDATA) &&
ip->i_df.if_bytes > 0) {
- ASSERT(ip->i_df.if_u1.if_data != NULL);
- ASSERT(ip->i_d.di_size > 0);
-
- vecp->i_addr = ip->i_df.if_u1.if_data;
/*
* Round i_bytes up to a word boundary.
* The underlying memory is guaranteed to
* to be there by xfs_idata_realloc().
*/
data_bytes = roundup(ip->i_df.if_bytes, 4);
- ASSERT((ip->i_df.if_real_bytes == 0) ||
- (ip->i_df.if_real_bytes == data_bytes));
- vecp->i_len = (int)data_bytes;
- vecp->i_type = XLOG_REG_TYPE_ILOCAL;
- vecp++;
+ ASSERT(ip->i_df.if_real_bytes == 0 ||
+ ip->i_df.if_real_bytes == data_bytes);
+ ASSERT(ip->i_df.if_u1.if_data != NULL);
+ ASSERT(ip->i_d.di_size > 0);
+ xlog_copy_iovec(vecp, XLOG_REG_TYPE_ILOCAL,
+ ip->i_df.if_u1.if_data, data_bytes);
(*nvecs)++;
iip->ili_format.ilf_dsize = (unsigned)data_bytes;
} else {
ASSERT(0);
break;
}
-
- return vecp;
}
-STATIC struct xfs_log_iovec *
+STATIC void
xfs_inode_item_format_attr_fork(
struct xfs_inode_log_item *iip,
- struct xfs_log_iovec *vecp,
+ struct xfs_log_iovec **vecp,
int *nvecs)
{
struct xfs_inode *ip = iip->ili_inode;
* There are not delayed allocation extents
* for attributes, so just point at the array.
*/
- vecp->i_addr = ip->i_afp->if_u1.if_extents;
- vecp->i_len = ip->i_afp->if_bytes;
- vecp->i_type = XLOG_REG_TYPE_IATTR_EXT;
+ xlog_copy_iovec(vecp, XLOG_REG_TYPE_IATTR_EXT,
+ ip->i_afp->if_u1.if_extents,
+ ip->i_afp->if_bytes);
+ iip->ili_format.ilf_asize = ip->i_afp->if_bytes;
#else
ASSERT(iip->ili_aextents_buf == NULL);
- xfs_inode_item_format_extents(ip, vecp,
+ iip->ili_format.ilf_asize =
+ xfs_inode_item_format_extents(ip, vecp,
XFS_ATTR_FORK, XLOG_REG_TYPE_IATTR_EXT);
#endif
- iip->ili_format.ilf_asize = vecp->i_len;
- vecp++;
(*nvecs)++;
} else {
iip->ili_fields &= ~XFS_ILOG_AEXT;
ip->i_afp->if_broot_bytes > 0) {
ASSERT(ip->i_afp->if_broot != NULL);
- vecp->i_addr = ip->i_afp->if_broot;
- vecp->i_len = ip->i_afp->if_broot_bytes;
- vecp->i_type = XLOG_REG_TYPE_IATTR_BROOT;
- vecp++;
+ xlog_copy_iovec(vecp, XLOG_REG_TYPE_IATTR_BROOT,
+ ip->i_afp->if_broot,
+ ip->i_afp->if_broot_bytes);
(*nvecs)++;
iip->ili_format.ilf_asize = ip->i_afp->if_broot_bytes;
} else {
if ((iip->ili_fields & XFS_ILOG_ADATA) &&
ip->i_afp->if_bytes > 0) {
- ASSERT(ip->i_afp->if_u1.if_data != NULL);
-
- vecp->i_addr = ip->i_afp->if_u1.if_data;
/*
* Round i_bytes up to a word boundary.
* The underlying memory is guaranteed to
* to be there by xfs_idata_realloc().
*/
data_bytes = roundup(ip->i_afp->if_bytes, 4);
- ASSERT((ip->i_afp->if_real_bytes == 0) ||
- (ip->i_afp->if_real_bytes == data_bytes));
- vecp->i_len = (int)data_bytes;
- vecp->i_type = XLOG_REG_TYPE_IATTR_LOCAL;
- vecp++;
+ ASSERT(ip->i_afp->if_real_bytes == 0 ||
+ ip->i_afp->if_real_bytes == data_bytes);
+ ASSERT(ip->i_afp->if_u1.if_data != NULL);
+ xlog_copy_iovec(vecp, XLOG_REG_TYPE_IATTR_LOCAL,
+ ip->i_afp->if_u1.if_data,
+ data_bytes);
(*nvecs)++;
iip->ili_format.ilf_asize = (unsigned)data_bytes;
} else {
ASSERT(0);
break;
}
-
- return vecp;
}
/*
struct xfs_inode *ip = iip->ili_inode;
uint nvecs;
- vecp->i_addr = &iip->ili_format;
- vecp->i_len = sizeof(xfs_inode_log_format_t);
- vecp->i_type = XLOG_REG_TYPE_IFORMAT;
- vecp++;
- nvecs = 1;
+ xlog_copy_iovec(&vecp, XLOG_REG_TYPE_IFORMAT,
+ &iip->ili_format,
+ sizeof(struct xfs_inode_log_format));
+ nvecs = 1;
- vecp->i_addr = &ip->i_d;
- vecp->i_len = xfs_icdinode_size(ip->i_d.di_version);
- vecp->i_type = XLOG_REG_TYPE_ICORE;
- vecp++;
+ xlog_copy_iovec(&vecp, XLOG_REG_TYPE_ICORE,
+ &ip->i_d,
+ xfs_icdinode_size(ip->i_d.di_version));
nvecs++;
if (ip->i_d.di_version == 1)
xfs_inode_item_format_v1_inode(ip);
- vecp = xfs_inode_item_format_data_fork(iip, vecp, &nvecs);
+ xfs_inode_item_format_data_fork(iip, &vecp, &nvecs);
if (XFS_IFORK_Q(ip)) {
- vecp = xfs_inode_item_format_attr_fork(iip, vecp, &nvecs);
+ xfs_inode_item_format_attr_fork(iip, &vecp, &nvecs);
} else {
iip->ili_fields &=
~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT);