* cleanup log item formatting
@ 2025-06-10 5:14 Christoph Hellwig
2025-06-10 5:14 ` [PATCH 01/17] xfs: don't pass the old lv to xfs_cil_prepare_item Christoph Hellwig
` (19 more replies)
0 siblings, 20 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:14 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Hi all,
I dug into a rabit hole about the log item formatting recently,
and noticed that the handling of the opheaders is still pretty
ugly because it leaks pre-delayed logging implementation
details into the log item implementations.
The core of this series is to remove the to reserve space in the
CIL buffers/shadow buffers for the opheaders that already were
generated more or less on the fly by the lowlevel log write
code anyway, but there's lots of other cleanups around it.
Diffstat:
libxfs/xfs_log_format.h | 54 -----
libxfs/xfs_log_recover.h | 6
xfs_attr_item.c | 156 +++++++-------
xfs_attr_item.h | 8
xfs_bmap_item.c | 28 +-
xfs_buf_item.c | 27 +-
xfs_buf_item.h | 2
xfs_buf_item_recover.c | 38 +--
xfs_dquot_item.c | 9
xfs_dquot_item_recover.c | 20 -
xfs_exchmaps_item.c | 19 -
xfs_extfree_item.c | 69 +++---
xfs_icreate_item.c | 8
xfs_inode_item.c | 55 ++---
xfs_inode_item.h | 4
xfs_inode_item_recover.c | 26 +-
xfs_log.c | 503 ++++++++++++++++++-----------------------------
xfs_log.h | 106 ++++-----
xfs_log_cil.c | 195 ++++++++++--------
xfs_log_priv.h | 29 ++
xfs_log_recover.c | 16 -
xfs_refcount_item.c | 44 +---
xfs_rmap_item.c | 44 +---
xfs_trans.h | 5
24 files changed, 668 insertions(+), 803 deletions(-)
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 01/17] xfs: don't pass the old lv to xfs_cil_prepare_item
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
@ 2025-06-10 5:14 ` Christoph Hellwig
2025-06-10 7:20 ` Carlos Maiolino
2025-06-10 5:14 ` [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items Christoph Hellwig
` (18 subsequent siblings)
19 siblings, 1 reply; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:14 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
By the time xfs_cil_prepare_item is called, the old lv is still pointed
to by the log item. Take it from there instead of spreading the old lv
logic over xlog_cil_insert_format_items and xfs_cil_prepare_item.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log_cil.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index f66d2d430e4f..c3db01b2ea47 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -370,8 +370,8 @@ xlog_cil_alloc_shadow_bufs(
STATIC void
xfs_cil_prepare_item(
struct xlog *log,
+ struct xfs_log_item *lip,
struct xfs_log_vec *lv,
- struct xfs_log_vec *old_lv,
int *diff_len)
{
/* Account for the new LV being passed in */
@@ -381,19 +381,19 @@ xfs_cil_prepare_item(
/*
* If there is no old LV, this is the first time we've seen the item in
* this CIL context and so we need to pin it. If we are replacing the
- * old_lv, then remove the space it accounts for and make it the shadow
+ * old lv, then remove the space it accounts for and make it the shadow
* buffer for later freeing. In both cases we are now switching to the
* shadow buffer, so update the pointer to it appropriately.
*/
- if (!old_lv) {
+ if (!lip->li_lv) {
if (lv->lv_item->li_ops->iop_pin)
lv->lv_item->li_ops->iop_pin(lv->lv_item);
lv->lv_item->li_lv_shadow = NULL;
- } else if (old_lv != lv) {
+ } else if (lip->li_lv != lv) {
ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);
- *diff_len -= old_lv->lv_bytes;
- lv->lv_item->li_lv_shadow = old_lv;
+ *diff_len -= lip->li_lv->lv_bytes;
+ lv->lv_item->li_lv_shadow = lip->li_lv;
}
/* attach new log vector to log item */
@@ -453,7 +453,6 @@ xlog_cil_insert_format_items(
list_for_each_entry(lip, &tp->t_items, li_trans) {
struct xfs_log_vec *lv;
- struct xfs_log_vec *old_lv = NULL;
struct xfs_log_vec *shadow;
bool ordered = false;
@@ -474,7 +473,6 @@ xlog_cil_insert_format_items(
continue;
/* compare to existing item size */
- old_lv = lip->li_lv;
if (lip->li_lv && shadow->lv_size <= lip->li_lv->lv_size) {
/* same or smaller, optimise common overwrite case */
lv = lip->li_lv;
@@ -510,7 +508,7 @@ xlog_cil_insert_format_items(
ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
lip->li_ops->iop_format(lip, lv);
insert:
- xfs_cil_prepare_item(log, lv, old_lv, diff_len);
+ xfs_cil_prepare_item(log, lip, lv, diff_len);
}
}
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
2025-06-10 5:14 ` [PATCH 01/17] xfs: don't pass the old lv to xfs_cil_prepare_item Christoph Hellwig
@ 2025-06-10 5:14 ` Christoph Hellwig
2025-06-10 7:56 ` Carlos Maiolino
2025-06-10 5:15 ` [PATCH 03/17] xfs: use better names for size members in xfs_log_vec Christoph Hellwig
` (17 subsequent siblings)
19 siblings, 1 reply; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:14 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Split out handling of ordered items into a single branch in
xlog_cil_insert_format_items so that the rest of the code becomes more
clear.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log_cil.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index c3db01b2ea47..81b6780e0afc 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -452,9 +452,8 @@ xlog_cil_insert_format_items(
}
list_for_each_entry(lip, &tp->t_items, li_trans) {
- struct xfs_log_vec *lv;
- struct xfs_log_vec *shadow;
- bool ordered = false;
+ struct xfs_log_vec *lv = lip->li_lv;
+ struct xfs_log_vec *shadow = lip->li_lv_shadow;
/* Skip items which aren't dirty in this transaction. */
if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
@@ -464,21 +463,23 @@ xlog_cil_insert_format_items(
* The formatting size information is already attached to
* the shadow lv on the log item.
*/
- shadow = lip->li_lv_shadow;
- if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED)
- ordered = true;
+ if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED) {
+ if (!lv) {
+ lv = shadow;
+ lv->lv_item = lip;
+ }
+ ASSERT(shadow->lv_size == lv->lv_size);
+ xfs_cil_prepare_item(log, lip, lv, diff_len);
+ continue;
+ }
/* Skip items that do not have any vectors for writing */
- if (!shadow->lv_niovecs && !ordered)
+ if (!shadow->lv_niovecs)
continue;
/* compare to existing item size */
- if (lip->li_lv && shadow->lv_size <= lip->li_lv->lv_size) {
+ if (lv && shadow->lv_size <= lv->lv_size) {
/* same or smaller, optimise common overwrite case */
- lv = lip->li_lv;
-
- if (ordered)
- goto insert;
/*
* set the item up as though it is a new insertion so
@@ -498,16 +499,10 @@ xlog_cil_insert_format_items(
/* switch to shadow buffer! */
lv = shadow;
lv->lv_item = lip;
- if (ordered) {
- /* track as an ordered logvec */
- ASSERT(lip->li_lv == NULL);
- goto insert;
- }
}
ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
lip->li_ops->iop_format(lip, lv);
-insert:
xfs_cil_prepare_item(log, lip, lv, diff_len);
}
}
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 03/17] xfs: use better names for size members in xfs_log_vec
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
2025-06-10 5:14 ` [PATCH 01/17] xfs: don't pass the old lv to xfs_cil_prepare_item Christoph Hellwig
2025-06-10 5:14 ` [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 9:07 ` Carlos Maiolino
2025-06-10 5:15 ` [PATCH 04/17] xfs: don't use a xfs_log_iovec for attr_item names and values Christoph Hellwig
` (16 subsequent siblings)
19 siblings, 1 reply; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
The lv_size member counts the size of the entire allocation, rename it
to lv_alloc_size to make that clear.
The lv_buf_size member tracks how much of lv_buf has been used up
to format the log item, rename it to lv_buf_used to make that more
clear.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 10 +++++-----
fs/xfs/xfs_log.h | 9 +++++----
fs/xfs/xfs_log_cil.c | 30 +++++++++++++++---------------
3 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 793468b4d30d..3179923a68d4 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -109,14 +109,14 @@ xlog_prepare_iovec(
vec = &lv->lv_iovecp[0];
}
- len = lv->lv_buf_len + sizeof(struct xlog_op_header);
+ len = lv->lv_buf_used + sizeof(struct xlog_op_header);
if (!IS_ALIGNED(len, sizeof(uint64_t))) {
- lv->lv_buf_len = round_up(len, sizeof(uint64_t)) -
+ lv->lv_buf_used = round_up(len, sizeof(uint64_t)) -
sizeof(struct xlog_op_header);
}
vec->i_type = type;
- vec->i_addr = lv->lv_buf + lv->lv_buf_len;
+ vec->i_addr = lv->lv_buf + lv->lv_buf_used;
oph = vec->i_addr;
oph->oh_clientid = XFS_TRANSACTION;
@@ -1931,9 +1931,9 @@ xlog_print_trans(
if (!lv)
continue;
xfs_warn(mp, " niovecs = %d", lv->lv_niovecs);
- xfs_warn(mp, " size = %d", lv->lv_size);
+ xfs_warn(mp, " alloc_size = %d", lv->lv_alloc_size);
xfs_warn(mp, " bytes = %d", lv->lv_bytes);
- xfs_warn(mp, " buf len = %d", lv->lv_buf_len);
+ xfs_warn(mp, " buf used= %d", lv->lv_buf_used);
/* dump each iovec for the log item */
vec = lv->lv_iovecp;
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index 13455854365f..f239fce4f260 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -16,8 +16,8 @@ struct xfs_log_vec {
struct xfs_log_item *lv_item; /* owner */
char *lv_buf; /* formatted buffer */
int lv_bytes; /* accounted space in buffer */
- int lv_buf_len; /* aligned size of buffer */
- int lv_size; /* size of allocated lv */
+ int lv_buf_used; /* buffer space used so far */
+ int lv_alloc_size; /* size of allocated lv */
};
#define XFS_LOG_VEC_ORDERED (-1)
@@ -64,12 +64,13 @@ xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec,
oph->oh_len = cpu_to_be32(len);
len += sizeof(struct xlog_op_header);
- lv->lv_buf_len += len;
+ lv->lv_buf_used += len;
lv->lv_bytes += len;
vec->i_len = len;
/* Catch buffer overruns */
- ASSERT((void *)lv->lv_buf + lv->lv_bytes <= (void *)lv + lv->lv_size);
+ ASSERT((void *)lv->lv_buf + lv->lv_bytes <=
+ (void *)lv + lv->lv_alloc_size);
}
/*
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 81b6780e0afc..985f27a5b4ba 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -275,7 +275,7 @@ xlog_cil_alloc_shadow_bufs(
struct xfs_log_vec *lv;
int niovecs = 0;
int nbytes = 0;
- int buf_size;
+ int alloc_size;
bool ordered = false;
/* Skip items which aren't dirty in this transaction. */
@@ -316,14 +316,14 @@ xlog_cil_alloc_shadow_bufs(
* that space to ensure we can align it appropriately and not
* overrun the buffer.
*/
- buf_size = nbytes + xlog_cil_iovec_space(niovecs);
+ alloc_size = nbytes + xlog_cil_iovec_space(niovecs);
/*
* if we have no shadow buffer, or it is too small, we need to
* reallocate it.
*/
if (!lip->li_lv_shadow ||
- buf_size > lip->li_lv_shadow->lv_size) {
+ alloc_size > lip->li_lv_shadow->lv_alloc_size) {
/*
* We free and allocate here as a realloc would copy
* unnecessary data. We don't use kvzalloc() for the
@@ -332,15 +332,15 @@ xlog_cil_alloc_shadow_bufs(
* storage.
*/
kvfree(lip->li_lv_shadow);
- lv = xlog_kvmalloc(buf_size);
+ lv = xlog_kvmalloc(alloc_size);
memset(lv, 0, xlog_cil_iovec_space(niovecs));
INIT_LIST_HEAD(&lv->lv_list);
lv->lv_item = lip;
- lv->lv_size = buf_size;
+ lv->lv_alloc_size = alloc_size;
if (ordered)
- lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
+ lv->lv_buf_used = XFS_LOG_VEC_ORDERED;
else
lv->lv_iovecp = (struct xfs_log_iovec *)&lv[1];
lip->li_lv_shadow = lv;
@@ -348,9 +348,9 @@ xlog_cil_alloc_shadow_bufs(
/* same or smaller, optimise common overwrite case */
lv = lip->li_lv_shadow;
if (ordered)
- lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
+ lv->lv_buf_used = XFS_LOG_VEC_ORDERED;
else
- lv->lv_buf_len = 0;
+ lv->lv_buf_used = 0;
lv->lv_bytes = 0;
}
@@ -375,7 +375,7 @@ xfs_cil_prepare_item(
int *diff_len)
{
/* Account for the new LV being passed in */
- if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
+ if (lv->lv_buf_used != XFS_LOG_VEC_ORDERED)
*diff_len += lv->lv_bytes;
/*
@@ -390,7 +390,7 @@ xfs_cil_prepare_item(
lv->lv_item->li_ops->iop_pin(lv->lv_item);
lv->lv_item->li_lv_shadow = NULL;
} else if (lip->li_lv != lv) {
- ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);
+ ASSERT(lv->lv_buf_used != XFS_LOG_VEC_ORDERED);
*diff_len -= lip->li_lv->lv_bytes;
lv->lv_item->li_lv_shadow = lip->li_lv;
@@ -463,12 +463,12 @@ xlog_cil_insert_format_items(
* The formatting size information is already attached to
* the shadow lv on the log item.
*/
- if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED) {
+ if (shadow->lv_buf_used == XFS_LOG_VEC_ORDERED) {
if (!lv) {
lv = shadow;
lv->lv_item = lip;
}
- ASSERT(shadow->lv_size == lv->lv_size);
+ ASSERT(shadow->lv_alloc_size == lv->lv_alloc_size);
xfs_cil_prepare_item(log, lip, lv, diff_len);
continue;
}
@@ -478,7 +478,7 @@ xlog_cil_insert_format_items(
continue;
/* compare to existing item size */
- if (lv && shadow->lv_size <= lv->lv_size) {
+ if (lv && shadow->lv_alloc_size <= lv->lv_alloc_size) {
/* same or smaller, optimise common overwrite case */
/*
@@ -491,7 +491,7 @@ xlog_cil_insert_format_items(
lv->lv_niovecs = shadow->lv_niovecs;
/* reset the lv buffer information for new formatting */
- lv->lv_buf_len = 0;
+ lv->lv_buf_used = 0;
lv->lv_bytes = 0;
lv->lv_buf = (char *)lv +
xlog_cil_iovec_space(lv->lv_niovecs);
@@ -1236,7 +1236,7 @@ xlog_cil_build_lv_chain(
lv->lv_order_id = item->li_order_id;
/* we don't write ordered log vectors */
- if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
+ if (lv->lv_buf_used != XFS_LOG_VEC_ORDERED)
*num_bytes += lv->lv_bytes;
*num_iovecs += lv->lv_niovecs;
list_add_tail(&lv->lv_list, &ctx->lv_chain);
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 04/17] xfs: don't use a xfs_log_iovec for attr_item names and values
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (2 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 03/17] xfs: use better names for size members in xfs_log_vec Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 9:17 ` Carlos Maiolino
2025-06-10 5:15 ` [PATCH 05/17] xfs: don't use a xfs_log_iovec for ri_buf in log recovery Christoph Hellwig
` (15 subsequent siblings)
19 siblings, 1 reply; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
These buffers are not directly logged, just use a kvec and remove the
xlog_copy_from_iovec helper only used here.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_attr_item.c | 111 +++++++++++++++++++++--------------------
fs/xfs/xfs_attr_item.h | 8 +--
fs/xfs/xfs_log.h | 7 ---
3 files changed, 60 insertions(+), 66 deletions(-)
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index f683b7a9323f..2b3dde2eec9c 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -91,41 +91,37 @@ xfs_attri_log_nameval_alloc(
name_len + new_name_len + value_len +
new_value_len);
- nv->name.i_addr = nv + 1;
- nv->name.i_len = name_len;
- nv->name.i_type = XLOG_REG_TYPE_ATTR_NAME;
- memcpy(nv->name.i_addr, name, name_len);
+ nv->name.iov_base = nv + 1;
+ nv->name.iov_len = name_len;
+ memcpy(nv->name.iov_base, name, name_len);
if (new_name_len) {
- nv->new_name.i_addr = nv->name.i_addr + name_len;
- nv->new_name.i_len = new_name_len;
- memcpy(nv->new_name.i_addr, new_name, new_name_len);
+ nv->new_name.iov_base = nv->name.iov_base + name_len;
+ nv->new_name.iov_len = new_name_len;
+ memcpy(nv->new_name.iov_base, new_name, new_name_len);
} else {
- nv->new_name.i_addr = NULL;
- nv->new_name.i_len = 0;
+ nv->new_name.iov_base = NULL;
+ nv->new_name.iov_len = 0;
}
- nv->new_name.i_type = XLOG_REG_TYPE_ATTR_NEWNAME;
if (value_len) {
- nv->value.i_addr = nv->name.i_addr + name_len + new_name_len;
- nv->value.i_len = value_len;
- memcpy(nv->value.i_addr, value, value_len);
+ nv->value.iov_base = nv->name.iov_base + name_len + new_name_len;
+ nv->value.iov_len = value_len;
+ memcpy(nv->value.iov_base, value, value_len);
} else {
- nv->value.i_addr = NULL;
- nv->value.i_len = 0;
+ nv->value.iov_base = NULL;
+ nv->value.iov_len = 0;
}
- nv->value.i_type = XLOG_REG_TYPE_ATTR_VALUE;
if (new_value_len) {
- nv->new_value.i_addr = nv->name.i_addr + name_len +
+ nv->new_value.iov_base = nv->name.iov_base + name_len +
new_name_len + value_len;
- nv->new_value.i_len = new_value_len;
- memcpy(nv->new_value.i_addr, new_value, new_value_len);
+ nv->new_value.iov_len = new_value_len;
+ memcpy(nv->new_value.iov_base, new_value, new_value_len);
} else {
- nv->new_value.i_addr = NULL;
- nv->new_value.i_len = 0;
+ nv->new_value.iov_base = NULL;
+ nv->new_value.iov_len = 0;
}
- nv->new_value.i_type = XLOG_REG_TYPE_ATTR_NEWVALUE;
refcount_set(&nv->refcount, 1);
return nv;
@@ -170,21 +166,21 @@ xfs_attri_item_size(
*nvecs += 2;
*nbytes += sizeof(struct xfs_attri_log_format) +
- xlog_calc_iovec_len(nv->name.i_len);
+ xlog_calc_iovec_len(nv->name.iov_len);
- if (nv->new_name.i_len) {
+ if (nv->new_name.iov_len) {
*nvecs += 1;
- *nbytes += xlog_calc_iovec_len(nv->new_name.i_len);
+ *nbytes += xlog_calc_iovec_len(nv->new_name.iov_len);
}
- if (nv->value.i_len) {
+ if (nv->value.iov_len) {
*nvecs += 1;
- *nbytes += xlog_calc_iovec_len(nv->value.i_len);
+ *nbytes += xlog_calc_iovec_len(nv->value.iov_len);
}
- if (nv->new_value.i_len) {
+ if (nv->new_value.iov_len) {
*nvecs += 1;
- *nbytes += xlog_calc_iovec_len(nv->new_value.i_len);
+ *nbytes += xlog_calc_iovec_len(nv->new_value.iov_len);
}
}
@@ -212,31 +208,36 @@ xfs_attri_item_format(
* the log recovery.
*/
- ASSERT(nv->name.i_len > 0);
+ ASSERT(nv->name.iov_len > 0);
attrip->attri_format.alfi_size++;
- if (nv->new_name.i_len > 0)
+ if (nv->new_name.iov_len > 0)
attrip->attri_format.alfi_size++;
- if (nv->value.i_len > 0)
+ if (nv->value.iov_len > 0)
attrip->attri_format.alfi_size++;
- if (nv->new_value.i_len > 0)
+ if (nv->new_value.iov_len > 0)
attrip->attri_format.alfi_size++;
xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRI_FORMAT,
&attrip->attri_format,
sizeof(struct xfs_attri_log_format));
- xlog_copy_from_iovec(lv, &vecp, &nv->name);
- if (nv->new_name.i_len > 0)
- xlog_copy_from_iovec(lv, &vecp, &nv->new_name);
+ xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NAME, nv->name.iov_base,
+ nv->name.iov_len);
- if (nv->value.i_len > 0)
- xlog_copy_from_iovec(lv, &vecp, &nv->value);
+ if (nv->new_name.iov_len > 0)
+ xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWNAME,
+ nv->new_name.iov_base, nv->new_name.iov_len);
- if (nv->new_value.i_len > 0)
- xlog_copy_from_iovec(lv, &vecp, &nv->new_value);
+ if (nv->value.iov_len > 0)
+ xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_VALUE,
+ nv->value.iov_base, nv->value.iov_len);
+
+ if (nv->new_value.iov_len > 0)
+ xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWVALUE,
+ nv->new_value.iov_base, nv->new_value.iov_len);
}
/*
@@ -383,22 +384,22 @@ xfs_attr_log_item(
attrp->alfi_ino = args->dp->i_ino;
ASSERT(!(attr->xattri_op_flags & ~XFS_ATTRI_OP_FLAGS_TYPE_MASK));
attrp->alfi_op_flags = attr->xattri_op_flags;
- attrp->alfi_value_len = nv->value.i_len;
+ attrp->alfi_value_len = nv->value.iov_len;
switch (xfs_attr_log_item_op(attrp)) {
case XFS_ATTRI_OP_FLAGS_PPTR_REPLACE:
- ASSERT(nv->value.i_len == nv->new_value.i_len);
+ ASSERT(nv->value.iov_len == nv->new_value.iov_len);
attrp->alfi_igen = VFS_I(args->dp)->i_generation;
- attrp->alfi_old_name_len = nv->name.i_len;
- attrp->alfi_new_name_len = nv->new_name.i_len;
+ attrp->alfi_old_name_len = nv->name.iov_len;
+ attrp->alfi_new_name_len = nv->new_name.iov_len;
break;
case XFS_ATTRI_OP_FLAGS_PPTR_REMOVE:
case XFS_ATTRI_OP_FLAGS_PPTR_SET:
attrp->alfi_igen = VFS_I(args->dp)->i_generation;
fallthrough;
default:
- attrp->alfi_name_len = nv->name.i_len;
+ attrp->alfi_name_len = nv->name.iov_len;
break;
}
@@ -690,14 +691,14 @@ xfs_attri_recover_work(
args->dp = ip;
args->geo = mp->m_attr_geo;
args->whichfork = XFS_ATTR_FORK;
- args->name = nv->name.i_addr;
- args->namelen = nv->name.i_len;
- args->new_name = nv->new_name.i_addr;
- args->new_namelen = nv->new_name.i_len;
- args->value = nv->value.i_addr;
- args->valuelen = nv->value.i_len;
- args->new_value = nv->new_value.i_addr;
- args->new_valuelen = nv->new_value.i_len;
+ args->name = nv->name.iov_base;
+ args->namelen = nv->name.iov_len;
+ args->new_name = nv->new_name.iov_base;
+ args->new_namelen = nv->new_name.iov_len;
+ args->value = nv->value.iov_base;
+ args->valuelen = nv->value.iov_len;
+ args->new_value = nv->new_value.iov_base;
+ args->new_valuelen = nv->new_value.iov_len;
args->attr_filter = attrp->alfi_attr_filter & XFS_ATTRI_FILTER_MASK;
args->op_flags = XFS_DA_OP_RECOVERY | XFS_DA_OP_OKNOENT |
XFS_DA_OP_LOGGED;
@@ -754,8 +755,8 @@ xfs_attr_recover_work(
*/
attrp = &attrip->attri_format;
if (!xfs_attri_validate(mp, attrp) ||
- !xfs_attr_namecheck(attrp->alfi_attr_filter, nv->name.i_addr,
- nv->name.i_len))
+ !xfs_attr_namecheck(attrp->alfi_attr_filter, nv->name.iov_base,
+ nv->name.iov_len))
return -EFSCORRUPTED;
attr = xfs_attri_recover_work(mp, dfp, attrp, &ip, nv);
diff --git a/fs/xfs/xfs_attr_item.h b/fs/xfs/xfs_attr_item.h
index e74128cbb722..d108a11b55ae 100644
--- a/fs/xfs/xfs_attr_item.h
+++ b/fs/xfs/xfs_attr_item.h
@@ -12,10 +12,10 @@ struct xfs_mount;
struct kmem_zone;
struct xfs_attri_log_nameval {
- struct xfs_log_iovec name;
- struct xfs_log_iovec new_name; /* PPTR_REPLACE only */
- struct xfs_log_iovec value;
- struct xfs_log_iovec new_value; /* PPTR_REPLACE only */
+ struct kvec name;
+ struct kvec new_name; /* PPTR_REPLACE only */
+ struct kvec value;
+ struct kvec new_value; /* PPTR_REPLACE only */
refcount_t refcount;
/* name and value follow the end of this struct */
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index f239fce4f260..af6daf4f6792 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -88,13 +88,6 @@ xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
return buf;
}
-static inline void *
-xlog_copy_from_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
- const struct xfs_log_iovec *src)
-{
- return xlog_copy_iovec(lv, vecp, src->i_type, src->i_addr, src->i_len);
-}
-
/*
* By comparing each component, we don't have to worry about extra
* endian issues in treating two 32 bit numbers as one 64 bit number
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 05/17] xfs: don't use a xfs_log_iovec for ri_buf in log recovery
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (3 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 04/17] xfs: don't use a xfs_log_iovec for attr_item names and values Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-11 10:33 ` Carlos Maiolino
2025-06-10 5:15 ` [PATCH 06/17] xfs: improve the ->iop_format interface Christoph Hellwig
` (14 subsequent siblings)
19 siblings, 1 reply; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
ri_buf just holds a pointer/len pair and is not a log iovec used for
writing to the log. Switch to use a kvec instead.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_log_recover.h | 4 +--
fs/xfs/xfs_attr_item.c | 32 +++++++++---------
fs/xfs/xfs_bmap_item.c | 18 +++++-----
fs/xfs/xfs_buf_item.c | 8 ++---
fs/xfs/xfs_buf_item.h | 2 +-
fs/xfs/xfs_buf_item_recover.c | 38 ++++++++++-----------
fs/xfs/xfs_dquot_item_recover.c | 20 +++++------
fs/xfs/xfs_exchmaps_item.c | 8 ++---
fs/xfs/xfs_extfree_item.c | 59 +++++++++++++++++----------------
fs/xfs/xfs_icreate_item.c | 2 +-
fs/xfs/xfs_inode_item.c | 6 ++--
fs/xfs/xfs_inode_item.h | 4 +--
fs/xfs/xfs_inode_item_recover.c | 26 +++++++--------
fs/xfs/xfs_log_recover.c | 16 ++++-----
fs/xfs/xfs_refcount_item.c | 34 +++++++++----------
fs/xfs/xfs_rmap_item.c | 34 +++++++++----------
fs/xfs/xfs_trans.h | 1 -
17 files changed, 157 insertions(+), 155 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h
index 66c7916fb5cd..95de23095030 100644
--- a/fs/xfs/libxfs/xfs_log_recover.h
+++ b/fs/xfs/libxfs/xfs_log_recover.h
@@ -104,7 +104,7 @@ struct xlog_recover_item {
struct list_head ri_list;
int ri_cnt; /* count of regions found */
int ri_total; /* total regions */
- struct xfs_log_iovec *ri_buf; /* ptr to regions buffer */
+ struct kvec *ri_buf; /* ptr to regions buffer */
const struct xlog_recover_item_ops *ri_ops;
};
@@ -117,7 +117,7 @@ struct xlog_recover {
struct list_head r_itemq; /* q for items */
};
-#define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr)
+#define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].iov_base)
#define XLOG_RECOVER_CRCPASS 0
#define XLOG_RECOVER_PASS1 1
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index 2b3dde2eec9c..bc970aa6832f 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -954,50 +954,50 @@ static inline void *
xfs_attri_validate_name_iovec(
struct xfs_mount *mp,
struct xfs_attri_log_format *attri_formatp,
- const struct xfs_log_iovec *iovec,
+ const struct kvec *iovec,
unsigned int name_len)
{
- if (iovec->i_len != xlog_calc_iovec_len(name_len)) {
+ if (iovec->iov_len != xlog_calc_iovec_len(name_len)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
attri_formatp, sizeof(*attri_formatp));
return NULL;
}
- if (!xfs_attr_namecheck(attri_formatp->alfi_attr_filter, iovec->i_addr,
+ if (!xfs_attr_namecheck(attri_formatp->alfi_attr_filter, iovec->iov_base,
name_len)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
attri_formatp, sizeof(*attri_formatp));
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- iovec->i_addr, iovec->i_len);
+ iovec->iov_base, iovec->iov_len);
return NULL;
}
- return iovec->i_addr;
+ return iovec->iov_base;
}
static inline void *
xfs_attri_validate_value_iovec(
struct xfs_mount *mp,
struct xfs_attri_log_format *attri_formatp,
- const struct xfs_log_iovec *iovec,
+ const struct kvec *iovec,
unsigned int value_len)
{
- if (iovec->i_len != xlog_calc_iovec_len(value_len)) {
+ if (iovec->iov_len != xlog_calc_iovec_len(value_len)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
attri_formatp, sizeof(*attri_formatp));
return NULL;
}
if ((attri_formatp->alfi_attr_filter & XFS_ATTR_PARENT) &&
- !xfs_parent_valuecheck(mp, iovec->i_addr, value_len)) {
+ !xfs_parent_valuecheck(mp, iovec->iov_base, value_len)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
attri_formatp, sizeof(*attri_formatp));
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- iovec->i_addr, iovec->i_len);
+ iovec->iov_base, iovec->iov_len);
return NULL;
}
- return iovec->i_addr;
+ return iovec->iov_base;
}
STATIC int
@@ -1024,13 +1024,13 @@ xlog_recover_attri_commit_pass2(
/* Validate xfs_attri_log_format before the large memory allocation */
len = sizeof(struct xfs_attri_log_format);
- if (item->ri_buf[i].i_len != len) {
+ if (item->ri_buf[i].iov_len != len) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
- attri_formatp = item->ri_buf[i].i_addr;
+ attri_formatp = item->ri_buf[i].iov_base;
if (!xfs_attri_validate(mp, attri_formatp)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
attri_formatp, len);
@@ -1219,10 +1219,10 @@ xlog_recover_attrd_commit_pass2(
{
struct xfs_attrd_log_format *attrd_formatp;
- attrd_formatp = item->ri_buf[0].i_addr;
- if (item->ri_buf[0].i_len != sizeof(struct xfs_attrd_log_format)) {
+ attrd_formatp = item->ri_buf[0].iov_base;
+ if (item->ri_buf[0].iov_len != sizeof(struct xfs_attrd_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index 646c515ee355..80f0c4bcc483 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -654,24 +654,24 @@ xlog_recover_bui_commit_pass2(
struct xfs_bui_log_format *bui_formatp;
size_t len;
- bui_formatp = item->ri_buf[0].i_addr;
+ bui_formatp = item->ri_buf[0].iov_base;
- if (item->ri_buf[0].i_len < xfs_bui_log_format_sizeof(0)) {
+ if (item->ri_buf[0].iov_len < xfs_bui_log_format_sizeof(0)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
if (bui_formatp->bui_nextents != XFS_BUI_MAX_FAST_EXTENTS) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
len = xfs_bui_log_format_sizeof(bui_formatp->bui_nextents);
- if (item->ri_buf[0].i_len != len) {
+ if (item->ri_buf[0].iov_len != len) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -705,10 +705,10 @@ xlog_recover_bud_commit_pass2(
{
struct xfs_bud_log_format *bud_formatp;
- bud_formatp = item->ri_buf[0].i_addr;
- if (item->ri_buf[0].i_len != sizeof(struct xfs_bud_log_format)) {
+ bud_formatp = item->ri_buf[0].iov_base;
+ if (item->ri_buf[0].iov_len != sizeof(struct xfs_bud_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 90139e0f3271..e0ce0975d399 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -35,16 +35,16 @@ static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip)
/* Is this log iovec plausibly large enough to contain the buffer log format? */
bool
xfs_buf_log_check_iovec(
- struct xfs_log_iovec *iovec)
+ struct kvec *iovec)
{
- struct xfs_buf_log_format *blfp = iovec->i_addr;
+ struct xfs_buf_log_format *blfp = iovec->iov_base;
char *bmp_end;
char *item_end;
- if (offsetof(struct xfs_buf_log_format, blf_data_map) > iovec->i_len)
+ if (offsetof(struct xfs_buf_log_format, blf_data_map) > iovec->iov_len)
return false;
- item_end = (char *)iovec->i_addr + iovec->i_len;
+ item_end = (char *)iovec->iov_base + iovec->iov_len;
bmp_end = (char *)&blfp->blf_data_map[blfp->blf_map_size];
return bmp_end <= item_end;
}
diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h
index e10e324cd245..26c7af1a211d 100644
--- a/fs/xfs/xfs_buf_item.h
+++ b/fs/xfs/xfs_buf_item.h
@@ -62,7 +62,7 @@ static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
}
#endif /* CONFIG_XFS_QUOTA */
void xfs_buf_iodone(struct xfs_buf *);
-bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
+bool xfs_buf_log_check_iovec(struct kvec *iovec);
unsigned int xfs_buf_inval_log_space(unsigned int map_count,
unsigned int blocksize);
diff --git a/fs/xfs/xfs_buf_item_recover.c b/fs/xfs/xfs_buf_item_recover.c
index d4c5cef5bc43..5d58e2ae4972 100644
--- a/fs/xfs/xfs_buf_item_recover.c
+++ b/fs/xfs/xfs_buf_item_recover.c
@@ -159,7 +159,7 @@ STATIC enum xlog_recover_reorder
xlog_recover_buf_reorder(
struct xlog_recover_item *item)
{
- struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
+ struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
if (buf_f->blf_flags & XFS_BLF_CANCEL)
return XLOG_REORDER_CANCEL_LIST;
@@ -173,7 +173,7 @@ xlog_recover_buf_ra_pass2(
struct xlog *log,
struct xlog_recover_item *item)
{
- struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
+ struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
xlog_buf_readahead(log, buf_f->blf_blkno, buf_f->blf_len, NULL);
}
@@ -187,11 +187,11 @@ xlog_recover_buf_commit_pass1(
struct xlog *log,
struct xlog_recover_item *item)
{
- struct xfs_buf_log_format *bf = item->ri_buf[0].i_addr;
+ struct xfs_buf_log_format *bf = item->ri_buf[0].iov_base;
if (!xfs_buf_log_check_iovec(&item->ri_buf[0])) {
- xfs_err(log->l_mp, "bad buffer log item size (%d)",
- item->ri_buf[0].i_len);
+ xfs_err(log->l_mp, "bad buffer log item size (%zd)",
+ item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -487,8 +487,8 @@ xlog_recover_do_reg_buffer(
nbits = xfs_contig_bits(buf_f->blf_data_map,
buf_f->blf_map_size, bit);
ASSERT(nbits > 0);
- ASSERT(item->ri_buf[i].i_addr != NULL);
- ASSERT(item->ri_buf[i].i_len % XFS_BLF_CHUNK == 0);
+ ASSERT(item->ri_buf[i].iov_base != NULL);
+ ASSERT(item->ri_buf[i].iov_len % XFS_BLF_CHUNK == 0);
ASSERT(BBTOB(bp->b_length) >=
((uint)bit << XFS_BLF_SHIFT) + (nbits << XFS_BLF_SHIFT));
@@ -500,8 +500,8 @@ xlog_recover_do_reg_buffer(
* the log. Hence we need to trim nbits back to the length of
* the current region being copied out of the log.
*/
- if (item->ri_buf[i].i_len < (nbits << XFS_BLF_SHIFT))
- nbits = item->ri_buf[i].i_len >> XFS_BLF_SHIFT;
+ if (item->ri_buf[i].iov_len < (nbits << XFS_BLF_SHIFT))
+ nbits = item->ri_buf[i].iov_len >> XFS_BLF_SHIFT;
/*
* Do a sanity check if this is a dquot buffer. Just checking
@@ -511,18 +511,18 @@ xlog_recover_do_reg_buffer(
fa = NULL;
if (buf_f->blf_flags &
(XFS_BLF_UDQUOT_BUF|XFS_BLF_PDQUOT_BUF|XFS_BLF_GDQUOT_BUF)) {
- if (item->ri_buf[i].i_addr == NULL) {
+ if (item->ri_buf[i].iov_base == NULL) {
xfs_alert(mp,
"XFS: NULL dquot in %s.", __func__);
goto next;
}
- if (item->ri_buf[i].i_len < size_disk_dquot) {
+ if (item->ri_buf[i].iov_len < size_disk_dquot) {
xfs_alert(mp,
- "XFS: dquot too small (%d) in %s.",
- item->ri_buf[i].i_len, __func__);
+ "XFS: dquot too small (%zd) in %s.",
+ item->ri_buf[i].iov_len, __func__);
goto next;
}
- fa = xfs_dquot_verify(mp, item->ri_buf[i].i_addr, -1);
+ fa = xfs_dquot_verify(mp, item->ri_buf[i].iov_base, -1);
if (fa) {
xfs_alert(mp,
"dquot corrupt at %pS trying to replay into block 0x%llx",
@@ -533,7 +533,7 @@ xlog_recover_do_reg_buffer(
memcpy(xfs_buf_offset(bp,
(uint)bit << XFS_BLF_SHIFT), /* dest */
- item->ri_buf[i].i_addr, /* source */
+ item->ri_buf[i].iov_base, /* source */
nbits<<XFS_BLF_SHIFT); /* length */
next:
i++;
@@ -669,8 +669,8 @@ xlog_recover_do_inode_buffer(
if (next_unlinked_offset < reg_buf_offset)
continue;
- ASSERT(item->ri_buf[item_index].i_addr != NULL);
- ASSERT((item->ri_buf[item_index].i_len % XFS_BLF_CHUNK) == 0);
+ ASSERT(item->ri_buf[item_index].iov_base != NULL);
+ ASSERT((item->ri_buf[item_index].iov_len % XFS_BLF_CHUNK) == 0);
ASSERT((reg_buf_offset + reg_buf_bytes) <= BBTOB(bp->b_length));
/*
@@ -678,7 +678,7 @@ xlog_recover_do_inode_buffer(
* current di_next_unlinked field. Extract its value
* and copy it to the buffer copy.
*/
- logged_nextp = item->ri_buf[item_index].i_addr +
+ logged_nextp = item->ri_buf[item_index].iov_base +
next_unlinked_offset - reg_buf_offset;
if (XFS_IS_CORRUPT(mp, *logged_nextp == 0)) {
xfs_alert(mp,
@@ -1002,7 +1002,7 @@ xlog_recover_buf_commit_pass2(
struct xlog_recover_item *item,
xfs_lsn_t current_lsn)
{
- struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
+ struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
struct xfs_mount *mp = log->l_mp;
struct xfs_buf *bp;
int error;
diff --git a/fs/xfs/xfs_dquot_item_recover.c b/fs/xfs/xfs_dquot_item_recover.c
index 2c2720ce6923..89bc9bcaf51e 100644
--- a/fs/xfs/xfs_dquot_item_recover.c
+++ b/fs/xfs/xfs_dquot_item_recover.c
@@ -34,10 +34,10 @@ xlog_recover_dquot_ra_pass2(
if (mp->m_qflags == 0)
return;
- recddq = item->ri_buf[1].i_addr;
+ recddq = item->ri_buf[1].iov_base;
if (recddq == NULL)
return;
- if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot))
+ if (item->ri_buf[1].iov_len < sizeof(struct xfs_disk_dquot))
return;
type = recddq->d_type & XFS_DQTYPE_REC_MASK;
@@ -45,7 +45,7 @@ xlog_recover_dquot_ra_pass2(
if (log->l_quotaoffs_flag & type)
return;
- dq_f = item->ri_buf[0].i_addr;
+ dq_f = item->ri_buf[0].iov_base;
ASSERT(dq_f);
ASSERT(dq_f->qlf_len == 1);
@@ -79,14 +79,14 @@ xlog_recover_dquot_commit_pass2(
if (mp->m_qflags == 0)
return 0;
- recddq = item->ri_buf[1].i_addr;
+ recddq = item->ri_buf[1].iov_base;
if (recddq == NULL) {
xfs_alert(log->l_mp, "NULL dquot in %s.", __func__);
return -EFSCORRUPTED;
}
- if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot)) {
- xfs_alert(log->l_mp, "dquot too small (%d) in %s.",
- item->ri_buf[1].i_len, __func__);
+ if (item->ri_buf[1].iov_len < sizeof(struct xfs_disk_dquot)) {
+ xfs_alert(log->l_mp, "dquot too small (%zd) in %s.",
+ item->ri_buf[1].iov_len, __func__);
return -EFSCORRUPTED;
}
@@ -108,7 +108,7 @@ xlog_recover_dquot_commit_pass2(
* The other possibility, of course, is that the quota subsystem was
* removed since the last mount - ENOSYS.
*/
- dq_f = item->ri_buf[0].i_addr;
+ dq_f = item->ri_buf[0].iov_base;
ASSERT(dq_f);
fa = xfs_dquot_verify(mp, recddq, dq_f->qlf_id);
if (fa) {
@@ -147,7 +147,7 @@ xlog_recover_dquot_commit_pass2(
}
}
- memcpy(ddq, recddq, item->ri_buf[1].i_len);
+ memcpy(ddq, recddq, item->ri_buf[1].iov_len);
if (xfs_has_crc(mp)) {
xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF);
@@ -192,7 +192,7 @@ xlog_recover_quotaoff_commit_pass1(
struct xlog *log,
struct xlog_recover_item *item)
{
- struct xfs_qoff_logformat *qoff_f = item->ri_buf[0].i_addr;
+ struct xfs_qoff_logformat *qoff_f = item->ri_buf[0].iov_base;
ASSERT(qoff_f);
/*
diff --git a/fs/xfs/xfs_exchmaps_item.c b/fs/xfs/xfs_exchmaps_item.c
index 264a121c5e16..229cbe0adf17 100644
--- a/fs/xfs/xfs_exchmaps_item.c
+++ b/fs/xfs/xfs_exchmaps_item.c
@@ -558,12 +558,12 @@ xlog_recover_xmi_commit_pass2(
size_t len;
len = sizeof(struct xfs_xmi_log_format);
- if (item->ri_buf[0].i_len != len) {
+ if (item->ri_buf[0].iov_len != len) {
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
return -EFSCORRUPTED;
}
- xmi_formatp = item->ri_buf[0].i_addr;
+ xmi_formatp = item->ri_buf[0].iov_base;
if (xmi_formatp->__pad != 0) {
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
return -EFSCORRUPTED;
@@ -598,8 +598,8 @@ xlog_recover_xmd_commit_pass2(
{
struct xfs_xmd_log_format *xmd_formatp;
- xmd_formatp = item->ri_buf[0].i_addr;
- if (item->ri_buf[0].i_len != sizeof(struct xfs_xmd_log_format)) {
+ xmd_formatp = item->ri_buf[0].iov_base;
+ if (item->ri_buf[0].iov_len != sizeof(struct xfs_xmd_log_format)) {
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
return -EFSCORRUPTED;
}
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index d574f5f639fa..47ee598a9827 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -182,15 +182,18 @@ xfs_efi_init(
* It will handle the conversion of formats if necessary.
*/
STATIC int
-xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
+xfs_efi_copy_format(
+ struct kvec *buf,
+ struct xfs_efi_log_format *dst_efi_fmt)
{
- xfs_efi_log_format_t *src_efi_fmt = buf->i_addr;
- uint i;
- uint len = xfs_efi_log_format_sizeof(src_efi_fmt->efi_nextents);
- uint len32 = xfs_efi_log_format32_sizeof(src_efi_fmt->efi_nextents);
- uint len64 = xfs_efi_log_format64_sizeof(src_efi_fmt->efi_nextents);
+ struct xfs_efi_log_format *src_efi_fmt = buf->iov_base;
+ uint len, len32, len64, i;
- if (buf->i_len == len) {
+ len = xfs_efi_log_format_sizeof(src_efi_fmt->efi_nextents);
+ len32 = xfs_efi_log_format32_sizeof(src_efi_fmt->efi_nextents);
+ len64 = xfs_efi_log_format64_sizeof(src_efi_fmt->efi_nextents);
+
+ if (buf->iov_len == len) {
memcpy(dst_efi_fmt, src_efi_fmt,
offsetof(struct xfs_efi_log_format, efi_extents));
for (i = 0; i < src_efi_fmt->efi_nextents; i++)
@@ -198,8 +201,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
&src_efi_fmt->efi_extents[i],
sizeof(struct xfs_extent));
return 0;
- } else if (buf->i_len == len32) {
- xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->i_addr;
+ } else if (buf->iov_len == len32) {
+ xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->iov_base;
dst_efi_fmt->efi_type = src_efi_fmt_32->efi_type;
dst_efi_fmt->efi_size = src_efi_fmt_32->efi_size;
@@ -212,8 +215,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
src_efi_fmt_32->efi_extents[i].ext_len;
}
return 0;
- } else if (buf->i_len == len64) {
- xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->i_addr;
+ } else if (buf->iov_len == len64) {
+ xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->iov_base;
dst_efi_fmt->efi_type = src_efi_fmt_64->efi_type;
dst_efi_fmt->efi_size = src_efi_fmt_64->efi_size;
@@ -227,8 +230,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
}
return 0;
}
- XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, NULL, buf->i_addr,
- buf->i_len);
+ XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, NULL, buf->iov_base,
+ buf->iov_len);
return -EFSCORRUPTED;
}
@@ -865,11 +868,11 @@ xlog_recover_efi_commit_pass2(
struct xfs_efi_log_format *efi_formatp;
int error;
- efi_formatp = item->ri_buf[0].i_addr;
+ efi_formatp = item->ri_buf[0].iov_base;
- if (item->ri_buf[0].i_len < xfs_efi_log_format_sizeof(0)) {
+ if (item->ri_buf[0].iov_len < xfs_efi_log_format_sizeof(0)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -904,11 +907,11 @@ xlog_recover_rtefi_commit_pass2(
struct xfs_efi_log_format *efi_formatp;
int error;
- efi_formatp = item->ri_buf[0].i_addr;
+ efi_formatp = item->ri_buf[0].iov_base;
- if (item->ri_buf[0].i_len < xfs_efi_log_format_sizeof(0)) {
+ if (item->ri_buf[0].iov_len < xfs_efi_log_format_sizeof(0)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -933,7 +936,7 @@ xlog_recover_rtefi_commit_pass2(
xfs_lsn_t lsn)
{
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
#endif
@@ -958,9 +961,9 @@ xlog_recover_efd_commit_pass2(
xfs_lsn_t lsn)
{
struct xfs_efd_log_format *efd_formatp;
- int buflen = item->ri_buf[0].i_len;
+ int buflen = item->ri_buf[0].iov_len;
- efd_formatp = item->ri_buf[0].i_addr;
+ efd_formatp = item->ri_buf[0].iov_base;
if (buflen < sizeof(struct xfs_efd_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
@@ -968,9 +971,9 @@ xlog_recover_efd_commit_pass2(
return -EFSCORRUPTED;
}
- if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof(
+ if (item->ri_buf[0].iov_len != xfs_efd_log_format32_sizeof(
efd_formatp->efd_nextents) &&
- item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof(
+ item->ri_buf[0].iov_len != xfs_efd_log_format64_sizeof(
efd_formatp->efd_nextents)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
efd_formatp, buflen);
@@ -995,9 +998,9 @@ xlog_recover_rtefd_commit_pass2(
xfs_lsn_t lsn)
{
struct xfs_efd_log_format *efd_formatp;
- int buflen = item->ri_buf[0].i_len;
+ int buflen = item->ri_buf[0].iov_len;
- efd_formatp = item->ri_buf[0].i_addr;
+ efd_formatp = item->ri_buf[0].iov_base;
if (buflen < sizeof(struct xfs_efd_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
@@ -1005,9 +1008,9 @@ xlog_recover_rtefd_commit_pass2(
return -EFSCORRUPTED;
}
- if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof(
+ if (item->ri_buf[0].iov_len != xfs_efd_log_format32_sizeof(
efd_formatp->efd_nextents) &&
- item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof(
+ item->ri_buf[0].iov_len != xfs_efd_log_format64_sizeof(
efd_formatp->efd_nextents)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
efd_formatp, buflen);
diff --git a/fs/xfs/xfs_icreate_item.c b/fs/xfs/xfs_icreate_item.c
index 4345db501714..f83ec2bd0583 100644
--- a/fs/xfs/xfs_icreate_item.c
+++ b/fs/xfs/xfs_icreate_item.c
@@ -158,7 +158,7 @@ xlog_recover_icreate_commit_pass2(
int nbufs;
int i;
- icl = (struct xfs_icreate_log *)item->ri_buf[0].i_addr;
+ icl = (struct xfs_icreate_log *)item->ri_buf[0].iov_base;
if (icl->icl_type != XFS_LI_ICREATE) {
xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad type");
return -EINVAL;
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index c6cb0b6b9e46..5d81d0d4af05 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -1179,12 +1179,12 @@ xfs_iflush_shutdown_abort(
*/
int
xfs_inode_item_format_convert(
- struct xfs_log_iovec *buf,
+ struct kvec *buf,
struct xfs_inode_log_format *in_f)
{
- struct xfs_inode_log_format_32 *in_f32 = buf->i_addr;
+ struct xfs_inode_log_format_32 *in_f32 = buf->iov_base;
- if (buf->i_len != sizeof(*in_f32)) {
+ if (buf->iov_len != sizeof(*in_f32)) {
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL);
return -EFSCORRUPTED;
}
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
index 377e06007804..ba92ce11a011 100644
--- a/fs/xfs/xfs_inode_item.h
+++ b/fs/xfs/xfs_inode_item.h
@@ -46,8 +46,8 @@ extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
extern void xfs_inode_item_destroy(struct xfs_inode *);
extern void xfs_iflush_abort(struct xfs_inode *);
extern void xfs_iflush_shutdown_abort(struct xfs_inode *);
-extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
- struct xfs_inode_log_format *);
+int xfs_inode_item_format_convert(struct kvec *buf,
+ struct xfs_inode_log_format *in_f);
extern struct kmem_cache *xfs_ili_cache;
diff --git a/fs/xfs/xfs_inode_item_recover.c b/fs/xfs/xfs_inode_item_recover.c
index 7205fd14f6b3..9d1999d41be1 100644
--- a/fs/xfs/xfs_inode_item_recover.c
+++ b/fs/xfs/xfs_inode_item_recover.c
@@ -30,13 +30,13 @@ xlog_recover_inode_ra_pass2(
struct xlog *log,
struct xlog_recover_item *item)
{
- if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) {
- struct xfs_inode_log_format *ilfp = item->ri_buf[0].i_addr;
+ if (item->ri_buf[0].iov_len == sizeof(struct xfs_inode_log_format)) {
+ struct xfs_inode_log_format *ilfp = item->ri_buf[0].iov_base;
xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
&xfs_inode_buf_ra_ops);
} else {
- struct xfs_inode_log_format_32 *ilfp = item->ri_buf[0].i_addr;
+ struct xfs_inode_log_format_32 *ilfp = item->ri_buf[0].iov_base;
xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
&xfs_inode_buf_ra_ops);
@@ -326,8 +326,8 @@ xlog_recover_inode_commit_pass2(
int need_free = 0;
xfs_failaddr_t fa;
- if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) {
- in_f = item->ri_buf[0].i_addr;
+ if (item->ri_buf[0].iov_len == sizeof(struct xfs_inode_log_format)) {
+ in_f = item->ri_buf[0].iov_base;
} else {
in_f = kmalloc(sizeof(struct xfs_inode_log_format),
GFP_KERNEL | __GFP_NOFAIL);
@@ -366,7 +366,7 @@ xlog_recover_inode_commit_pass2(
error = -EFSCORRUPTED;
goto out_release;
}
- ldip = item->ri_buf[1].i_addr;
+ ldip = item->ri_buf[1].iov_base;
if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) {
xfs_alert(mp,
"%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld",
@@ -472,12 +472,12 @@ xlog_recover_inode_commit_pass2(
goto out_release;
}
isize = xfs_log_dinode_size(mp);
- if (unlikely(item->ri_buf[1].i_len > isize)) {
+ if (unlikely(item->ri_buf[1].iov_len > isize)) {
XFS_CORRUPTION_ERROR("Bad log dinode size", XFS_ERRLEVEL_LOW,
mp, ldip, sizeof(*ldip));
xfs_alert(mp,
- "Bad inode 0x%llx log dinode size 0x%x",
- in_f->ilf_ino, item->ri_buf[1].i_len);
+ "Bad inode 0x%llx log dinode size 0x%zx",
+ in_f->ilf_ino, item->ri_buf[1].iov_len);
error = -EFSCORRUPTED;
goto out_release;
}
@@ -500,8 +500,8 @@ xlog_recover_inode_commit_pass2(
if (in_f->ilf_size == 2)
goto out_owner_change;
- len = item->ri_buf[2].i_len;
- src = item->ri_buf[2].i_addr;
+ len = item->ri_buf[2].iov_len;
+ src = item->ri_buf[2].iov_base;
ASSERT(in_f->ilf_size <= 4);
ASSERT((in_f->ilf_size == 3) || (fields & XFS_ILOG_AFORK));
ASSERT(!(fields & XFS_ILOG_DFORK) ||
@@ -538,8 +538,8 @@ xlog_recover_inode_commit_pass2(
} else {
attr_index = 2;
}
- len = item->ri_buf[attr_index].i_len;
- src = item->ri_buf[attr_index].i_addr;
+ len = item->ri_buf[attr_index].iov_len;
+ src = item->ri_buf[attr_index].iov_base;
ASSERT(len == xlog_calc_iovec_len(in_f->ilf_asize));
switch (in_f->ilf_fields & XFS_ILOG_AFORK) {
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 2f76531842f8..e6ed9e09c027 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2131,15 +2131,15 @@ xlog_recover_add_to_cont_trans(
item = list_entry(trans->r_itemq.prev, struct xlog_recover_item,
ri_list);
- old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
- old_len = item->ri_buf[item->ri_cnt-1].i_len;
+ old_ptr = item->ri_buf[item->ri_cnt-1].iov_base;
+ old_len = item->ri_buf[item->ri_cnt-1].iov_len;
ptr = kvrealloc(old_ptr, len + old_len, GFP_KERNEL);
if (!ptr)
return -ENOMEM;
memcpy(&ptr[old_len], dp, len);
- item->ri_buf[item->ri_cnt-1].i_len += len;
- item->ri_buf[item->ri_cnt-1].i_addr = ptr;
+ item->ri_buf[item->ri_cnt-1].iov_len += len;
+ item->ri_buf[item->ri_cnt-1].iov_base = ptr;
trace_xfs_log_recover_item_add_cont(log, trans, item, 0);
return 0;
}
@@ -2223,7 +2223,7 @@ xlog_recover_add_to_trans(
}
item->ri_total = in_f->ilf_size;
- item->ri_buf = kzalloc(item->ri_total * sizeof(xfs_log_iovec_t),
+ item->ri_buf = kcalloc(item->ri_total, sizeof(*item->ri_buf),
GFP_KERNEL | __GFP_NOFAIL);
}
@@ -2237,8 +2237,8 @@ xlog_recover_add_to_trans(
}
/* Description region is ri_buf[0] */
- item->ri_buf[item->ri_cnt].i_addr = ptr;
- item->ri_buf[item->ri_cnt].i_len = len;
+ item->ri_buf[item->ri_cnt].iov_base = ptr;
+ item->ri_buf[item->ri_cnt].iov_len = len;
item->ri_cnt++;
trace_xfs_log_recover_item_add(log, trans, item, 0);
return 0;
@@ -2262,7 +2262,7 @@ xlog_recover_free_trans(
/* Free the regions in the item. */
list_del(&item->ri_list);
for (i = 0; i < item->ri_cnt; i++)
- kvfree(item->ri_buf[i].i_addr);
+ kvfree(item->ri_buf[i].iov_base);
/* Free the item itself */
kfree(item->ri_buf);
kfree(item);
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index 076501123d89..3728234699a2 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -717,18 +717,18 @@ xlog_recover_cui_commit_pass2(
struct xfs_cui_log_format *cui_formatp;
size_t len;
- cui_formatp = item->ri_buf[0].i_addr;
+ cui_formatp = item->ri_buf[0].iov_base;
- if (item->ri_buf[0].i_len < xfs_cui_log_format_sizeof(0)) {
+ if (item->ri_buf[0].iov_len < xfs_cui_log_format_sizeof(0)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
len = xfs_cui_log_format_sizeof(cui_formatp->cui_nextents);
- if (item->ri_buf[0].i_len != len) {
+ if (item->ri_buf[0].iov_len != len) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -759,18 +759,18 @@ xlog_recover_rtcui_commit_pass2(
struct xfs_cui_log_format *cui_formatp;
size_t len;
- cui_formatp = item->ri_buf[0].i_addr;
+ cui_formatp = item->ri_buf[0].iov_base;
- if (item->ri_buf[0].i_len < xfs_cui_log_format_sizeof(0)) {
+ if (item->ri_buf[0].iov_len < xfs_cui_log_format_sizeof(0)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
len = xfs_cui_log_format_sizeof(cui_formatp->cui_nextents);
- if (item->ri_buf[0].i_len != len) {
+ if (item->ri_buf[0].iov_len != len) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -791,7 +791,7 @@ xlog_recover_rtcui_commit_pass2(
xfs_lsn_t lsn)
{
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
#endif
@@ -817,10 +817,10 @@ xlog_recover_cud_commit_pass2(
{
struct xfs_cud_log_format *cud_formatp;
- cud_formatp = item->ri_buf[0].i_addr;
- if (item->ri_buf[0].i_len != sizeof(struct xfs_cud_log_format)) {
+ cud_formatp = item->ri_buf[0].iov_base;
+ if (item->ri_buf[0].iov_len != sizeof(struct xfs_cud_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -843,10 +843,10 @@ xlog_recover_rtcud_commit_pass2(
{
struct xfs_cud_log_format *cud_formatp;
- cud_formatp = item->ri_buf[0].i_addr;
- if (item->ri_buf[0].i_len != sizeof(struct xfs_cud_log_format)) {
+ cud_formatp = item->ri_buf[0].iov_base;
+ if (item->ri_buf[0].iov_len != sizeof(struct xfs_cud_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
index c99700318ec2..15f0903f6fd4 100644
--- a/fs/xfs/xfs_rmap_item.c
+++ b/fs/xfs/xfs_rmap_item.c
@@ -746,18 +746,18 @@ xlog_recover_rui_commit_pass2(
struct xfs_rui_log_format *rui_formatp;
size_t len;
- rui_formatp = item->ri_buf[0].i_addr;
+ rui_formatp = item->ri_buf[0].iov_base;
- if (item->ri_buf[0].i_len < xfs_rui_log_format_sizeof(0)) {
+ if (item->ri_buf[0].iov_len < xfs_rui_log_format_sizeof(0)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
len = xfs_rui_log_format_sizeof(rui_formatp->rui_nextents);
- if (item->ri_buf[0].i_len != len) {
+ if (item->ri_buf[0].iov_len != len) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -788,18 +788,18 @@ xlog_recover_rtrui_commit_pass2(
struct xfs_rui_log_format *rui_formatp;
size_t len;
- rui_formatp = item->ri_buf[0].i_addr;
+ rui_formatp = item->ri_buf[0].iov_base;
- if (item->ri_buf[0].i_len < xfs_rui_log_format_sizeof(0)) {
+ if (item->ri_buf[0].iov_len < xfs_rui_log_format_sizeof(0)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
len = xfs_rui_log_format_sizeof(rui_formatp->rui_nextents);
- if (item->ri_buf[0].i_len != len) {
+ if (item->ri_buf[0].iov_len != len) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -820,7 +820,7 @@ xlog_recover_rtrui_commit_pass2(
xfs_lsn_t lsn)
{
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
+ item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
#endif
@@ -846,10 +846,10 @@ xlog_recover_rud_commit_pass2(
{
struct xfs_rud_log_format *rud_formatp;
- rud_formatp = item->ri_buf[0].i_addr;
- if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) {
+ rud_formatp = item->ri_buf[0].iov_base;
+ if (item->ri_buf[0].iov_len != sizeof(struct xfs_rud_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- rud_formatp, item->ri_buf[0].i_len);
+ rud_formatp, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
@@ -872,10 +872,10 @@ xlog_recover_rtrud_commit_pass2(
{
struct xfs_rud_log_format *rud_formatp;
- rud_formatp = item->ri_buf[0].i_addr;
- if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) {
+ rud_formatp = item->ri_buf[0].iov_base;
+ if (item->ri_buf[0].iov_len != sizeof(struct xfs_rud_log_format)) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
- rud_formatp, item->ri_buf[0].i_len);
+ rud_formatp, item->ri_buf[0].iov_len);
return -EFSCORRUPTED;
}
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 2b366851e9a4..fa1724b4690e 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -15,7 +15,6 @@ struct xfs_efd_log_item;
struct xfs_efi_log_item;
struct xfs_inode;
struct xfs_item_ops;
-struct xfs_log_iovec;
struct xfs_mount;
struct xfs_trans;
struct xfs_trans_res;
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 06/17] xfs: improve the ->iop_format interface
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (4 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 05/17] xfs: don't use a xfs_log_iovec for ri_buf in log recovery Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 07/17] xfs: add a xlog_write_one_vec helper Christoph Hellwig
` (13 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Export a higher level interface to format log items. The xlog_format_buf
structure is hidden inside xfs_log_cil.c and only accessed using two
helpers (and a wrapper build on top), hiding details of log iovecs from
the log items. This also allows simply using an index into lv_iovecp
instead of keeping a cursor vec.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_attr_item.c | 27 +++++-----
fs/xfs/xfs_bmap_item.c | 10 ++--
fs/xfs/xfs_buf_item.c | 19 +++----
fs/xfs/xfs_dquot_item.c | 9 ++--
fs/xfs/xfs_exchmaps_item.c | 11 ++--
fs/xfs/xfs_extfree_item.c | 10 ++--
fs/xfs/xfs_icreate_item.c | 6 +--
fs/xfs/xfs_inode_item.c | 49 +++++++++---------
fs/xfs/xfs_log.c | 56 ---------------------
fs/xfs/xfs_log.h | 53 ++++----------------
fs/xfs/xfs_log_cil.c | 100 ++++++++++++++++++++++++++++++++++++-
fs/xfs/xfs_refcount_item.c | 10 ++--
fs/xfs/xfs_rmap_item.c | 10 ++--
fs/xfs/xfs_trans.h | 4 +-
14 files changed, 180 insertions(+), 194 deletions(-)
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index bc970aa6832f..932c9dbb9ab6 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -192,10 +192,9 @@ xfs_attri_item_size(
STATIC void
xfs_attri_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
struct xfs_attri_log_nameval *nv = attrip->attri_nameval;
attrip->attri_format.alfi_type = XFS_LI_ATTRI;
@@ -220,24 +219,23 @@ xfs_attri_item_format(
if (nv->new_value.iov_len > 0)
attrip->attri_format.alfi_size++;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRI_FORMAT,
- &attrip->attri_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ATTRI_FORMAT, &attrip->attri_format,
sizeof(struct xfs_attri_log_format));
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NAME, nv->name.iov_base,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ATTR_NAME, nv->name.iov_base,
nv->name.iov_len);
if (nv->new_name.iov_len > 0)
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWNAME,
- nv->new_name.iov_base, nv->new_name.iov_len);
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ATTR_NEWNAME,
+ nv->new_name.iov_base, nv->new_name.iov_len);
if (nv->value.iov_len > 0)
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_VALUE,
- nv->value.iov_base, nv->value.iov_len);
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ATTR_VALUE,
+ nv->value.iov_base, nv->value.iov_len);
if (nv->new_value.iov_len > 0)
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWVALUE,
- nv->new_value.iov_base, nv->new_value.iov_len);
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ATTR_NEWVALUE,
+ nv->new_value.iov_base, nv->new_value.iov_len);
}
/*
@@ -322,16 +320,15 @@ xfs_attrd_item_size(
*/
STATIC void
xfs_attrd_item_format(
- struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xfs_log_item *lip,
+ struct xlog_format_buf *lfb)
{
struct xfs_attrd_log_item *attrdp = ATTRD_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
attrdp->attrd_format.alfd_type = XFS_LI_ATTRD;
attrdp->attrd_format.alfd_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRD_FORMAT,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ATTRD_FORMAT,
&attrdp->attrd_format,
sizeof(struct xfs_attrd_log_format));
}
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index 80f0c4bcc483..f38ed63fe86b 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -92,10 +92,9 @@ unsigned int xfs_bui_log_space(unsigned int nr)
STATIC void
xfs_bui_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_bui_log_item *buip = BUI_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
ASSERT(atomic_read(&buip->bui_next_extent) ==
buip->bui_format.bui_nextents);
@@ -103,7 +102,7 @@ xfs_bui_item_format(
buip->bui_format.bui_type = XFS_LI_BUI;
buip->bui_format.bui_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_BUI_FORMAT, &buip->bui_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_BUI_FORMAT, &buip->bui_format,
xfs_bui_log_format_sizeof(buip->bui_format.bui_nextents));
}
@@ -188,15 +187,14 @@ unsigned int xfs_bud_log_space(void)
STATIC void
xfs_bud_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_bud_log_item *budp = BUD_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
budp->bud_format.bud_type = XFS_LI_BUD;
budp->bud_format.bud_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_BUD_FORMAT, &budp->bud_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_BUD_FORMAT, &budp->bud_format,
sizeof(struct xfs_bud_log_format));
}
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index e0ce0975d399..f438329df4c9 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -208,24 +208,21 @@ xfs_buf_item_size(
static inline void
xfs_buf_item_copy_iovec(
- struct xfs_log_vec *lv,
- struct xfs_log_iovec **vecp,
+ struct xlog_format_buf *lfb,
struct xfs_buf *bp,
uint offset,
int first_bit,
uint nbits)
{
offset += first_bit * XFS_BLF_CHUNK;
- xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_BCHUNK,
- xfs_buf_offset(bp, offset),
+ xlog_format_copy(lfb, XLOG_REG_TYPE_BCHUNK, xfs_buf_offset(bp, offset),
nbits * XFS_BLF_CHUNK);
}
static void
xfs_buf_item_format_segment(
struct xfs_buf_log_item *bip,
- struct xfs_log_vec *lv,
- struct xfs_log_iovec **vecp,
+ struct xlog_format_buf *lfb,
uint offset,
struct xfs_buf_log_format *blfp)
{
@@ -253,7 +250,7 @@ xfs_buf_item_format_segment(
return;
}
- blfp = xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_BFORMAT, blfp, base_size);
+ blfp = xlog_format_copy(lfb, XLOG_REG_TYPE_BFORMAT, blfp, base_size);
blfp->blf_size = 1;
if (bip->bli_flags & XFS_BLI_STALE) {
@@ -276,8 +273,7 @@ xfs_buf_item_format_segment(
nbits = xfs_contig_bits(blfp->blf_data_map,
blfp->blf_map_size, first_bit);
ASSERT(nbits > 0);
- xfs_buf_item_copy_iovec(lv, vecp, bp, offset,
- first_bit, nbits);
+ xfs_buf_item_copy_iovec(lfb, bp, offset, first_bit, nbits);
blfp->blf_size++;
/*
@@ -302,11 +298,10 @@ xfs_buf_item_format_segment(
STATIC void
xfs_buf_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
- struct xfs_log_iovec *vecp = NULL;
uint offset = 0;
int i;
@@ -343,7 +338,7 @@ xfs_buf_item_format(
}
for (i = 0; i < bip->bli_format_count; i++) {
- xfs_buf_item_format_segment(bip, lv, &vecp, offset,
+ xfs_buf_item_format_segment(bip, lfb, offset,
&bip->bli_formats[i]);
offset += BBTOB(bp->b_maps[i].bm_len);
}
diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c
index 271b195ebb93..9c2fcfbdf7dc 100644
--- a/fs/xfs/xfs_dquot_item.c
+++ b/fs/xfs/xfs_dquot_item.c
@@ -44,25 +44,24 @@ xfs_qm_dquot_logitem_size(
STATIC void
xfs_qm_dquot_logitem_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_disk_dquot ddq;
struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
struct xfs_dq_logformat *qlf;
- qlf = xlog_prepare_iovec(lv, &vecp, XLOG_REG_TYPE_QFORMAT);
+ qlf = xlog_format_start(lfb, XLOG_REG_TYPE_QFORMAT);
qlf->qlf_type = XFS_LI_DQUOT;
qlf->qlf_size = 2;
qlf->qlf_id = qlip->qli_dquot->q_id;
qlf->qlf_blkno = qlip->qli_dquot->q_blkno;
qlf->qlf_len = 1;
qlf->qlf_boffset = qlip->qli_dquot->q_bufoffset;
- xlog_finish_iovec(lv, vecp, sizeof(struct xfs_dq_logformat));
+ xlog_format_commit(lfb, sizeof(struct xfs_dq_logformat));
xfs_dquot_to_disk(&ddq, qlip->qli_dquot);
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_DQUOT, &ddq,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_DQUOT, &ddq,
sizeof(struct xfs_disk_dquot));
}
diff --git a/fs/xfs/xfs_exchmaps_item.c b/fs/xfs/xfs_exchmaps_item.c
index 229cbe0adf17..10d6fbeff651 100644
--- a/fs/xfs/xfs_exchmaps_item.c
+++ b/fs/xfs/xfs_exchmaps_item.c
@@ -83,16 +83,14 @@ xfs_xmi_item_size(
STATIC void
xfs_xmi_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_xmi_log_item *xmi_lip = XMI_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
xmi_lip->xmi_format.xmi_type = XFS_LI_XMI;
xmi_lip->xmi_format.xmi_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_XMI_FORMAT,
- &xmi_lip->xmi_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_XMI_FORMAT, &xmi_lip->xmi_format,
sizeof(struct xfs_xmi_log_format));
}
@@ -166,15 +164,14 @@ xfs_xmd_item_size(
STATIC void
xfs_xmd_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_xmd_log_item *xmd_lip = XMD_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
xmd_lip->xmd_format.xmd_type = XFS_LI_XMD;
xmd_lip->xmd_format.xmd_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_XMD_FORMAT, &xmd_lip->xmd_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_XMD_FORMAT, &xmd_lip->xmd_format,
sizeof(struct xfs_xmd_log_format));
}
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 47ee598a9827..750557641604 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -98,10 +98,9 @@ unsigned int xfs_efi_log_space(unsigned int nr)
STATIC void
xfs_efi_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_efi_log_item *efip = EFI_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
ASSERT(atomic_read(&efip->efi_next_extent) ==
efip->efi_format.efi_nextents);
@@ -110,7 +109,7 @@ xfs_efi_item_format(
efip->efi_format.efi_type = lip->li_type;
efip->efi_format.efi_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_EFI_FORMAT, &efip->efi_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_EFI_FORMAT, &efip->efi_format,
xfs_efi_log_format_sizeof(efip->efi_format.efi_nextents));
}
@@ -277,10 +276,9 @@ unsigned int xfs_efd_log_space(unsigned int nr)
STATIC void
xfs_efd_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_efd_log_item *efdp = EFD_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
ASSERT(efdp->efd_next_extent == efdp->efd_format.efd_nextents);
ASSERT(lip->li_type == XFS_LI_EFD || lip->li_type == XFS_LI_EFD_RT);
@@ -288,7 +286,7 @@ xfs_efd_item_format(
efdp->efd_format.efd_type = lip->li_type;
efdp->efd_format.efd_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_EFD_FORMAT, &efdp->efd_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_EFD_FORMAT, &efdp->efd_format,
xfs_efd_log_format_sizeof(efdp->efd_format.efd_nextents));
}
diff --git a/fs/xfs/xfs_icreate_item.c b/fs/xfs/xfs_icreate_item.c
index f83ec2bd0583..004dd22393dc 100644
--- a/fs/xfs/xfs_icreate_item.c
+++ b/fs/xfs/xfs_icreate_item.c
@@ -49,13 +49,11 @@ xfs_icreate_item_size(
STATIC void
xfs_icreate_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_icreate_item *icp = ICR_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ICREATE,
- &icp->ic_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ICREATE, &icp->ic_format,
sizeof(struct xfs_icreate_log));
}
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 5d81d0d4af05..2a005a8d124b 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -346,8 +346,7 @@ STATIC void
xfs_inode_item_format_data_fork(
struct xfs_inode_log_item *iip,
struct xfs_inode_log_format *ilf,
- struct xfs_log_vec *lv,
- struct xfs_log_iovec **vecp)
+ struct xlog_format_buf *lfb)
{
struct xfs_inode *ip = iip->ili_inode;
size_t data_bytes;
@@ -364,9 +363,9 @@ xfs_inode_item_format_data_fork(
ASSERT(xfs_iext_count(&ip->i_df) > 0);
- p = xlog_prepare_iovec(lv, vecp, XLOG_REG_TYPE_IEXT);
+ p = xlog_format_start(lfb, XLOG_REG_TYPE_IEXT);
data_bytes = xfs_iextents_copy(ip, p, XFS_DATA_FORK);
- xlog_finish_iovec(lv, *vecp, data_bytes);
+ xlog_format_commit(lfb, data_bytes);
ASSERT(data_bytes <= ip->i_df.if_bytes);
@@ -384,7 +383,7 @@ xfs_inode_item_format_data_fork(
if ((iip->ili_fields & XFS_ILOG_DBROOT) &&
ip->i_df.if_broot_bytes > 0) {
ASSERT(ip->i_df.if_broot != NULL);
- xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_IBROOT,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_IBROOT,
ip->i_df.if_broot,
ip->i_df.if_broot_bytes);
ilf->ilf_dsize = ip->i_df.if_broot_bytes;
@@ -402,8 +401,9 @@ xfs_inode_item_format_data_fork(
ip->i_df.if_bytes > 0) {
ASSERT(ip->i_df.if_data != NULL);
ASSERT(ip->i_disk_size > 0);
- xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_ILOCAL,
- ip->i_df.if_data, ip->i_df.if_bytes);
+ xlog_format_copy(lfb, XLOG_REG_TYPE_ILOCAL,
+ ip->i_df.if_data,
+ ip->i_df.if_bytes);
ilf->ilf_dsize = (unsigned)ip->i_df.if_bytes;
ilf->ilf_size++;
} else {
@@ -426,8 +426,7 @@ STATIC void
xfs_inode_item_format_attr_fork(
struct xfs_inode_log_item *iip,
struct xfs_inode_log_format *ilf,
- struct xfs_log_vec *lv,
- struct xfs_log_iovec **vecp)
+ struct xlog_format_buf *lfb)
{
struct xfs_inode *ip = iip->ili_inode;
size_t data_bytes;
@@ -445,9 +444,9 @@ xfs_inode_item_format_attr_fork(
ASSERT(xfs_iext_count(&ip->i_af) ==
ip->i_af.if_nextents);
- p = xlog_prepare_iovec(lv, vecp, XLOG_REG_TYPE_IATTR_EXT);
+ p = xlog_format_start(lfb, XLOG_REG_TYPE_IATTR_EXT);
data_bytes = xfs_iextents_copy(ip, p, XFS_ATTR_FORK);
- xlog_finish_iovec(lv, *vecp, data_bytes);
+ xlog_format_commit(lfb, data_bytes);
ilf->ilf_asize = data_bytes;
ilf->ilf_size++;
@@ -463,7 +462,7 @@ xfs_inode_item_format_attr_fork(
ip->i_af.if_broot_bytes > 0) {
ASSERT(ip->i_af.if_broot != NULL);
- xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_IATTR_BROOT,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_IATTR_BROOT,
ip->i_af.if_broot,
ip->i_af.if_broot_bytes);
ilf->ilf_asize = ip->i_af.if_broot_bytes;
@@ -479,8 +478,9 @@ xfs_inode_item_format_attr_fork(
if ((iip->ili_fields & XFS_ILOG_ADATA) &&
ip->i_af.if_bytes > 0) {
ASSERT(ip->i_af.if_data != NULL);
- xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_IATTR_LOCAL,
- ip->i_af.if_data, ip->i_af.if_bytes);
+ xlog_format_copy(lfb, XLOG_REG_TYPE_IATTR_LOCAL,
+ ip->i_af.if_data,
+ ip->i_af.if_bytes);
ilf->ilf_asize = (unsigned)ip->i_af.if_bytes;
ilf->ilf_size++;
} else {
@@ -629,14 +629,13 @@ xfs_inode_to_log_dinode(
static void
xfs_inode_item_format_core(
struct xfs_inode *ip,
- struct xfs_log_vec *lv,
- struct xfs_log_iovec **vecp)
+ struct xlog_format_buf *lfb)
{
struct xfs_log_dinode *dic;
- dic = xlog_prepare_iovec(lv, vecp, XLOG_REG_TYPE_ICORE);
+ dic = xlog_format_start(lfb, XLOG_REG_TYPE_ICORE);
xfs_inode_to_log_dinode(ip, dic, ip->i_itemp->ili_item.li_lsn);
- xlog_finish_iovec(lv, *vecp, xfs_log_dinode_size(ip->i_mount));
+ xlog_format_commit(lfb, xfs_log_dinode_size(ip->i_mount));
}
/*
@@ -654,14 +653,13 @@ xfs_inode_item_format_core(
STATIC void
xfs_inode_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_inode_log_item *iip = INODE_ITEM(lip);
struct xfs_inode *ip = iip->ili_inode;
- struct xfs_log_iovec *vecp = NULL;
struct xfs_inode_log_format *ilf;
- ilf = xlog_prepare_iovec(lv, &vecp, XLOG_REG_TYPE_IFORMAT);
+ ilf = xlog_format_start(lfb, XLOG_REG_TYPE_IFORMAT);
ilf->ilf_type = XFS_LI_INODE;
ilf->ilf_ino = ip->i_ino;
ilf->ilf_blkno = ip->i_imap.im_blkno;
@@ -678,13 +676,12 @@ xfs_inode_item_format(
ilf->ilf_asize = 0;
ilf->ilf_pad = 0;
memset(&ilf->ilf_u, 0, sizeof(ilf->ilf_u));
+ xlog_format_commit(lfb, sizeof(*ilf));
- xlog_finish_iovec(lv, vecp, sizeof(*ilf));
-
- xfs_inode_item_format_core(ip, lv, &vecp);
- xfs_inode_item_format_data_fork(iip, ilf, lv, &vecp);
+ xfs_inode_item_format_core(ip, lfb);
+ xfs_inode_item_format_data_fork(iip, ilf, lfb);
if (xfs_inode_has_attr_fork(ip)) {
- xfs_inode_item_format_attr_fork(iip, ilf, lv, &vecp);
+ xfs_inode_item_format_attr_fork(iip, ilf, lfb);
} else {
iip->ili_fields &=
~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT);
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 3179923a68d4..5352efabf8f9 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -74,62 +74,6 @@ xlog_iclogs_empty(
static int
xfs_log_cover(struct xfs_mount *);
-/*
- * We need to make sure the buffer pointer returned is naturally aligned for the
- * biggest basic data type we put into it. We have already accounted for this
- * padding when sizing the buffer.
- *
- * However, this padding does not get written into the log, and hence we have to
- * track the space used by the log vectors separately to prevent log space hangs
- * due to inaccurate accounting (i.e. a leak) of the used log space through the
- * CIL context ticket.
- *
- * We also add space for the xlog_op_header that describes this region in the
- * log. This prepends the data region we return to the caller to copy their data
- * into, so do all the static initialisation of the ophdr now. Because the ophdr
- * is not 8 byte aligned, we have to be careful to ensure that we align the
- * start of the buffer such that the region we return to the call is 8 byte
- * aligned and packed against the tail of the ophdr.
- */
-void *
-xlog_prepare_iovec(
- struct xfs_log_vec *lv,
- struct xfs_log_iovec **vecp,
- uint type)
-{
- struct xfs_log_iovec *vec = *vecp;
- struct xlog_op_header *oph;
- uint32_t len;
- void *buf;
-
- if (vec) {
- ASSERT(vec - lv->lv_iovecp < lv->lv_niovecs);
- vec++;
- } else {
- vec = &lv->lv_iovecp[0];
- }
-
- len = lv->lv_buf_used + sizeof(struct xlog_op_header);
- if (!IS_ALIGNED(len, sizeof(uint64_t))) {
- lv->lv_buf_used = round_up(len, sizeof(uint64_t)) -
- sizeof(struct xlog_op_header);
- }
-
- vec->i_type = type;
- vec->i_addr = lv->lv_buf + lv->lv_buf_used;
-
- oph = vec->i_addr;
- oph->oh_clientid = XFS_TRANSACTION;
- oph->oh_res2 = 0;
- oph->oh_flags = 0;
-
- buf = vec->i_addr + sizeof(struct xlog_op_header);
- ASSERT(IS_ALIGNED((unsigned long)buf, sizeof(uint64_t)));
-
- *vecp = vec;
- return buf;
-}
-
static inline void
xlog_grant_sub_space(
struct xlog_grant_head *head,
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index af6daf4f6792..e03dbff3ef8e 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -6,6 +6,7 @@
#ifndef __XFS_LOG_H__
#define __XFS_LOG_H__
+struct xlog_format_buf;
struct xfs_cil_ctx;
struct xfs_log_vec {
@@ -33,58 +34,24 @@ xlog_calc_iovec_len(int len)
return roundup(len, sizeof(uint32_t));
}
-void *xlog_prepare_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
- uint type);
-
-static inline void
-xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec,
- int data_len)
-{
- struct xlog_op_header *oph = vec->i_addr;
- int len;
-
- /*
- * Always round up the length to the correct alignment so callers don't
- * need to know anything about this log vec layout requirement. This
- * means we have to zero the area the data to be written does not cover.
- * This is complicated by fact the payload region is offset into the
- * logvec region by the opheader that tracks the payload.
- */
- len = xlog_calc_iovec_len(data_len);
- if (len - data_len != 0) {
- char *buf = vec->i_addr + sizeof(struct xlog_op_header);
-
- memset(buf + data_len, 0, len - data_len);
- }
-
- /*
- * The opheader tracks aligned payload length, whilst the logvec tracks
- * the overall region length.
- */
- oph->oh_len = cpu_to_be32(len);
-
- len += sizeof(struct xlog_op_header);
- lv->lv_buf_used += len;
- lv->lv_bytes += len;
- vec->i_len = len;
-
- /* Catch buffer overruns */
- ASSERT((void *)lv->lv_buf + lv->lv_bytes <=
- (void *)lv + lv->lv_alloc_size);
-}
+void *xlog_format_start(struct xlog_format_buf *lfb, uint type);
+void xlog_format_commit(struct xlog_format_buf *lfb, unsigned int data_len);
/*
* Copy the amount of data requested by the caller into a new log iovec.
*/
static inline void *
-xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
- uint type, void *data, int len)
+xlog_format_copy(
+ struct xlog_format_buf *lfb,
+ uint type,
+ void *data,
+ unsigned int len)
{
void *buf;
- buf = xlog_prepare_iovec(lv, vecp, type);
+ buf = xlog_format_start(lfb, type);
memcpy(buf, data, len);
- xlog_finish_iovec(lv, *vecp, len);
+ xlog_format_commit(lfb, len);
return buf;
}
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 985f27a5b4ba..dd20ca57c1b9 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -409,6 +409,102 @@ xfs_cil_prepare_item(
lv->lv_item->li_seq = log->l_cilp->xc_ctx->sequence;
}
+struct xlog_format_buf {
+ struct xfs_log_vec *lv;
+ unsigned int idx;
+};
+
+/*
+ * We need to make sure the buffer pointer returned is naturally aligned for the
+ * biggest basic data type we put into it. We have already accounted for this
+ * padding when sizing the buffer.
+ *
+ * However, this padding does not get written into the log, and hence we have to
+ * track the space used by the log vectors separately to prevent log space hangs
+ * due to inaccurate accounting (i.e. a leak) of the used log space through the
+ * CIL context ticket.
+ *
+ * We also add space for the xlog_op_header that describes this region in the
+ * log. This prepends the data region we return to the caller to copy their data
+ * into, so do all the static initialisation of the ophdr now. Because the ophdr
+ * is not 8 byte aligned, we have to be careful to ensure that we align the
+ * start of the buffer such that the region we return to the call is 8 byte
+ * aligned and packed against the tail of the ophdr.
+ */
+void *
+xlog_format_start(
+ struct xlog_format_buf *lfb,
+ uint type)
+{
+ struct xfs_log_vec *lv = lfb->lv;
+ struct xfs_log_iovec *vec = &lv->lv_iovecp[lfb->idx];
+ struct xlog_op_header *oph;
+ uint32_t len;
+ void *buf;
+
+ ASSERT(lfb->idx < lv->lv_niovecs);
+
+ len = lv->lv_buf_used + sizeof(struct xlog_op_header);
+ if (!IS_ALIGNED(len, sizeof(uint64_t))) {
+ lv->lv_buf_used = round_up(len, sizeof(uint64_t)) -
+ sizeof(struct xlog_op_header);
+ }
+
+ vec->i_type = type;
+ vec->i_addr = lv->lv_buf + lv->lv_buf_used;
+
+ oph = vec->i_addr;
+ oph->oh_clientid = XFS_TRANSACTION;
+ oph->oh_res2 = 0;
+ oph->oh_flags = 0;
+
+ buf = vec->i_addr + sizeof(struct xlog_op_header);
+ ASSERT(IS_ALIGNED((unsigned long)buf, sizeof(uint64_t)));
+ return buf;
+}
+
+void
+xlog_format_commit(
+ struct xlog_format_buf *lfb,
+ unsigned int data_len)
+{
+ struct xfs_log_vec *lv = lfb->lv;
+ struct xfs_log_iovec *vec = &lv->lv_iovecp[lfb->idx];
+ struct xlog_op_header *oph = vec->i_addr;
+ int len;
+
+ /*
+ * Always round up the length to the correct alignment so callers don't
+ * need to know anything about this log vec layout requirement. This
+ * means we have to zero the area the data to be written does not cover.
+ * This is complicated by fact the payload region is offset into the
+ * logvec region by the opheader that tracks the payload.
+ */
+ len = xlog_calc_iovec_len(data_len);
+ if (len - data_len != 0) {
+ char *buf = vec->i_addr + sizeof(struct xlog_op_header);
+
+ memset(buf + data_len, 0, len - data_len);
+ }
+
+ /*
+ * The opheader tracks aligned payload length, whilst the logvec tracks
+ * the overall region length.
+ */
+ oph->oh_len = cpu_to_be32(len);
+
+ len += sizeof(struct xlog_op_header);
+ lv->lv_buf_used += len;
+ lv->lv_bytes += len;
+ vec->i_len = len;
+
+ /* Catch buffer overruns */
+ ASSERT((void *)lv->lv_buf + lv->lv_bytes <=
+ (void *)lv + lv->lv_alloc_size);
+
+ lfb->idx++;
+}
+
/*
* Format log item into a flat buffers
*
@@ -454,6 +550,7 @@ xlog_cil_insert_format_items(
list_for_each_entry(lip, &tp->t_items, li_trans) {
struct xfs_log_vec *lv = lip->li_lv;
struct xfs_log_vec *shadow = lip->li_lv_shadow;
+ struct xlog_format_buf lfb = { };
/* Skip items which aren't dirty in this transaction. */
if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
@@ -501,8 +598,9 @@ xlog_cil_insert_format_items(
lv->lv_item = lip;
}
+ lfb.lv = lv;
ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
- lip->li_ops->iop_format(lip, lv);
+ lip->li_ops->iop_format(lip, &lfb);
xfs_cil_prepare_item(log, lip, lv, diff_len);
}
}
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index 3728234699a2..a41f5b577e22 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -93,10 +93,9 @@ unsigned int xfs_cui_log_space(unsigned int nr)
STATIC void
xfs_cui_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_cui_log_item *cuip = CUI_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
ASSERT(atomic_read(&cuip->cui_next_extent) ==
cuip->cui_format.cui_nextents);
@@ -105,7 +104,7 @@ xfs_cui_item_format(
cuip->cui_format.cui_type = lip->li_type;
cuip->cui_format.cui_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_CUI_FORMAT, &cuip->cui_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_CUI_FORMAT, &cuip->cui_format,
xfs_cui_log_format_sizeof(cuip->cui_format.cui_nextents));
}
@@ -199,17 +198,16 @@ unsigned int xfs_cud_log_space(void)
STATIC void
xfs_cud_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_cud_log_item *cudp = CUD_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
ASSERT(lip->li_type == XFS_LI_CUD || lip->li_type == XFS_LI_CUD_RT);
cudp->cud_format.cud_type = lip->li_type;
cudp->cud_format.cud_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_CUD_FORMAT, &cudp->cud_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_CUD_FORMAT, &cudp->cud_format,
sizeof(struct xfs_cud_log_format));
}
diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
index 15f0903f6fd4..8bf04b101156 100644
--- a/fs/xfs/xfs_rmap_item.c
+++ b/fs/xfs/xfs_rmap_item.c
@@ -92,10 +92,9 @@ unsigned int xfs_rui_log_space(unsigned int nr)
STATIC void
xfs_rui_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_rui_log_item *ruip = RUI_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
ASSERT(atomic_read(&ruip->rui_next_extent) ==
ruip->rui_format.rui_nextents);
@@ -105,7 +104,7 @@ xfs_rui_item_format(
ruip->rui_format.rui_type = lip->li_type;
ruip->rui_format.rui_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_RUI_FORMAT, &ruip->rui_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_RUI_FORMAT, &ruip->rui_format,
xfs_rui_log_format_sizeof(ruip->rui_format.rui_nextents));
}
@@ -200,17 +199,16 @@ unsigned int xfs_rud_log_space(void)
STATIC void
xfs_rud_item_format(
struct xfs_log_item *lip,
- struct xfs_log_vec *lv)
+ struct xlog_format_buf *lfb)
{
struct xfs_rud_log_item *rudp = RUD_ITEM(lip);
- struct xfs_log_iovec *vecp = NULL;
ASSERT(lip->li_type == XFS_LI_RUD || lip->li_type == XFS_LI_RUD_RT);
rudp->rud_format.rud_type = lip->li_type;
rudp->rud_format.rud_size = 1;
- xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_RUD_FORMAT, &rudp->rud_format,
+ xlog_format_copy(lfb, XLOG_REG_TYPE_RUD_FORMAT, &rudp->rud_format,
sizeof(struct xfs_rud_log_format));
}
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index fa1724b4690e..20ed112850d3 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -9,6 +9,7 @@
/* kernel only transaction subsystem defines */
struct xlog;
+struct xlog_format_buf;
struct xfs_buf;
struct xfs_buftarg;
struct xfs_efd_log_item;
@@ -70,7 +71,8 @@ struct xfs_log_item {
struct xfs_item_ops {
unsigned flags;
void (*iop_size)(struct xfs_log_item *, int *, int *);
- void (*iop_format)(struct xfs_log_item *, struct xfs_log_vec *);
+ void (*iop_format)(struct xfs_log_item *lip,
+ struct xlog_format_buf *lfb);
void (*iop_pin)(struct xfs_log_item *);
void (*iop_unpin)(struct xfs_log_item *, int remove);
uint64_t (*iop_sort)(struct xfs_log_item *lip);
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 07/17] xfs: add a xlog_write_one_vec helper
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (5 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 06/17] xfs: improve the ->iop_format interface Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 08/17] xfs: set lv_bytes in xlog_write_one_vec Christoph Hellwig
` (12 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Add a wrapper for xlog_write for the two callers who need to build a
log_vec and add it to a single-entry chain instead of duplicating the
code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 35 +++++++++++++++++++++--------------
fs/xfs/xfs_log_cil.c | 11 +----------
fs/xfs/xfs_log_priv.h | 2 ++
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 5352efabf8f9..fa1bd1fc79ba 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -792,6 +792,26 @@ xlog_wait_on_iclog(
return 0;
}
+int
+xlog_write_one_vec(
+ struct xlog *log,
+ struct xfs_cil_ctx *ctx,
+ struct xfs_log_iovec *reg,
+ struct xlog_ticket *ticket)
+{
+ struct xfs_log_vec lv = {
+ .lv_niovecs = 1,
+ .lv_iovecp = reg,
+ };
+ LIST_HEAD (lv_chain);
+
+ /* account for space used by record data */
+ ticket->t_curr_res -= reg->i_len;
+
+ list_add(&lv.lv_list, &lv_chain);
+ return xlog_write(log, ctx, &lv_chain, ticket, reg->i_len);
+}
+
/*
* Write out an unmount record using the ticket provided. We have to account for
* the data space used in the unmount ticket as this write is not done from a
@@ -820,21 +840,8 @@ xlog_write_unmount_record(
.i_len = sizeof(unmount_rec),
.i_type = XLOG_REG_TYPE_UNMOUNT,
};
- struct xfs_log_vec vec = {
- .lv_niovecs = 1,
- .lv_iovecp = ®,
- };
- LIST_HEAD(lv_chain);
- list_add(&vec.lv_list, &lv_chain);
-
- BUILD_BUG_ON((sizeof(struct xlog_op_header) +
- sizeof(struct xfs_unmount_log_format)) !=
- sizeof(unmount_rec));
-
- /* account for space used by record data */
- ticket->t_curr_res -= sizeof(unmount_rec);
- return xlog_write(log, NULL, &lv_chain, ticket, reg.i_len);
+ return xlog_write_one_vec(log, NULL, ®, ticket);
}
/*
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index dd20ca57c1b9..5a0f80cdfa5a 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -1194,13 +1194,7 @@ xlog_cil_write_commit_record(
.i_len = sizeof(struct xlog_op_header),
.i_type = XLOG_REG_TYPE_COMMIT,
};
- struct xfs_log_vec vec = {
- .lv_niovecs = 1,
- .lv_iovecp = ®,
- };
int error;
- LIST_HEAD(lv_chain);
- list_add(&vec.lv_list, &lv_chain);
if (xlog_is_shutdown(log))
return -EIO;
@@ -1208,10 +1202,7 @@ xlog_cil_write_commit_record(
error = xlog_cil_order_write(ctx->cil, ctx->sequence, _COMMIT_RECORD);
if (error)
return error;
-
- /* account for space used by record data */
- ctx->ticket->t_curr_res -= reg.i_len;
- error = xlog_write(log, ctx, &lv_chain, ctx->ticket, reg.i_len);
+ error = xlog_write_one_vec(log, ctx, ®, ctx->ticket);
if (error)
xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);
return error;
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 39a102cc1b43..463daf51da15 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -511,6 +511,8 @@ void xlog_print_trans(struct xfs_trans *);
int xlog_write(struct xlog *log, struct xfs_cil_ctx *ctx,
struct list_head *lv_chain, struct xlog_ticket *tic,
uint32_t len);
+int xlog_write_one_vec(struct xlog *log, struct xfs_cil_ctx *ctx,
+ struct xfs_log_iovec *reg, struct xlog_ticket *ticket);
void xfs_log_ticket_ungrant(struct xlog *log, struct xlog_ticket *ticket);
void xfs_log_ticket_regrant(struct xlog *log, struct xlog_ticket *ticket);
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 08/17] xfs: set lv_bytes in xlog_write_one_vec
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (6 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 07/17] xfs: add a xlog_write_one_vec helper Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 09/17] xfs: create ophdrs on the fly in xlog_write Christoph Hellwig
` (11 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
lv_bytes is mostly just use by the CIL code, but has crept into the
low-level log writing code to decide on a full or partial iclog
write. Ensure it is valid even for the special log writes that don't
go through the CIL by initializing it in xlog_write_one_vec.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index fa1bd1fc79ba..621d22328622 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -802,14 +802,15 @@ xlog_write_one_vec(
struct xfs_log_vec lv = {
.lv_niovecs = 1,
.lv_iovecp = reg,
+ .lv_bytes = reg->i_len,
};
LIST_HEAD (lv_chain);
/* account for space used by record data */
- ticket->t_curr_res -= reg->i_len;
+ ticket->t_curr_res -= lv.lv_bytes;
list_add(&lv.lv_list, &lv_chain);
- return xlog_write(log, ctx, &lv_chain, ticket, reg->i_len);
+ return xlog_write(log, ctx, &lv_chain, ticket, lv.lv_bytes);
}
/*
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 09/17] xfs: create ophdrs on the fly in xlog_write
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (7 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 08/17] xfs: set lv_bytes in xlog_write_one_vec Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 10/17] xfs: special case continuation records in xlog_write_region a litte less Christoph Hellwig
` (10 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Currently each log iovec starts with an xlog_op_header in the CIL buffer.
This wastes a little bit of memory, but more importantly makes managing
the alignment of the individual log regions rather painful.
But there is almost no information in the op_header that we actually need
keep while the item is in the CIL - the transaction ID gets overwritten
in xlog_write, the length can be derived from i_len in the xfs_log_iovec,
the client_id is set to the same value for all but one caller, leaving
only the values of oh_flags as relevant information.
Add a new i_op field to the xfs_log_vec to encode the flags and the
special oh_clientid value for the unmount record, and instead create the
xlog_op_header on the fly while writing to the iclog. This in turns
matches what we already do for continuation records, allowing to share
the code to write an op header and a region into iclog in a single
helper.
The in-memory only debug i_flags field is shortened to 16-bits to better
pack this new value.
Note that before this change the i_len field in the xfs_log_iovec used to
include the length of ophdr but now doesn't.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_log_format.h | 8 --
fs/xfs/xfs_log.c | 148 ++++++++++++++++-----------------
fs/xfs/xfs_log.h | 4 +-
fs/xfs/xfs_log_cil.c | 117 +++++++-------------------
fs/xfs/xfs_log_priv.h | 15 ++++
5 files changed, 123 insertions(+), 169 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index 0d637c276db0..4f12664d1005 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -194,14 +194,6 @@ typedef union xlog_in_core2 {
char hic_sector[XLOG_HEADER_SIZE];
} xlog_in_core_2_t;
-/* not an on-disk structure, but needed by log recovery in userspace */
-typedef struct xfs_log_iovec {
- void *i_addr; /* beginning address of region */
- int i_len; /* length in bytes of region */
- uint i_type; /* type of region */
-} xfs_log_iovec_t;
-
-
/*
* Transaction Header definitions.
*
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 621d22328622..223f08a50ca7 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -802,7 +802,7 @@ xlog_write_one_vec(
struct xfs_log_vec lv = {
.lv_niovecs = 1,
.lv_iovecp = reg,
- .lv_bytes = reg->i_len,
+ .lv_bytes = sizeof(struct xlog_op_header) + reg->i_len,
};
LIST_HEAD (lv_chain);
@@ -823,23 +823,14 @@ xlog_write_unmount_record(
struct xlog *log,
struct xlog_ticket *ticket)
{
- struct {
- struct xlog_op_header ophdr;
- struct xfs_unmount_log_format ulf;
- } unmount_rec = {
- .ophdr = {
- .oh_clientid = XFS_LOG,
- .oh_tid = cpu_to_be32(ticket->t_tid),
- .oh_flags = XLOG_UNMOUNT_TRANS,
- },
- .ulf = {
- .magic = XLOG_UNMOUNT_TYPE,
- },
+ struct xfs_unmount_log_format ulf = {
+ .magic = XLOG_UNMOUNT_TYPE,
};
- struct xfs_log_iovec reg = {
- .i_addr = &unmount_rec,
- .i_len = sizeof(unmount_rec),
- .i_type = XLOG_REG_TYPE_UNMOUNT,
+ struct xfs_log_iovec reg = {
+ .i_addr = &ulf,
+ .i_len = sizeof(ulf),
+ .i_op = XLOG_OP_UNMOUNT,
+ .i_type = XLOG_REG_TYPE_UNMOUNT,
};
return xlog_write_one_vec(log, NULL, ®, ticket);
@@ -1903,25 +1894,72 @@ xlog_print_trans(
}
}
-static inline void
-xlog_write_iovec(
+static void
+xlog_write_region(
+ struct xlog_ticket *ticket,
struct xlog_in_core *iclog,
uint32_t *log_offset,
- void *data,
- uint32_t write_len,
+ struct xfs_log_iovec *reg,
int *bytes_left,
uint32_t *record_cnt,
uint32_t *data_cnt)
{
+ struct xlog_op_header *ophdr = iclog->ic_datap + *log_offset;
+ uint32_t rlen;
+
ASSERT(*log_offset < iclog->ic_log->l_iclog_size);
ASSERT(*log_offset % sizeof(int32_t) == 0);
- ASSERT(write_len % sizeof(int32_t) == 0);
+ ASSERT(reg->i_len % sizeof(int32_t) == 0);
+
+ *log_offset += sizeof(struct xlog_op_header);
+ if (reg->i_op != XLOG_OP_CONT_TRANS)
+ *bytes_left -= sizeof(struct xlog_op_header);
+ *data_cnt += sizeof(struct xlog_op_header);
+
+ ASSERT(iclog->ic_size - *log_offset > 0);
+ rlen = min_t(uint32_t, reg->i_len, iclog->ic_size - *log_offset);
+ if (rlen) {
+ memcpy(iclog->ic_datap + *log_offset, reg->i_addr, rlen);
+ *log_offset += rlen;
+ *bytes_left -= rlen;
+ *data_cnt += rlen;
+ reg->i_addr += rlen;
+ reg->i_len -= rlen;
+ }
+
+ ophdr->oh_tid = cpu_to_be32(ticket->t_tid);
+ ophdr->oh_len = cpu_to_be32(rlen);
+ ophdr->oh_clientid = XFS_TRANSACTION;
+ ophdr->oh_flags = 0;
+ ophdr->oh_res2 = 0;
+
+ switch (reg->i_op) {
+ case XLOG_OP_TRANS:
+ if (reg->i_len) {
+ ophdr->oh_flags |= XLOG_CONTINUE_TRANS;
+ reg->i_op = XLOG_OP_CONT_TRANS;
+ }
+ break;
+ case XLOG_OP_CONT_TRANS:
+ ophdr->oh_flags |= XLOG_WAS_CONT_TRANS;
+ if (reg->i_len)
+ ophdr->oh_flags |= XLOG_CONTINUE_TRANS;
+ else
+ ophdr->oh_flags |= XLOG_END_TRANS;
+ break;
+ case XLOG_OP_UNMOUNT:
+ ophdr->oh_clientid = XFS_LOG;
+ ophdr->oh_flags |= XLOG_UNMOUNT_TRANS;
+ break;
+ case XLOG_OP_START_TRANS:
+ ophdr->oh_flags |= XLOG_START_TRANS;
+ break;
+ case XLOG_OP_COMMIT_TRANS:
+ ophdr->oh_flags |= XLOG_COMMIT_TRANS;
+ break;
+ }
- memcpy(iclog->ic_datap + *log_offset, data, write_len);
- *log_offset += write_len;
- *bytes_left -= write_len;
(*record_cnt)++;
- *data_cnt += write_len;
}
/*
@@ -1948,12 +1986,10 @@ xlog_write_full(
* loop will naturally skip them.
*/
for (index = 0; index < lv->lv_niovecs; index++) {
- struct xfs_log_iovec *reg = &lv->lv_iovecp[index];
- struct xlog_op_header *ophdr = reg->i_addr;
-
- ophdr->oh_tid = cpu_to_be32(ticket->t_tid);
- xlog_write_iovec(iclog, log_offset, reg->i_addr,
- reg->i_len, len, record_cnt, data_cnt);
+ xlog_write_region(ticket, iclog, log_offset,
+ &lv->lv_iovecp[index], len, record_cnt,
+ data_cnt);
+ ASSERT(lv->lv_iovecp[index].i_len == 0);
}
}
@@ -2005,15 +2041,12 @@ xlog_write_partial(
uint32_t *data_cnt)
{
struct xlog_in_core *iclog = *iclogp;
- struct xlog_op_header *ophdr;
int index = 0;
- uint32_t rlen;
int error;
/* walk the logvec, copying until we run out of space in the iclog */
for (index = 0; index < lv->lv_niovecs; index++) {
struct xfs_log_iovec *reg = &lv->lv_iovecp[index];
- uint32_t reg_offset = 0;
/*
* The first region of a continuation must have a non-zero
@@ -2035,19 +2068,11 @@ xlog_write_partial(
return error;
}
- ophdr = reg->i_addr;
- rlen = min_t(uint32_t, reg->i_len, iclog->ic_size - *log_offset);
-
- ophdr->oh_tid = cpu_to_be32(ticket->t_tid);
- ophdr->oh_len = cpu_to_be32(rlen - sizeof(struct xlog_op_header));
- if (rlen != reg->i_len)
- ophdr->oh_flags |= XLOG_CONTINUE_TRANS;
-
- xlog_write_iovec(iclog, log_offset, reg->i_addr,
- rlen, len, record_cnt, data_cnt);
+ xlog_write_region(ticket, iclog, log_offset, reg, len,
+ record_cnt, data_cnt);
/* If we wrote the whole region, move to the next. */
- if (rlen == reg->i_len)
+ if (reg->i_len == 0)
continue;
/*
@@ -2086,35 +2111,10 @@ xlog_write_partial(
if (error)
return error;
- ophdr = iclog->ic_datap + *log_offset;
- ophdr->oh_tid = cpu_to_be32(ticket->t_tid);
- ophdr->oh_clientid = XFS_TRANSACTION;
- ophdr->oh_res2 = 0;
- ophdr->oh_flags = XLOG_WAS_CONT_TRANS;
-
+ xlog_write_region(ticket, iclog, log_offset, reg, len,
+ record_cnt, data_cnt);
ticket->t_curr_res -= sizeof(struct xlog_op_header);
- *log_offset += sizeof(struct xlog_op_header);
- *data_cnt += sizeof(struct xlog_op_header);
-
- /*
- * If rlen fits in the iclog, then end the region
- * continuation. Otherwise we're going around again.
- */
- reg_offset += rlen;
- rlen = reg->i_len - reg_offset;
- if (rlen <= iclog->ic_size - *log_offset)
- ophdr->oh_flags |= XLOG_END_TRANS;
- else
- ophdr->oh_flags |= XLOG_CONTINUE_TRANS;
-
- rlen = min_t(uint32_t, rlen, iclog->ic_size - *log_offset);
- ophdr->oh_len = cpu_to_be32(rlen);
-
- xlog_write_iovec(iclog, log_offset,
- reg->i_addr + reg_offset,
- rlen, len, record_cnt, data_cnt);
-
- } while (ophdr->oh_flags & XLOG_CONTINUE_TRANS);
+ } while (reg->i_len > 0);
}
/*
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index e03dbff3ef8e..110f02690f85 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -34,7 +34,7 @@ xlog_calc_iovec_len(int len)
return roundup(len, sizeof(uint32_t));
}
-void *xlog_format_start(struct xlog_format_buf *lfb, uint type);
+void *xlog_format_start(struct xlog_format_buf *lfb, uint16_t type);
void xlog_format_commit(struct xlog_format_buf *lfb, unsigned int data_len);
/*
@@ -43,7 +43,7 @@ void xlog_format_commit(struct xlog_format_buf *lfb, unsigned int data_len);
static inline void *
xlog_format_copy(
struct xlog_format_buf *lfb,
- uint type,
+ uint16_t type,
void *data,
unsigned int len)
{
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 5a0f80cdfa5a..f8d9e5e93b79 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -301,15 +301,14 @@ xlog_cil_alloc_shadow_bufs(
* the next one is naturally aligned. We'll need to account for
* that slack space here.
*
- * We also add the xlog_op_header to each region when
- * formatting, but that's not accounted to the size of the item
- * at this point. Hence we'll need an addition number of bytes
- * for each vector to hold an opheader.
- *
* Then round nbytes up to 64-bit alignment so that the initial
* buffer alignment is easy to calculate and verify.
+ *
+ * Note that this does not include the per-iovec ophdr, which only
+ * exists in the iclog buffer, but not the CIL buffer.
*/
- nbytes = xlog_item_space(niovecs, nbytes);
+ nbytes = round_up(nbytes + niovecs * sizeof(uint64_t),
+ sizeof(uint64_t));
/*
* The data buffer needs to start 64-bit aligned, so round up
@@ -414,52 +413,20 @@ struct xlog_format_buf {
unsigned int idx;
};
-/*
- * We need to make sure the buffer pointer returned is naturally aligned for the
- * biggest basic data type we put into it. We have already accounted for this
- * padding when sizing the buffer.
- *
- * However, this padding does not get written into the log, and hence we have to
- * track the space used by the log vectors separately to prevent log space hangs
- * due to inaccurate accounting (i.e. a leak) of the used log space through the
- * CIL context ticket.
- *
- * We also add space for the xlog_op_header that describes this region in the
- * log. This prepends the data region we return to the caller to copy their data
- * into, so do all the static initialisation of the ophdr now. Because the ophdr
- * is not 8 byte aligned, we have to be careful to ensure that we align the
- * start of the buffer such that the region we return to the call is 8 byte
- * aligned and packed against the tail of the ophdr.
- */
void *
xlog_format_start(
struct xlog_format_buf *lfb,
- uint type)
+ uint16_t type)
{
struct xfs_log_vec *lv = lfb->lv;
struct xfs_log_iovec *vec = &lv->lv_iovecp[lfb->idx];
- struct xlog_op_header *oph;
- uint32_t len;
- void *buf;
+ void *buf = lv->lv_buf + lv->lv_buf_used;
ASSERT(lfb->idx < lv->lv_niovecs);
-
- len = lv->lv_buf_used + sizeof(struct xlog_op_header);
- if (!IS_ALIGNED(len, sizeof(uint64_t))) {
- lv->lv_buf_used = round_up(len, sizeof(uint64_t)) -
- sizeof(struct xlog_op_header);
- }
+ ASSERT(IS_ALIGNED((unsigned long)buf, sizeof(uint64_t)));
vec->i_type = type;
- vec->i_addr = lv->lv_buf + lv->lv_buf_used;
-
- oph = vec->i_addr;
- oph->oh_clientid = XFS_TRANSACTION;
- oph->oh_res2 = 0;
- oph->oh_flags = 0;
-
- buf = vec->i_addr + sizeof(struct xlog_op_header);
- ASSERT(IS_ALIGNED((unsigned long)buf, sizeof(uint64_t)));
+ vec->i_addr = buf;
return buf;
}
@@ -470,36 +437,35 @@ xlog_format_commit(
{
struct xfs_log_vec *lv = lfb->lv;
struct xfs_log_iovec *vec = &lv->lv_iovecp[lfb->idx];
- struct xlog_op_header *oph = vec->i_addr;
int len;
/*
* Always round up the length to the correct alignment so callers don't
* need to know anything about this log vec layout requirement. This
* means we have to zero the area the data to be written does not cover.
- * This is complicated by fact the payload region is offset into the
- * logvec region by the opheader that tracks the payload.
*/
len = xlog_calc_iovec_len(data_len);
- if (len - data_len != 0) {
- char *buf = vec->i_addr + sizeof(struct xlog_op_header);
-
- memset(buf + data_len, 0, len - data_len);
- }
+ if (len - data_len != 0)
+ memset(vec->i_addr + data_len, 0, len - data_len);
/*
- * The opheader tracks aligned payload length, whilst the logvec tracks
- * the overall region length.
+ * We need to make sure the next buffer pointer is naturally aligned for
+ * the biggest basic data type we put into it. We have already accounted
+ * for this padding when sizing the buffer.
+ *
+ * However, this padding does not get written into the log, and hence we
+ * have to track the space used by the log vectors separately to prevent
+ * log space hangs due to inaccurate accounting (i.e. a leak) of the
+ * used log space through the CIL context ticket. The used log space
+ * also needs to account for the op_header that gets added to each
+ * region.
*/
- oph->oh_len = cpu_to_be32(len);
-
- len += sizeof(struct xlog_op_header);
- lv->lv_buf_used += len;
- lv->lv_bytes += len;
+ lv->lv_buf_used += round_up(len, sizeof(uint64_t));
+ lv->lv_bytes += sizeof(struct xlog_op_header) + len;
vec->i_len = len;
/* Catch buffer overruns */
- ASSERT((void *)lv->lv_buf + lv->lv_bytes <=
+ ASSERT((void *)lv->lv_buf + lv->lv_buf_used <=
(void *)lv + lv->lv_alloc_size);
lfb->idx++;
@@ -1184,15 +1150,9 @@ xlog_cil_write_commit_record(
struct xfs_cil_ctx *ctx)
{
struct xlog *log = ctx->cil->xc_log;
- struct xlog_op_header ophdr = {
- .oh_clientid = XFS_TRANSACTION,
- .oh_tid = cpu_to_be32(ctx->ticket->t_tid),
- .oh_flags = XLOG_COMMIT_TRANS,
- };
struct xfs_log_iovec reg = {
- .i_addr = &ophdr,
- .i_len = sizeof(struct xlog_op_header),
- .i_type = XLOG_REG_TYPE_COMMIT,
+ .i_op = XLOG_OP_COMMIT_TRANS,
+ .i_type = XLOG_REG_TYPE_COMMIT,
};
int error;
@@ -1209,7 +1169,6 @@ xlog_cil_write_commit_record(
}
struct xlog_cil_trans_hdr {
- struct xlog_op_header oph[2];
struct xfs_trans_header thdr;
struct xfs_log_iovec lhdr[2];
};
@@ -1234,25 +1193,13 @@ xlog_cil_build_trans_hdr(
int num_iovecs)
{
struct xlog_ticket *tic = ctx->ticket;
- __be32 tid = cpu_to_be32(tic->t_tid);
memset(hdr, 0, sizeof(*hdr));
/* Log start record */
- hdr->oph[0].oh_tid = tid;
- hdr->oph[0].oh_clientid = XFS_TRANSACTION;
- hdr->oph[0].oh_flags = XLOG_START_TRANS;
-
- /* log iovec region pointer */
- hdr->lhdr[0].i_addr = &hdr->oph[0];
- hdr->lhdr[0].i_len = sizeof(struct xlog_op_header);
+ hdr->lhdr[0].i_op = XLOG_OP_START_TRANS;
hdr->lhdr[0].i_type = XLOG_REG_TYPE_LRHEADER;
- /* log opheader */
- hdr->oph[1].oh_tid = tid;
- hdr->oph[1].oh_clientid = XFS_TRANSACTION;
- hdr->oph[1].oh_len = cpu_to_be32(sizeof(struct xfs_trans_header));
-
/* transaction header in host byte order format */
hdr->thdr.th_magic = XFS_TRANS_HEADER_MAGIC;
hdr->thdr.th_type = XFS_TRANS_CHECKPOINT;
@@ -1260,14 +1207,14 @@ xlog_cil_build_trans_hdr(
hdr->thdr.th_num_items = num_iovecs;
/* log iovec region pointer */
- hdr->lhdr[1].i_addr = &hdr->oph[1];
- hdr->lhdr[1].i_len = sizeof(struct xlog_op_header) +
- sizeof(struct xfs_trans_header);
+ hdr->lhdr[1].i_addr = &hdr->thdr;
+ hdr->lhdr[1].i_len = sizeof(struct xfs_trans_header);
hdr->lhdr[1].i_type = XLOG_REG_TYPE_TRANSHDR;
lvhdr->lv_niovecs = 2;
- lvhdr->lv_iovecp = &hdr->lhdr[0];
- lvhdr->lv_bytes = hdr->lhdr[0].i_len + hdr->lhdr[1].i_len;
+ lvhdr->lv_iovecp = hdr->lhdr;
+ lvhdr->lv_bytes = 2 * sizeof(struct xlog_op_header) +
+ sizeof(struct xfs_trans_header);
tic->t_curr_res -= lvhdr->lv_bytes;
}
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 463daf51da15..17bbe69655a4 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -13,6 +13,21 @@ struct xlog;
struct xlog_ticket;
struct xfs_mount;
+enum xlog_op_type {
+ XLOG_OP_TRANS = 0,
+ XLOG_OP_CONT_TRANS,
+ XLOG_OP_START_TRANS,
+ XLOG_OP_COMMIT_TRANS,
+ XLOG_OP_UNMOUNT,
+} __packed;
+
+struct xfs_log_iovec {
+ void *i_addr;/* beginning address of region */
+ int i_len; /* length in bytes of region */
+ enum xlog_op_type i_op; /* log operation */
+ uint16_t i_type; /* type of region (debug only) */
+};
+
/*
* get client id from packed copy.
*
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 10/17] xfs: special case continuation records in xlog_write_region a litte less
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (8 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 09/17] xfs: create ophdrs on the fly in xlog_write Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 11/17] xfs: factor the split iclog handling out of xlog_write_partial Christoph Hellwig
` (9 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
xlog_write_partial already needs to add the size of the op_header to the
log space reservation requested from xlog_write_get_more_iclog_space.
Adding to the len variable tracking the available reservation instead,
so that xlog_write_region can unconditionally use the reservation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 223f08a50ca7..00b1174d4a30 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1912,8 +1912,7 @@ xlog_write_region(
ASSERT(reg->i_len % sizeof(int32_t) == 0);
*log_offset += sizeof(struct xlog_op_header);
- if (reg->i_op != XLOG_OP_CONT_TRANS)
- *bytes_left -= sizeof(struct xlog_op_header);
+ *bytes_left -= sizeof(struct xlog_op_header);
*data_cnt += sizeof(struct xlog_op_header);
ASSERT(iclog->ic_size - *log_offset > 0);
@@ -2104,10 +2103,9 @@ xlog_write_partial(
* consumes hasn't been accounted to the lv we are
* writing.
*/
- error = xlog_write_get_more_iclog_space(ticket,
- &iclog, log_offset,
- *len + sizeof(struct xlog_op_header),
- record_cnt, data_cnt);
+ *len += sizeof(struct xlog_op_header);
+ error = xlog_write_get_more_iclog_space(ticket, &iclog,
+ log_offset, *len, record_cnt, data_cnt);
if (error)
return error;
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 11/17] xfs: factor the split iclog handling out of xlog_write_partial
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (9 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 10/17] xfs: special case continuation records in xlog_write_region a litte less Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 12/17] xfs: remove xlog_write_full Christoph Hellwig
` (8 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Add a new xlog_write_remainder handler that writes a continuation op
header and copies all fitting data out of xlog_write_partial into a
separate helper to clean up xlog_write_partial a bit.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 94 +++++++++++++++++++++++++++---------------------
1 file changed, 54 insertions(+), 40 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 00b1174d4a30..aa158bc4d36b 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -2023,6 +2023,49 @@ xlog_write_get_more_iclog_space(
return 0;
}
+/*
+ * Write the remainder or at least the start of it for an iovec spans more than
+ * a single iclog.
+ *
+ * First we release the iclog we currently have, then we get a new iclog and add
+ * a new opheader. If we did not finish the iovec, the caller will call us
+ * again until we are done.
+ *
+ * This is complicated by the tail of a region using all the space in an iclog
+ * and hence requiring us to release the iclog and get a new one before
+ * returning to the outer loop. We must always guarantee that we exit this
+ * with at least space for log transaction opheaders left in the current iclog.
+ */
+static int
+xlog_write_remainder(
+ struct xlog_ticket *ticket,
+ struct xlog_in_core **iclogp,
+ uint32_t *log_offset,
+ uint32_t *len,
+ uint32_t *record_cnt,
+ uint32_t *data_cnt,
+ struct xfs_log_iovec *reg)
+{
+ int error;
+
+ /*
+ * Ensure we include the continuation opheader in the space we need in
+ * the new iclog by adding that size to the length we require. This
+ * continuation opheader needs to be accounted to the ticket as the
+ * space it consumes hasn't been accounted to the lv we are writing.
+ */
+ *len += sizeof(struct xlog_op_header);
+ error = xlog_write_get_more_iclog_space(ticket, iclogp, log_offset,
+ *len, record_cnt, data_cnt);
+ if (error)
+ return error;
+
+ xlog_write_region(ticket, *iclogp, log_offset, reg, len,
+ record_cnt, data_cnt);
+ ticket->t_curr_res -= sizeof(struct xlog_op_header);
+ return 0;
+}
+
/*
* Write log vectors into a single iclog which is smaller than the current chain
* length. We write until we cannot fit a full record into the remaining space
@@ -2041,11 +2084,11 @@ xlog_write_partial(
{
struct xlog_in_core *iclog = *iclogp;
int index = 0;
- int error;
/* walk the logvec, copying until we run out of space in the iclog */
for (index = 0; index < lv->lv_niovecs; index++) {
struct xfs_log_iovec *reg = &lv->lv_iovecp[index];
+ int error;
/*
* The first region of a continuation must have a non-zero
@@ -2067,52 +2110,23 @@ xlog_write_partial(
return error;
}
+ /*
+ * Write the amount that fits into this iclog.
+ */
xlog_write_region(ticket, iclog, log_offset, reg, len,
record_cnt, data_cnt);
- /* If we wrote the whole region, move to the next. */
- if (reg->i_len == 0)
- continue;
-
/*
- * We now have a partially written iovec, but it can span
- * multiple iclogs so we loop here. First we release the iclog
- * we currently have, then we get a new iclog and add a new
- * opheader. Then we continue copying from where we were until
- * we either complete the iovec or fill the iclog. If we
- * complete the iovec, then we increment the index and go right
- * back to the top of the outer loop. if we fill the iclog, we
- * run the inner loop again.
- *
- * This is complicated by the tail of a region using all the
- * space in an iclog and hence requiring us to release the iclog
- * and get a new one before returning to the outer loop. We must
- * always guarantee that we exit this inner loop with at least
- * space for log transaction opheaders left in the current
- * iclog, hence we cannot just terminate the loop at the end
- * of the of the continuation. So we loop while there is no
- * space left in the current iclog, and check for the end of the
- * continuation after getting a new iclog.
+ * We now have an at least partially written iovec, but it can
+ * span multiple iclogs so we loop over iclogs here until we
+ * complete the iovec.
*/
- do {
- /*
- * Ensure we include the continuation opheader in the
- * space we need in the new iclog by adding that size
- * to the length we require. This continuation opheader
- * needs to be accounted to the ticket as the space it
- * consumes hasn't been accounted to the lv we are
- * writing.
- */
- *len += sizeof(struct xlog_op_header);
- error = xlog_write_get_more_iclog_space(ticket, &iclog,
- log_offset, *len, record_cnt, data_cnt);
+ while (reg->i_len > 0) {
+ error = xlog_write_remainder(ticket, &iclog, log_offset,
+ len, record_cnt, data_cnt, reg);
if (error)
return error;
-
- xlog_write_region(ticket, iclog, log_offset, reg, len,
- record_cnt, data_cnt);
- ticket->t_curr_res -= sizeof(struct xlog_op_header);
- } while (reg->i_len > 0);
+ }
}
/*
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 12/17] xfs: remove xlog_write_full
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (10 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 11/17] xfs: factor the split iclog handling out of xlog_write_partial Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 13/17] xfs: improve argument handling for the xlog_write helpers Christoph Hellwig
` (7 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
xlog_write_partial now only two trivial extra branches compared to the
fast path for the case where the iovec fits into the iclog. Remove the
special fast path so that we always use the same code and rename
xlog_write_partial to xlog_write_vec.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 57 +++++-------------------------------------------
1 file changed, 5 insertions(+), 52 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index aa158bc4d36b..b72f52ab9521 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1961,37 +1961,6 @@ xlog_write_region(
(*record_cnt)++;
}
-/*
- * Write log vectors into a single iclog which is guaranteed by the caller
- * to have enough space to write the entire log vector into.
- */
-static void
-xlog_write_full(
- struct xfs_log_vec *lv,
- struct xlog_ticket *ticket,
- struct xlog_in_core *iclog,
- uint32_t *log_offset,
- uint32_t *len,
- uint32_t *record_cnt,
- uint32_t *data_cnt)
-{
- int index;
-
- ASSERT(*log_offset + *len <= iclog->ic_size ||
- iclog->ic_state == XLOG_STATE_WANT_SYNC);
-
- /*
- * Ordered log vectors have no regions to write so this
- * loop will naturally skip them.
- */
- for (index = 0; index < lv->lv_niovecs; index++) {
- xlog_write_region(ticket, iclog, log_offset,
- &lv->lv_iovecp[index], len, record_cnt,
- data_cnt);
- ASSERT(lv->lv_iovecp[index].i_len == 0);
- }
-}
-
static int
xlog_write_get_more_iclog_space(
struct xlog_ticket *ticket,
@@ -2073,7 +2042,7 @@ xlog_write_remainder(
* wholly fit in the iclog.
*/
static int
-xlog_write_partial(
+xlog_write_vec(
struct xfs_log_vec *lv,
struct xlog_ticket *ticket,
struct xlog_in_core **iclogp,
@@ -2216,26 +2185,10 @@ xlog_write(
xlog_cil_set_ctx_write_state(ctx, iclog);
list_for_each_entry(lv, lv_chain, lv_list) {
- /*
- * If the entire log vec does not fit in the iclog, punt it to
- * the partial copy loop which can handle this case.
- */
- if (lv->lv_niovecs &&
- lv->lv_bytes > iclog->ic_size - log_offset) {
- error = xlog_write_partial(lv, ticket, &iclog,
- &log_offset, &len, &record_cnt,
- &data_cnt);
- if (error) {
- /*
- * We have no iclog to release, so just return
- * the error immediately.
- */
- return error;
- }
- } else {
- xlog_write_full(lv, ticket, iclog, &log_offset,
- &len, &record_cnt, &data_cnt);
- }
+ error = xlog_write_vec(lv, ticket, &iclog, &log_offset, &len,
+ &record_cnt, &data_cnt);
+ if (error)
+ return error;
}
ASSERT(len == 0);
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 13/17] xfs: improve argument handling for the xlog_write helpers
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (11 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 12/17] xfs: remove xlog_write_full Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 14/17] xfs: remove the xlog_op_header_t typedef Christoph Hellwig
` (6 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
The xlog_write chain passes around the same seven variables that are
often passed by reference. Add a xlog_write_data structure to contain
them to improve code generation and readability.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 171 +++++++++++++++++++----------------------------
1 file changed, 70 insertions(+), 101 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index b72f52ab9521..18316612b16f 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -22,6 +22,15 @@
#include "xfs_health.h"
#include "xfs_zone_alloc.h"
+struct xlog_write_data {
+ struct xlog_ticket *ticket;
+ struct xlog_in_core *iclog;
+ uint32_t bytes_left;
+ uint32_t record_cnt;
+ uint32_t data_cnt;
+ int log_offset;
+};
+
struct kmem_cache *xfs_log_ticket_cache;
/* Local miscellaneous function prototypes */
@@ -43,10 +52,7 @@ STATIC void xlog_state_do_callback(
STATIC int
xlog_state_get_iclog_space(
struct xlog *log,
- int len,
- struct xlog_in_core **iclog,
- struct xlog_ticket *ticket,
- int *logoffsetp);
+ struct xlog_write_data *data);
STATIC void
xlog_sync(
struct xlog *log,
@@ -1896,37 +1902,33 @@ xlog_print_trans(
static void
xlog_write_region(
- struct xlog_ticket *ticket,
- struct xlog_in_core *iclog,
- uint32_t *log_offset,
- struct xfs_log_iovec *reg,
- int *bytes_left,
- uint32_t *record_cnt,
- uint32_t *data_cnt)
+ struct xlog_write_data *data,
+ struct xfs_log_iovec *reg)
{
- struct xlog_op_header *ophdr = iclog->ic_datap + *log_offset;
+ struct xlog_in_core *iclog = data->iclog;
+ struct xlog_op_header *ophdr = iclog->ic_datap + data->log_offset;
uint32_t rlen;
- ASSERT(*log_offset < iclog->ic_log->l_iclog_size);
- ASSERT(*log_offset % sizeof(int32_t) == 0);
+ ASSERT(data->log_offset < iclog->ic_log->l_iclog_size);
+ ASSERT(data->log_offset % sizeof(int32_t) == 0);
ASSERT(reg->i_len % sizeof(int32_t) == 0);
- *log_offset += sizeof(struct xlog_op_header);
- *bytes_left -= sizeof(struct xlog_op_header);
- *data_cnt += sizeof(struct xlog_op_header);
+ data->log_offset += sizeof(struct xlog_op_header);
+ data->bytes_left -= sizeof(struct xlog_op_header);
+ data->data_cnt += sizeof(struct xlog_op_header);
- ASSERT(iclog->ic_size - *log_offset > 0);
- rlen = min_t(uint32_t, reg->i_len, iclog->ic_size - *log_offset);
+ ASSERT(iclog->ic_size - data->log_offset > 0);
+ rlen = min_t(uint32_t, reg->i_len, iclog->ic_size - data->log_offset);
if (rlen) {
- memcpy(iclog->ic_datap + *log_offset, reg->i_addr, rlen);
- *log_offset += rlen;
- *bytes_left -= rlen;
- *data_cnt += rlen;
+ memcpy(iclog->ic_datap + data->log_offset, reg->i_addr, rlen);
+ data->log_offset += rlen;
+ data->bytes_left -= rlen;
+ data->data_cnt += rlen;
reg->i_addr += rlen;
reg->i_len -= rlen;
}
- ophdr->oh_tid = cpu_to_be32(ticket->t_tid);
+ ophdr->oh_tid = cpu_to_be32(data->ticket->t_tid);
ophdr->oh_len = cpu_to_be32(rlen);
ophdr->oh_clientid = XFS_TRANSACTION;
ophdr->oh_flags = 0;
@@ -1958,37 +1960,30 @@ xlog_write_region(
break;
}
- (*record_cnt)++;
+ data->record_cnt++;
}
static int
xlog_write_get_more_iclog_space(
- struct xlog_ticket *ticket,
- struct xlog_in_core **iclogp,
- uint32_t *log_offset,
- uint32_t len,
- uint32_t *record_cnt,
- uint32_t *data_cnt)
+ struct xlog_write_data *data)
{
- struct xlog_in_core *iclog = *iclogp;
- struct xlog *log = iclog->ic_log;
+ struct xlog *log = data->iclog->ic_log;
int error;
spin_lock(&log->l_icloglock);
- ASSERT(iclog->ic_state == XLOG_STATE_WANT_SYNC);
- xlog_state_finish_copy(log, iclog, *record_cnt, *data_cnt);
- error = xlog_state_release_iclog(log, iclog, ticket);
+ ASSERT(data->iclog->ic_state == XLOG_STATE_WANT_SYNC);
+ xlog_state_finish_copy(log, data->iclog, data->record_cnt,
+ data->data_cnt);
+ error = xlog_state_release_iclog(log, data->iclog, data->ticket);
spin_unlock(&log->l_icloglock);
if (error)
return error;
- error = xlog_state_get_iclog_space(log, len, &iclog, ticket,
- log_offset);
+ error = xlog_state_get_iclog_space(log, data);
if (error)
return error;
- *record_cnt = 0;
- *data_cnt = 0;
- *iclogp = iclog;
+ data->record_cnt = 0;
+ data->data_cnt = 0;
return 0;
}
@@ -2007,12 +2002,7 @@ xlog_write_get_more_iclog_space(
*/
static int
xlog_write_remainder(
- struct xlog_ticket *ticket,
- struct xlog_in_core **iclogp,
- uint32_t *log_offset,
- uint32_t *len,
- uint32_t *record_cnt,
- uint32_t *data_cnt,
+ struct xlog_write_data *data,
struct xfs_log_iovec *reg)
{
int error;
@@ -2023,15 +2013,13 @@ xlog_write_remainder(
* continuation opheader needs to be accounted to the ticket as the
* space it consumes hasn't been accounted to the lv we are writing.
*/
- *len += sizeof(struct xlog_op_header);
- error = xlog_write_get_more_iclog_space(ticket, iclogp, log_offset,
- *len, record_cnt, data_cnt);
+ data->bytes_left += sizeof(struct xlog_op_header);
+ error = xlog_write_get_more_iclog_space(data);
if (error)
return error;
- xlog_write_region(ticket, *iclogp, log_offset, reg, len,
- record_cnt, data_cnt);
- ticket->t_curr_res -= sizeof(struct xlog_op_header);
+ xlog_write_region(data, reg);
+ data->ticket->t_curr_res -= sizeof(struct xlog_op_header);
return 0;
}
@@ -2043,15 +2031,9 @@ xlog_write_remainder(
*/
static int
xlog_write_vec(
- struct xfs_log_vec *lv,
- struct xlog_ticket *ticket,
- struct xlog_in_core **iclogp,
- uint32_t *log_offset,
- uint32_t *len,
- uint32_t *record_cnt,
- uint32_t *data_cnt)
+ struct xlog_write_data *data,
+ struct xfs_log_vec *lv)
{
- struct xlog_in_core *iclog = *iclogp;
int index = 0;
/* walk the logvec, copying until we run out of space in the iclog */
@@ -2070,11 +2052,9 @@ xlog_write_vec(
* Hence if there isn't space for region data after the
* opheader, then we need to start afresh with a new iclog.
*/
- if (iclog->ic_size - *log_offset <=
+ if (data->iclog->ic_size - data->log_offset <=
sizeof(struct xlog_op_header)) {
- error = xlog_write_get_more_iclog_space(ticket,
- &iclog, log_offset, *len, record_cnt,
- data_cnt);
+ error = xlog_write_get_more_iclog_space(data);
if (error)
return error;
}
@@ -2082,8 +2062,7 @@ xlog_write_vec(
/*
* Write the amount that fits into this iclog.
*/
- xlog_write_region(ticket, iclog, log_offset, reg, len,
- record_cnt, data_cnt);
+ xlog_write_region(data, reg);
/*
* We now have an at least partially written iovec, but it can
@@ -2091,18 +2070,12 @@ xlog_write_vec(
* complete the iovec.
*/
while (reg->i_len > 0) {
- error = xlog_write_remainder(ticket, &iclog, log_offset,
- len, record_cnt, data_cnt, reg);
+ error = xlog_write_remainder(data, reg);
if (error)
return error;
}
}
- /*
- * No more iovecs remain in this logvec so return the next log vec to
- * the caller so it can go back to fast path copying.
- */
- *iclogp = iclog;
return 0;
}
@@ -2155,12 +2128,12 @@ xlog_write(
uint32_t len)
{
- struct xlog_in_core *iclog = NULL;
struct xfs_log_vec *lv;
- uint32_t record_cnt = 0;
- uint32_t data_cnt = 0;
- int error = 0;
- int log_offset;
+ struct xlog_write_data data = {
+ .ticket = ticket,
+ .bytes_left = len,
+ };
+ int error;
if (ticket->t_curr_res < 0) {
xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES,
@@ -2169,12 +2142,11 @@ xlog_write(
xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);
}
- error = xlog_state_get_iclog_space(log, len, &iclog, ticket,
- &log_offset);
+ error = xlog_state_get_iclog_space(log, &data);
if (error)
return error;
- ASSERT(log_offset <= iclog->ic_size - 1);
+ ASSERT(data.log_offset <= data.iclog->ic_size - 1);
/*
* If we have a context pointer, pass it the first iclog we are
@@ -2182,15 +2154,14 @@ xlog_write(
* ordering.
*/
if (ctx)
- xlog_cil_set_ctx_write_state(ctx, iclog);
+ xlog_cil_set_ctx_write_state(ctx, data.iclog);
list_for_each_entry(lv, lv_chain, lv_list) {
- error = xlog_write_vec(lv, ticket, &iclog, &log_offset, &len,
- &record_cnt, &data_cnt);
+ error = xlog_write_vec(&data, lv);
if (error)
return error;
}
- ASSERT(len == 0);
+ ASSERT(data.bytes_left == 0);
/*
* We've already been guaranteed that the last writes will fit inside
@@ -2199,8 +2170,8 @@ xlog_write(
* iclog with the number of bytes written here.
*/
spin_lock(&log->l_icloglock);
- xlog_state_finish_copy(log, iclog, record_cnt, 0);
- error = xlog_state_release_iclog(log, iclog, ticket);
+ xlog_state_finish_copy(log, data.iclog, data.record_cnt, 0);
+ error = xlog_state_release_iclog(log, data.iclog, ticket);
spin_unlock(&log->l_icloglock);
return error;
@@ -2522,14 +2493,11 @@ xlog_state_done_syncing(
STATIC int
xlog_state_get_iclog_space(
struct xlog *log,
- int len,
- struct xlog_in_core **iclogp,
- struct xlog_ticket *ticket,
- int *logoffsetp)
+ struct xlog_write_data *data)
{
- int log_offset;
- xlog_rec_header_t *head;
- xlog_in_core_t *iclog;
+ int log_offset;
+ struct xlog_rec_header *head;
+ struct xlog_in_core *iclog;
restart:
spin_lock(&log->l_icloglock);
@@ -2560,7 +2528,7 @@ xlog_state_get_iclog_space(
* must be written.
*/
if (log_offset == 0) {
- ticket->t_curr_res -= log->l_iclog_hsize;
+ data->ticket->t_curr_res -= log->l_iclog_hsize;
head->h_cycle = cpu_to_be32(log->l_curr_cycle);
head->h_lsn = cpu_to_be64(
xlog_assign_lsn(log->l_curr_cycle, log->l_curr_block));
@@ -2589,7 +2557,8 @@ xlog_state_get_iclog_space(
* reference to the iclog.
*/
if (!atomic_add_unless(&iclog->ic_refcnt, -1, 1))
- error = xlog_state_release_iclog(log, iclog, ticket);
+ error = xlog_state_release_iclog(log, iclog,
+ data->ticket);
spin_unlock(&log->l_icloglock);
if (error)
return error;
@@ -2602,16 +2571,16 @@ xlog_state_get_iclog_space(
* iclogs (to mark it taken), this particular iclog will release/sync
* to disk in xlog_write().
*/
- if (len <= iclog->ic_size - iclog->ic_offset)
- iclog->ic_offset += len;
+ if (data->bytes_left <= iclog->ic_size - iclog->ic_offset)
+ iclog->ic_offset += data->bytes_left;
else
xlog_state_switch_iclogs(log, iclog, iclog->ic_size);
- *iclogp = iclog;
+ data->iclog = iclog;
ASSERT(iclog->ic_offset <= iclog->ic_size);
spin_unlock(&log->l_icloglock);
- *logoffsetp = log_offset;
+ data->log_offset = log_offset;
return 0;
}
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 14/17] xfs: remove the xlog_op_header_t typedef
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (12 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 13/17] xfs: improve argument handling for the xlog_write helpers Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 15/17] xfs: remove the xfs_trans_header_t typedef Christoph Hellwig
` (5 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Almost no users of the typedef left, kill it and switch the remaining
users to use the underlying struct.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_log_format.h | 5 ++---
fs/xfs/xfs_log.c | 17 +++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index 4f12664d1005..6cdcc6eef539 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -141,14 +141,13 @@ struct xfs_unmount_log_format {
#define XLOG_END_TRANS 0x10 /* End a continued transaction */
#define XLOG_UNMOUNT_TRANS 0x20 /* Unmount a filesystem transaction */
-
-typedef struct xlog_op_header {
+struct xlog_op_header {
__be32 oh_tid; /* transaction id of operation : 4 b */
__be32 oh_len; /* bytes in data region : 4 b */
__u8 oh_clientid; /* who sent me this : 1 b */
__u8 oh_flags; /* : 1 b */
__u16 oh_res2; /* 32 bit align : 2 b */
-} xlog_op_header_t;
+};
/* valid values for h_fmt */
#define XLOG_FMT_UNKNOWN 0
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 18316612b16f..601edfd7f33c 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -2541,10 +2541,11 @@ xlog_state_get_iclog_space(
* until you know exactly how many bytes get copied. Therefore, wait
* until later to update ic_offset.
*
- * xlog_write() algorithm assumes that at least 2 xlog_op_header_t's
+ * xlog_write() algorithm assumes that at least 2 xlog_op_header's
* can fit into remaining data section.
*/
- if (iclog->ic_size - iclog->ic_offset < 2*sizeof(xlog_op_header_t)) {
+ if (iclog->ic_size - iclog->ic_offset <
+ 2 * sizeof(struct xlog_op_header)) {
int error = 0;
xlog_state_switch_iclogs(log, iclog, iclog->ic_size);
@@ -3039,11 +3040,11 @@ xlog_calc_unit_res(
*/
/* for trans header */
- unit_bytes += sizeof(xlog_op_header_t);
+ unit_bytes += sizeof(struct xlog_op_header);
unit_bytes += sizeof(xfs_trans_header_t);
/* for start-rec */
- unit_bytes += sizeof(xlog_op_header_t);
+ unit_bytes += sizeof(struct xlog_op_header);
/*
* for LR headers - the space for data in an iclog is the size minus
@@ -3066,12 +3067,12 @@ xlog_calc_unit_res(
num_headers = howmany(unit_bytes, iclog_space);
/* for split-recs - ophdrs added when data split over LRs */
- unit_bytes += sizeof(xlog_op_header_t) * num_headers;
+ unit_bytes += sizeof(struct xlog_op_header) * num_headers;
/* add extra header reservations if we overrun */
while (!num_headers ||
howmany(unit_bytes, iclog_space) > num_headers) {
- unit_bytes += sizeof(xlog_op_header_t);
+ unit_bytes += sizeof(struct xlog_op_header);
num_headers++;
}
unit_bytes += log->l_iclog_hsize * num_headers;
@@ -3208,7 +3209,7 @@ xlog_verify_iclog(
struct xlog_in_core *iclog,
int count)
{
- xlog_op_header_t *ophead;
+ struct xlog_op_header *ophead;
xlog_in_core_t *icptr;
xlog_in_core_2_t *xhdr;
void *base_ptr, *ptr, *p;
@@ -3286,7 +3287,7 @@ xlog_verify_iclog(
op_len = be32_to_cpu(iclog->ic_header.h_cycle_data[idx]);
}
}
- ptr += sizeof(xlog_op_header_t) + op_len;
+ ptr += sizeof(struct xlog_op_header) + op_len;
}
}
#endif
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 15/17] xfs: remove the xfs_trans_header_t typedef
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (13 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 14/17] xfs: remove the xlog_op_header_t typedef Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 16/17] xfs: move the XLOG_REG_ constants out of xfs_log_format.h Christoph Hellwig
` (4 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
Almost no users of the typedef left, kill it and switch the remaining
users to use the underlying struct.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_log_format.h | 4 ++--
fs/xfs/libxfs/xfs_log_recover.h | 2 +-
fs/xfs/xfs_log.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index 6cdcc6eef539..e5e6f8c0408f 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -204,12 +204,12 @@ typedef union xlog_in_core2 {
* Do not change the below structure without redoing the code in
* xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans().
*/
-typedef struct xfs_trans_header {
+struct xfs_trans_header {
uint th_magic; /* magic number */
uint th_type; /* transaction type */
int32_t th_tid; /* transaction id (unused) */
uint th_num_items; /* num items logged by trans */
-} xfs_trans_header_t;
+};
#define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */
diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h
index 95de23095030..9e712e62369c 100644
--- a/fs/xfs/libxfs/xfs_log_recover.h
+++ b/fs/xfs/libxfs/xfs_log_recover.h
@@ -111,7 +111,7 @@ struct xlog_recover_item {
struct xlog_recover {
struct hlist_node r_list;
xlog_tid_t r_log_tid; /* log's transaction id */
- xfs_trans_header_t r_theader; /* trans header for partial */
+ struct xfs_trans_header r_theader; /* trans header for partial */
int r_state; /* not needed */
xfs_lsn_t r_lsn; /* xact lsn */
struct list_head r_itemq; /* q for items */
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 601edfd7f33c..88b74091096f 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3041,7 +3041,7 @@ xlog_calc_unit_res(
/* for trans header */
unit_bytes += sizeof(struct xlog_op_header);
- unit_bytes += sizeof(xfs_trans_header_t);
+ unit_bytes += sizeof(struct xfs_trans_header);
/* for start-rec */
unit_bytes += sizeof(struct xlog_op_header);
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 16/17] xfs: move the XLOG_REG_ constants out of xfs_log_format.h
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (14 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 15/17] xfs: remove the xfs_trans_header_t typedef Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 17/17] xfs: move struct xfs_log_vec to xfs_log_priv.h Christoph Hellwig
` (3 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
These are purely in-memory values and not used at all in xfsprogs.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_log_format.h | 37 ----------------------------------
fs/xfs/xfs_log.h | 37 ++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index e5e6f8c0408f..da99ab4aea6c 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -86,43 +86,6 @@ struct xfs_unmount_log_format {
uint32_t pad2; /* may as well make it 64 bits */
};
-/* Region types for iovec's i_type */
-#define XLOG_REG_TYPE_BFORMAT 1
-#define XLOG_REG_TYPE_BCHUNK 2
-#define XLOG_REG_TYPE_EFI_FORMAT 3
-#define XLOG_REG_TYPE_EFD_FORMAT 4
-#define XLOG_REG_TYPE_IFORMAT 5
-#define XLOG_REG_TYPE_ICORE 6
-#define XLOG_REG_TYPE_IEXT 7
-#define XLOG_REG_TYPE_IBROOT 8
-#define XLOG_REG_TYPE_ILOCAL 9
-#define XLOG_REG_TYPE_IATTR_EXT 10
-#define XLOG_REG_TYPE_IATTR_BROOT 11
-#define XLOG_REG_TYPE_IATTR_LOCAL 12
-#define XLOG_REG_TYPE_QFORMAT 13
-#define XLOG_REG_TYPE_DQUOT 14
-#define XLOG_REG_TYPE_QUOTAOFF 15
-#define XLOG_REG_TYPE_LRHEADER 16
-#define XLOG_REG_TYPE_UNMOUNT 17
-#define XLOG_REG_TYPE_COMMIT 18
-#define XLOG_REG_TYPE_TRANSHDR 19
-#define XLOG_REG_TYPE_ICREATE 20
-#define XLOG_REG_TYPE_RUI_FORMAT 21
-#define XLOG_REG_TYPE_RUD_FORMAT 22
-#define XLOG_REG_TYPE_CUI_FORMAT 23
-#define XLOG_REG_TYPE_CUD_FORMAT 24
-#define XLOG_REG_TYPE_BUI_FORMAT 25
-#define XLOG_REG_TYPE_BUD_FORMAT 26
-#define XLOG_REG_TYPE_ATTRI_FORMAT 27
-#define XLOG_REG_TYPE_ATTRD_FORMAT 28
-#define XLOG_REG_TYPE_ATTR_NAME 29
-#define XLOG_REG_TYPE_ATTR_VALUE 30
-#define XLOG_REG_TYPE_XMI_FORMAT 31
-#define XLOG_REG_TYPE_XMD_FORMAT 32
-#define XLOG_REG_TYPE_ATTR_NEWNAME 33
-#define XLOG_REG_TYPE_ATTR_NEWVALUE 34
-#define XLOG_REG_TYPE_MAX 34
-
/*
* Flags to log operation header
*
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index 110f02690f85..c4930e925fed 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -21,6 +21,43 @@ struct xfs_log_vec {
int lv_alloc_size; /* size of allocated lv */
};
+/* Region types for iovec's i_type */
+#define XLOG_REG_TYPE_BFORMAT 1
+#define XLOG_REG_TYPE_BCHUNK 2
+#define XLOG_REG_TYPE_EFI_FORMAT 3
+#define XLOG_REG_TYPE_EFD_FORMAT 4
+#define XLOG_REG_TYPE_IFORMAT 5
+#define XLOG_REG_TYPE_ICORE 6
+#define XLOG_REG_TYPE_IEXT 7
+#define XLOG_REG_TYPE_IBROOT 8
+#define XLOG_REG_TYPE_ILOCAL 9
+#define XLOG_REG_TYPE_IATTR_EXT 10
+#define XLOG_REG_TYPE_IATTR_BROOT 11
+#define XLOG_REG_TYPE_IATTR_LOCAL 12
+#define XLOG_REG_TYPE_QFORMAT 13
+#define XLOG_REG_TYPE_DQUOT 14
+#define XLOG_REG_TYPE_QUOTAOFF 15
+#define XLOG_REG_TYPE_LRHEADER 16
+#define XLOG_REG_TYPE_UNMOUNT 17
+#define XLOG_REG_TYPE_COMMIT 18
+#define XLOG_REG_TYPE_TRANSHDR 19
+#define XLOG_REG_TYPE_ICREATE 20
+#define XLOG_REG_TYPE_RUI_FORMAT 21
+#define XLOG_REG_TYPE_RUD_FORMAT 22
+#define XLOG_REG_TYPE_CUI_FORMAT 23
+#define XLOG_REG_TYPE_CUD_FORMAT 24
+#define XLOG_REG_TYPE_BUI_FORMAT 25
+#define XLOG_REG_TYPE_BUD_FORMAT 26
+#define XLOG_REG_TYPE_ATTRI_FORMAT 27
+#define XLOG_REG_TYPE_ATTRD_FORMAT 28
+#define XLOG_REG_TYPE_ATTR_NAME 29
+#define XLOG_REG_TYPE_ATTR_VALUE 30
+#define XLOG_REG_TYPE_XMI_FORMAT 31
+#define XLOG_REG_TYPE_XMD_FORMAT 32
+#define XLOG_REG_TYPE_ATTR_NEWNAME 33
+#define XLOG_REG_TYPE_ATTR_NEWVALUE 34
+#define XLOG_REG_TYPE_MAX 34
+
#define XFS_LOG_VEC_ORDERED (-1)
/*
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 17/17] xfs: move struct xfs_log_vec to xfs_log_priv.h
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (15 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 16/17] xfs: move the XLOG_REG_ constants out of xfs_log_format.h Christoph Hellwig
@ 2025-06-10 5:15 ` Christoph Hellwig
2025-06-17 22:35 ` cleanup log item formatting Dave Chinner
` (2 subsequent siblings)
19 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 5:15 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
The log_vec is a private type for the log/CIL code and should not be
exposed to anything else.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.h | 12 ------------
fs/xfs/xfs_log_priv.h | 12 ++++++++++++
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index c4930e925fed..0f23812b0b31 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -9,18 +9,6 @@
struct xlog_format_buf;
struct xfs_cil_ctx;
-struct xfs_log_vec {
- struct list_head lv_list; /* CIL lv chain ptrs */
- uint32_t lv_order_id; /* chain ordering info */
- int lv_niovecs; /* number of iovecs in lv */
- struct xfs_log_iovec *lv_iovecp; /* iovec array */
- struct xfs_log_item *lv_item; /* owner */
- char *lv_buf; /* formatted buffer */
- int lv_bytes; /* accounted space in buffer */
- int lv_buf_used; /* buffer space used so far */
- int lv_alloc_size; /* size of allocated lv */
-};
-
/* Region types for iovec's i_type */
#define XLOG_REG_TYPE_BFORMAT 1
#define XLOG_REG_TYPE_BCHUNK 2
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 17bbe69655a4..1c72ce78594c 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -28,6 +28,18 @@ struct xfs_log_iovec {
uint16_t i_type; /* type of region (debug only) */
};
+struct xfs_log_vec {
+ struct list_head lv_list; /* CIL lv chain ptrs */
+ uint32_t lv_order_id; /* chain ordering info */
+ int lv_niovecs; /* number of iovecs in lv */
+ struct xfs_log_iovec *lv_iovecp; /* iovec array */
+ struct xfs_log_item *lv_item; /* owner */
+ char *lv_buf; /* formatted buffer */
+ int lv_bytes; /* accounted space in buffer */
+ int lv_buf_used; /* buffer space used so far */
+ int lv_alloc_size; /* size of allocated lv */
+};
+
/*
* get client id from packed copy.
*
--
2.47.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 01/17] xfs: don't pass the old lv to xfs_cil_prepare_item
2025-06-10 5:14 ` [PATCH 01/17] xfs: don't pass the old lv to xfs_cil_prepare_item Christoph Hellwig
@ 2025-06-10 7:20 ` Carlos Maiolino
0 siblings, 0 replies; 31+ messages in thread
From: Carlos Maiolino @ 2025-06-10 7:20 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Tue, Jun 10, 2025 at 07:14:58AM +0200, Christoph Hellwig wrote:
> By the time xfs_cil_prepare_item is called, the old lv is still pointed
> to by the log item. Take it from there instead of spreading the old lv
> logic over xlog_cil_insert_format_items and xfs_cil_prepare_item.
Looks Ok.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/xfs_log_cil.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> index f66d2d430e4f..c3db01b2ea47 100644
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -370,8 +370,8 @@ xlog_cil_alloc_shadow_bufs(
> STATIC void
> xfs_cil_prepare_item(
> struct xlog *log,
> + struct xfs_log_item *lip,
> struct xfs_log_vec *lv,
> - struct xfs_log_vec *old_lv,
> int *diff_len)
> {
> /* Account for the new LV being passed in */
> @@ -381,19 +381,19 @@ xfs_cil_prepare_item(
> /*
> * If there is no old LV, this is the first time we've seen the item in
> * this CIL context and so we need to pin it. If we are replacing the
> - * old_lv, then remove the space it accounts for and make it the shadow
> + * old lv, then remove the space it accounts for and make it the shadow
> * buffer for later freeing. In both cases we are now switching to the
> * shadow buffer, so update the pointer to it appropriately.
> */
> - if (!old_lv) {
> + if (!lip->li_lv) {
> if (lv->lv_item->li_ops->iop_pin)
> lv->lv_item->li_ops->iop_pin(lv->lv_item);
> lv->lv_item->li_lv_shadow = NULL;
> - } else if (old_lv != lv) {
> + } else if (lip->li_lv != lv) {
> ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);
>
> - *diff_len -= old_lv->lv_bytes;
> - lv->lv_item->li_lv_shadow = old_lv;
> + *diff_len -= lip->li_lv->lv_bytes;
> + lv->lv_item->li_lv_shadow = lip->li_lv;
> }
>
> /* attach new log vector to log item */
> @@ -453,7 +453,6 @@ xlog_cil_insert_format_items(
>
> list_for_each_entry(lip, &tp->t_items, li_trans) {
> struct xfs_log_vec *lv;
> - struct xfs_log_vec *old_lv = NULL;
> struct xfs_log_vec *shadow;
> bool ordered = false;
>
> @@ -474,7 +473,6 @@ xlog_cil_insert_format_items(
> continue;
>
> /* compare to existing item size */
> - old_lv = lip->li_lv;
> if (lip->li_lv && shadow->lv_size <= lip->li_lv->lv_size) {
> /* same or smaller, optimise common overwrite case */
> lv = lip->li_lv;
> @@ -510,7 +508,7 @@ xlog_cil_insert_format_items(
> ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
> lip->li_ops->iop_format(lip, lv);
> insert:
> - xfs_cil_prepare_item(log, lv, old_lv, diff_len);
> + xfs_cil_prepare_item(log, lip, lv, diff_len);
> }
> }
>
> --
> 2.47.2
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items
2025-06-10 5:14 ` [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items Christoph Hellwig
@ 2025-06-10 7:56 ` Carlos Maiolino
2025-06-10 13:32 ` Christoph Hellwig
0 siblings, 1 reply; 31+ messages in thread
From: Carlos Maiolino @ 2025-06-10 7:56 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Tue, Jun 10, 2025 at 07:14:59AM +0200, Christoph Hellwig wrote:
> Split out handling of ordered items into a single branch in
> xlog_cil_insert_format_items so that the rest of the code becomes more
> clear.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/xfs_log_cil.c | 31 +++++++++++++------------------
> 1 file changed, 13 insertions(+), 18 deletions(-)
>
> diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> index c3db01b2ea47..81b6780e0afc 100644
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -452,9 +452,8 @@ xlog_cil_insert_format_items(
> }
>
> list_for_each_entry(lip, &tp->t_items, li_trans) {
> - struct xfs_log_vec *lv;
> - struct xfs_log_vec *shadow;
> - bool ordered = false;
> + struct xfs_log_vec *lv = lip->li_lv;
> + struct xfs_log_vec *shadow = lip->li_lv_shadow;
>
> /* Skip items which aren't dirty in this transaction. */
> if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
> @@ -464,21 +463,23 @@ xlog_cil_insert_format_items(
> * The formatting size information is already attached to
> * the shadow lv on the log item.
> */
> - shadow = lip->li_lv_shadow;
> - if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED)
> - ordered = true;
> + if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED) {
> + if (!lv) {
> + lv = shadow;
> + lv->lv_item = lip;
> + }
> + ASSERT(shadow->lv_size == lv->lv_size);
This assert is kind of confusing me. if we have an
ORDERED vector here, couldn't we still have a shadow
size smaller than the current vector?
> + xfs_cil_prepare_item(log, lip, lv, diff_len);
> + continue;
> + }
>
> /* Skip items that do not have any vectors for writing */
> - if (!shadow->lv_niovecs && !ordered)
> + if (!shadow->lv_niovecs)
> continue;
>
> /* compare to existing item size */
> - if (lip->li_lv && shadow->lv_size <= lip->li_lv->lv_size) {
> + if (lv && shadow->lv_size <= lv->lv_size) {
> /* same or smaller, optimise common overwrite case */
> - lv = lip->li_lv;
> -
> - if (ordered)
> - goto insert;
>
> /*
> * set the item up as though it is a new insertion so
> @@ -498,16 +499,10 @@ xlog_cil_insert_format_items(
> /* switch to shadow buffer! */
> lv = shadow;
> lv->lv_item = lip;
> - if (ordered) {
> - /* track as an ordered logvec */
> - ASSERT(lip->li_lv == NULL);
> - goto insert;
> - }
> }
>
> ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
> lip->li_ops->iop_format(lip, lv);
> -insert:
> xfs_cil_prepare_item(log, lip, lv, diff_len);
> }
> }
> --
> 2.47.2
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 03/17] xfs: use better names for size members in xfs_log_vec
2025-06-10 5:15 ` [PATCH 03/17] xfs: use better names for size members in xfs_log_vec Christoph Hellwig
@ 2025-06-10 9:07 ` Carlos Maiolino
0 siblings, 0 replies; 31+ messages in thread
From: Carlos Maiolino @ 2025-06-10 9:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Tue, Jun 10, 2025 at 07:15:00AM +0200, Christoph Hellwig wrote:
> The lv_size member counts the size of the entire allocation, rename it
> to lv_alloc_size to make that clear.
>
> The lv_buf_size member tracks how much of lv_buf has been used up
> to format the log item, rename it to lv_buf_used to make that more
Just a nit. lv_buf_len. Otherwise looks good to me.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> clear.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/xfs_log.c | 10 +++++-----
> fs/xfs/xfs_log.h | 9 +++++----
> fs/xfs/xfs_log_cil.c | 30 +++++++++++++++---------------
> 3 files changed, 25 insertions(+), 24 deletions(-)
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 793468b4d30d..3179923a68d4 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -109,14 +109,14 @@ xlog_prepare_iovec(
> vec = &lv->lv_iovecp[0];
> }
>
> - len = lv->lv_buf_len + sizeof(struct xlog_op_header);
> + len = lv->lv_buf_used + sizeof(struct xlog_op_header);
> if (!IS_ALIGNED(len, sizeof(uint64_t))) {
> - lv->lv_buf_len = round_up(len, sizeof(uint64_t)) -
> + lv->lv_buf_used = round_up(len, sizeof(uint64_t)) -
> sizeof(struct xlog_op_header);
> }
>
> vec->i_type = type;
> - vec->i_addr = lv->lv_buf + lv->lv_buf_len;
> + vec->i_addr = lv->lv_buf + lv->lv_buf_used;
>
> oph = vec->i_addr;
> oph->oh_clientid = XFS_TRANSACTION;
> @@ -1931,9 +1931,9 @@ xlog_print_trans(
> if (!lv)
> continue;
> xfs_warn(mp, " niovecs = %d", lv->lv_niovecs);
> - xfs_warn(mp, " size = %d", lv->lv_size);
> + xfs_warn(mp, " alloc_size = %d", lv->lv_alloc_size);
> xfs_warn(mp, " bytes = %d", lv->lv_bytes);
> - xfs_warn(mp, " buf len = %d", lv->lv_buf_len);
> + xfs_warn(mp, " buf used= %d", lv->lv_buf_used);
>
> /* dump each iovec for the log item */
> vec = lv->lv_iovecp;
> diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
> index 13455854365f..f239fce4f260 100644
> --- a/fs/xfs/xfs_log.h
> +++ b/fs/xfs/xfs_log.h
> @@ -16,8 +16,8 @@ struct xfs_log_vec {
> struct xfs_log_item *lv_item; /* owner */
> char *lv_buf; /* formatted buffer */
> int lv_bytes; /* accounted space in buffer */
> - int lv_buf_len; /* aligned size of buffer */
> - int lv_size; /* size of allocated lv */
> + int lv_buf_used; /* buffer space used so far */
> + int lv_alloc_size; /* size of allocated lv */
> };
>
> #define XFS_LOG_VEC_ORDERED (-1)
> @@ -64,12 +64,13 @@ xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec,
> oph->oh_len = cpu_to_be32(len);
>
> len += sizeof(struct xlog_op_header);
> - lv->lv_buf_len += len;
> + lv->lv_buf_used += len;
> lv->lv_bytes += len;
> vec->i_len = len;
>
> /* Catch buffer overruns */
> - ASSERT((void *)lv->lv_buf + lv->lv_bytes <= (void *)lv + lv->lv_size);
> + ASSERT((void *)lv->lv_buf + lv->lv_bytes <=
> + (void *)lv + lv->lv_alloc_size);
> }
>
> /*
> diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> index 81b6780e0afc..985f27a5b4ba 100644
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -275,7 +275,7 @@ xlog_cil_alloc_shadow_bufs(
> struct xfs_log_vec *lv;
> int niovecs = 0;
> int nbytes = 0;
> - int buf_size;
> + int alloc_size;
> bool ordered = false;
>
> /* Skip items which aren't dirty in this transaction. */
> @@ -316,14 +316,14 @@ xlog_cil_alloc_shadow_bufs(
> * that space to ensure we can align it appropriately and not
> * overrun the buffer.
> */
> - buf_size = nbytes + xlog_cil_iovec_space(niovecs);
> + alloc_size = nbytes + xlog_cil_iovec_space(niovecs);
>
> /*
> * if we have no shadow buffer, or it is too small, we need to
> * reallocate it.
> */
> if (!lip->li_lv_shadow ||
> - buf_size > lip->li_lv_shadow->lv_size) {
> + alloc_size > lip->li_lv_shadow->lv_alloc_size) {
> /*
> * We free and allocate here as a realloc would copy
> * unnecessary data. We don't use kvzalloc() for the
> @@ -332,15 +332,15 @@ xlog_cil_alloc_shadow_bufs(
> * storage.
> */
> kvfree(lip->li_lv_shadow);
> - lv = xlog_kvmalloc(buf_size);
> + lv = xlog_kvmalloc(alloc_size);
>
> memset(lv, 0, xlog_cil_iovec_space(niovecs));
>
> INIT_LIST_HEAD(&lv->lv_list);
> lv->lv_item = lip;
> - lv->lv_size = buf_size;
> + lv->lv_alloc_size = alloc_size;
> if (ordered)
> - lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
> + lv->lv_buf_used = XFS_LOG_VEC_ORDERED;
> else
> lv->lv_iovecp = (struct xfs_log_iovec *)&lv[1];
> lip->li_lv_shadow = lv;
> @@ -348,9 +348,9 @@ xlog_cil_alloc_shadow_bufs(
> /* same or smaller, optimise common overwrite case */
> lv = lip->li_lv_shadow;
> if (ordered)
> - lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
> + lv->lv_buf_used = XFS_LOG_VEC_ORDERED;
> else
> - lv->lv_buf_len = 0;
> + lv->lv_buf_used = 0;
> lv->lv_bytes = 0;
> }
>
> @@ -375,7 +375,7 @@ xfs_cil_prepare_item(
> int *diff_len)
> {
> /* Account for the new LV being passed in */
> - if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
> + if (lv->lv_buf_used != XFS_LOG_VEC_ORDERED)
> *diff_len += lv->lv_bytes;
>
> /*
> @@ -390,7 +390,7 @@ xfs_cil_prepare_item(
> lv->lv_item->li_ops->iop_pin(lv->lv_item);
> lv->lv_item->li_lv_shadow = NULL;
> } else if (lip->li_lv != lv) {
> - ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);
> + ASSERT(lv->lv_buf_used != XFS_LOG_VEC_ORDERED);
>
> *diff_len -= lip->li_lv->lv_bytes;
> lv->lv_item->li_lv_shadow = lip->li_lv;
> @@ -463,12 +463,12 @@ xlog_cil_insert_format_items(
> * The formatting size information is already attached to
> * the shadow lv on the log item.
> */
> - if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED) {
> + if (shadow->lv_buf_used == XFS_LOG_VEC_ORDERED) {
> if (!lv) {
> lv = shadow;
> lv->lv_item = lip;
> }
> - ASSERT(shadow->lv_size == lv->lv_size);
> + ASSERT(shadow->lv_alloc_size == lv->lv_alloc_size);
> xfs_cil_prepare_item(log, lip, lv, diff_len);
> continue;
> }
> @@ -478,7 +478,7 @@ xlog_cil_insert_format_items(
> continue;
>
> /* compare to existing item size */
> - if (lv && shadow->lv_size <= lv->lv_size) {
> + if (lv && shadow->lv_alloc_size <= lv->lv_alloc_size) {
> /* same or smaller, optimise common overwrite case */
>
> /*
> @@ -491,7 +491,7 @@ xlog_cil_insert_format_items(
> lv->lv_niovecs = shadow->lv_niovecs;
>
> /* reset the lv buffer information for new formatting */
> - lv->lv_buf_len = 0;
> + lv->lv_buf_used = 0;
> lv->lv_bytes = 0;
> lv->lv_buf = (char *)lv +
> xlog_cil_iovec_space(lv->lv_niovecs);
> @@ -1236,7 +1236,7 @@ xlog_cil_build_lv_chain(
> lv->lv_order_id = item->li_order_id;
>
> /* we don't write ordered log vectors */
> - if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
> + if (lv->lv_buf_used != XFS_LOG_VEC_ORDERED)
> *num_bytes += lv->lv_bytes;
> *num_iovecs += lv->lv_niovecs;
> list_add_tail(&lv->lv_list, &ctx->lv_chain);
> --
> 2.47.2
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 04/17] xfs: don't use a xfs_log_iovec for attr_item names and values
2025-06-10 5:15 ` [PATCH 04/17] xfs: don't use a xfs_log_iovec for attr_item names and values Christoph Hellwig
@ 2025-06-10 9:17 ` Carlos Maiolino
2025-06-10 13:33 ` Christoph Hellwig
0 siblings, 1 reply; 31+ messages in thread
From: Carlos Maiolino @ 2025-06-10 9:17 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Tue, Jun 10, 2025 at 07:15:01AM +0200, Christoph Hellwig wrote:
> These buffers are not directly logged, just use a kvec and remove the
> xlog_copy_from_iovec helper only used here.
This looks correct, I'm not much sure if using a kvec here is ok, so I'll rely
on other reviewers regarding this. So take my review more related to code
correctness.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/xfs_attr_item.c | 111 +++++++++++++++++++++--------------------
> fs/xfs/xfs_attr_item.h | 8 +--
> fs/xfs/xfs_log.h | 7 ---
> 3 files changed, 60 insertions(+), 66 deletions(-)
>
> diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
> index f683b7a9323f..2b3dde2eec9c 100644
> --- a/fs/xfs/xfs_attr_item.c
> +++ b/fs/xfs/xfs_attr_item.c
> @@ -91,41 +91,37 @@ xfs_attri_log_nameval_alloc(
> name_len + new_name_len + value_len +
> new_value_len);
>
> - nv->name.i_addr = nv + 1;
> - nv->name.i_len = name_len;
> - nv->name.i_type = XLOG_REG_TYPE_ATTR_NAME;
> - memcpy(nv->name.i_addr, name, name_len);
> + nv->name.iov_base = nv + 1;
> + nv->name.iov_len = name_len;
> + memcpy(nv->name.iov_base, name, name_len);
>
> if (new_name_len) {
> - nv->new_name.i_addr = nv->name.i_addr + name_len;
> - nv->new_name.i_len = new_name_len;
> - memcpy(nv->new_name.i_addr, new_name, new_name_len);
> + nv->new_name.iov_base = nv->name.iov_base + name_len;
> + nv->new_name.iov_len = new_name_len;
> + memcpy(nv->new_name.iov_base, new_name, new_name_len);
> } else {
> - nv->new_name.i_addr = NULL;
> - nv->new_name.i_len = 0;
> + nv->new_name.iov_base = NULL;
> + nv->new_name.iov_len = 0;
> }
> - nv->new_name.i_type = XLOG_REG_TYPE_ATTR_NEWNAME;
>
> if (value_len) {
> - nv->value.i_addr = nv->name.i_addr + name_len + new_name_len;
> - nv->value.i_len = value_len;
> - memcpy(nv->value.i_addr, value, value_len);
> + nv->value.iov_base = nv->name.iov_base + name_len + new_name_len;
> + nv->value.iov_len = value_len;
> + memcpy(nv->value.iov_base, value, value_len);
> } else {
> - nv->value.i_addr = NULL;
> - nv->value.i_len = 0;
> + nv->value.iov_base = NULL;
> + nv->value.iov_len = 0;
> }
> - nv->value.i_type = XLOG_REG_TYPE_ATTR_VALUE;
>
> if (new_value_len) {
> - nv->new_value.i_addr = nv->name.i_addr + name_len +
> + nv->new_value.iov_base = nv->name.iov_base + name_len +
> new_name_len + value_len;
> - nv->new_value.i_len = new_value_len;
> - memcpy(nv->new_value.i_addr, new_value, new_value_len);
> + nv->new_value.iov_len = new_value_len;
> + memcpy(nv->new_value.iov_base, new_value, new_value_len);
> } else {
> - nv->new_value.i_addr = NULL;
> - nv->new_value.i_len = 0;
> + nv->new_value.iov_base = NULL;
> + nv->new_value.iov_len = 0;
> }
> - nv->new_value.i_type = XLOG_REG_TYPE_ATTR_NEWVALUE;
>
> refcount_set(&nv->refcount, 1);
> return nv;
> @@ -170,21 +166,21 @@ xfs_attri_item_size(
>
> *nvecs += 2;
> *nbytes += sizeof(struct xfs_attri_log_format) +
> - xlog_calc_iovec_len(nv->name.i_len);
> + xlog_calc_iovec_len(nv->name.iov_len);
>
> - if (nv->new_name.i_len) {
> + if (nv->new_name.iov_len) {
> *nvecs += 1;
> - *nbytes += xlog_calc_iovec_len(nv->new_name.i_len);
> + *nbytes += xlog_calc_iovec_len(nv->new_name.iov_len);
> }
>
> - if (nv->value.i_len) {
> + if (nv->value.iov_len) {
> *nvecs += 1;
> - *nbytes += xlog_calc_iovec_len(nv->value.i_len);
> + *nbytes += xlog_calc_iovec_len(nv->value.iov_len);
> }
>
> - if (nv->new_value.i_len) {
> + if (nv->new_value.iov_len) {
> *nvecs += 1;
> - *nbytes += xlog_calc_iovec_len(nv->new_value.i_len);
> + *nbytes += xlog_calc_iovec_len(nv->new_value.iov_len);
> }
> }
>
> @@ -212,31 +208,36 @@ xfs_attri_item_format(
> * the log recovery.
> */
>
> - ASSERT(nv->name.i_len > 0);
> + ASSERT(nv->name.iov_len > 0);
> attrip->attri_format.alfi_size++;
>
> - if (nv->new_name.i_len > 0)
> + if (nv->new_name.iov_len > 0)
> attrip->attri_format.alfi_size++;
>
> - if (nv->value.i_len > 0)
> + if (nv->value.iov_len > 0)
> attrip->attri_format.alfi_size++;
>
> - if (nv->new_value.i_len > 0)
> + if (nv->new_value.iov_len > 0)
> attrip->attri_format.alfi_size++;
>
> xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRI_FORMAT,
> &attrip->attri_format,
> sizeof(struct xfs_attri_log_format));
> - xlog_copy_from_iovec(lv, &vecp, &nv->name);
>
> - if (nv->new_name.i_len > 0)
> - xlog_copy_from_iovec(lv, &vecp, &nv->new_name);
> + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NAME, nv->name.iov_base,
> + nv->name.iov_len);
>
> - if (nv->value.i_len > 0)
> - xlog_copy_from_iovec(lv, &vecp, &nv->value);
> + if (nv->new_name.iov_len > 0)
> + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWNAME,
> + nv->new_name.iov_base, nv->new_name.iov_len);
>
> - if (nv->new_value.i_len > 0)
> - xlog_copy_from_iovec(lv, &vecp, &nv->new_value);
> + if (nv->value.iov_len > 0)
> + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_VALUE,
> + nv->value.iov_base, nv->value.iov_len);
> +
> + if (nv->new_value.iov_len > 0)
> + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWVALUE,
> + nv->new_value.iov_base, nv->new_value.iov_len);
> }
>
> /*
> @@ -383,22 +384,22 @@ xfs_attr_log_item(
> attrp->alfi_ino = args->dp->i_ino;
> ASSERT(!(attr->xattri_op_flags & ~XFS_ATTRI_OP_FLAGS_TYPE_MASK));
> attrp->alfi_op_flags = attr->xattri_op_flags;
> - attrp->alfi_value_len = nv->value.i_len;
> + attrp->alfi_value_len = nv->value.iov_len;
>
> switch (xfs_attr_log_item_op(attrp)) {
> case XFS_ATTRI_OP_FLAGS_PPTR_REPLACE:
> - ASSERT(nv->value.i_len == nv->new_value.i_len);
> + ASSERT(nv->value.iov_len == nv->new_value.iov_len);
>
> attrp->alfi_igen = VFS_I(args->dp)->i_generation;
> - attrp->alfi_old_name_len = nv->name.i_len;
> - attrp->alfi_new_name_len = nv->new_name.i_len;
> + attrp->alfi_old_name_len = nv->name.iov_len;
> + attrp->alfi_new_name_len = nv->new_name.iov_len;
> break;
> case XFS_ATTRI_OP_FLAGS_PPTR_REMOVE:
> case XFS_ATTRI_OP_FLAGS_PPTR_SET:
> attrp->alfi_igen = VFS_I(args->dp)->i_generation;
> fallthrough;
> default:
> - attrp->alfi_name_len = nv->name.i_len;
> + attrp->alfi_name_len = nv->name.iov_len;
> break;
> }
>
> @@ -690,14 +691,14 @@ xfs_attri_recover_work(
> args->dp = ip;
> args->geo = mp->m_attr_geo;
> args->whichfork = XFS_ATTR_FORK;
> - args->name = nv->name.i_addr;
> - args->namelen = nv->name.i_len;
> - args->new_name = nv->new_name.i_addr;
> - args->new_namelen = nv->new_name.i_len;
> - args->value = nv->value.i_addr;
> - args->valuelen = nv->value.i_len;
> - args->new_value = nv->new_value.i_addr;
> - args->new_valuelen = nv->new_value.i_len;
> + args->name = nv->name.iov_base;
> + args->namelen = nv->name.iov_len;
> + args->new_name = nv->new_name.iov_base;
> + args->new_namelen = nv->new_name.iov_len;
> + args->value = nv->value.iov_base;
> + args->valuelen = nv->value.iov_len;
> + args->new_value = nv->new_value.iov_base;
> + args->new_valuelen = nv->new_value.iov_len;
> args->attr_filter = attrp->alfi_attr_filter & XFS_ATTRI_FILTER_MASK;
> args->op_flags = XFS_DA_OP_RECOVERY | XFS_DA_OP_OKNOENT |
> XFS_DA_OP_LOGGED;
> @@ -754,8 +755,8 @@ xfs_attr_recover_work(
> */
> attrp = &attrip->attri_format;
> if (!xfs_attri_validate(mp, attrp) ||
> - !xfs_attr_namecheck(attrp->alfi_attr_filter, nv->name.i_addr,
> - nv->name.i_len))
> + !xfs_attr_namecheck(attrp->alfi_attr_filter, nv->name.iov_base,
> + nv->name.iov_len))
> return -EFSCORRUPTED;
>
> attr = xfs_attri_recover_work(mp, dfp, attrp, &ip, nv);
> diff --git a/fs/xfs/xfs_attr_item.h b/fs/xfs/xfs_attr_item.h
> index e74128cbb722..d108a11b55ae 100644
> --- a/fs/xfs/xfs_attr_item.h
> +++ b/fs/xfs/xfs_attr_item.h
> @@ -12,10 +12,10 @@ struct xfs_mount;
> struct kmem_zone;
>
> struct xfs_attri_log_nameval {
> - struct xfs_log_iovec name;
> - struct xfs_log_iovec new_name; /* PPTR_REPLACE only */
> - struct xfs_log_iovec value;
> - struct xfs_log_iovec new_value; /* PPTR_REPLACE only */
> + struct kvec name;
> + struct kvec new_name; /* PPTR_REPLACE only */
> + struct kvec value;
> + struct kvec new_value; /* PPTR_REPLACE only */
> refcount_t refcount;
>
> /* name and value follow the end of this struct */
> diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
> index f239fce4f260..af6daf4f6792 100644
> --- a/fs/xfs/xfs_log.h
> +++ b/fs/xfs/xfs_log.h
> @@ -88,13 +88,6 @@ xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
> return buf;
> }
>
> -static inline void *
> -xlog_copy_from_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
> - const struct xfs_log_iovec *src)
> -{
> - return xlog_copy_iovec(lv, vecp, src->i_type, src->i_addr, src->i_len);
> -}
> -
> /*
> * By comparing each component, we don't have to worry about extra
> * endian issues in treating two 32 bit numbers as one 64 bit number
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items
2025-06-10 7:56 ` Carlos Maiolino
@ 2025-06-10 13:32 ` Christoph Hellwig
2025-06-10 14:00 ` Carlos Maiolino
0 siblings, 1 reply; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 13:32 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: Christoph Hellwig, linux-xfs
On Tue, Jun 10, 2025 at 09:56:04AM +0200, Carlos Maiolino wrote:
> > - if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED)
> > - ordered = true;
> > + if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED) {
> > + if (!lv) {
> > + lv = shadow;
> > + lv->lv_item = lip;
> > + }
> > + ASSERT(shadow->lv_size == lv->lv_size);
>
> This assert is kind of confusing me. if we have an
> ORDERED vector here, couldn't we still have a shadow
> size smaller than the current vector?
The size of ordered items never changes, it's always the same constant
overhead.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 04/17] xfs: don't use a xfs_log_iovec for attr_item names and values
2025-06-10 9:17 ` Carlos Maiolino
@ 2025-06-10 13:33 ` Christoph Hellwig
0 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-10 13:33 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: Christoph Hellwig, linux-xfs
On Tue, Jun 10, 2025 at 11:17:40AM +0200, Carlos Maiolino wrote:
> On Tue, Jun 10, 2025 at 07:15:01AM +0200, Christoph Hellwig wrote:
> > These buffers are not directly logged, just use a kvec and remove the
> > xlog_copy_from_iovec helper only used here.
>
> This looks correct, I'm not much sure if using a kvec here is ok, so I'll rely
> on other reviewers regarding this. So take my review more related to code
> correctness.
The kvec is just the non-__user pointer of the iovec and can be used
everywhere. For userspace we'll need to add a trivial stub definition.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items
2025-06-10 13:32 ` Christoph Hellwig
@ 2025-06-10 14:00 ` Carlos Maiolino
0 siblings, 0 replies; 31+ messages in thread
From: Carlos Maiolino @ 2025-06-10 14:00 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Tue, Jun 10, 2025 at 03:32:35PM +0200, Christoph Hellwig wrote:
> On Tue, Jun 10, 2025 at 09:56:04AM +0200, Carlos Maiolino wrote:
> > > - if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED)
> > > - ordered = true;
> > > + if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED) {
> > > + if (!lv) {
> > > + lv = shadow;
> > > + lv->lv_item = lip;
> > > + }
> > > + ASSERT(shadow->lv_size == lv->lv_size);
> >
> > This assert is kind of confusing me. if we have an
> > ORDERED vector here, couldn't we still have a shadow
> > size smaller than the current vector?
>
> The size of ordered items never changes, it's always the same constant
> overhead.
>
Fair enough, thanks:
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 05/17] xfs: don't use a xfs_log_iovec for ri_buf in log recovery
2025-06-10 5:15 ` [PATCH 05/17] xfs: don't use a xfs_log_iovec for ri_buf in log recovery Christoph Hellwig
@ 2025-06-11 10:33 ` Carlos Maiolino
0 siblings, 0 replies; 31+ messages in thread
From: Carlos Maiolino @ 2025-06-11 10:33 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Tue, Jun 10, 2025 at 07:15:02AM +0200, Christoph Hellwig wrote:
> ri_buf just holds a pointer/len pair and is not a log iovec used for
> writing to the log. Switch to use a kvec instead.
>
Looks good.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/libxfs/xfs_log_recover.h | 4 +--
> fs/xfs/xfs_attr_item.c | 32 +++++++++---------
> fs/xfs/xfs_bmap_item.c | 18 +++++-----
> fs/xfs/xfs_buf_item.c | 8 ++---
> fs/xfs/xfs_buf_item.h | 2 +-
> fs/xfs/xfs_buf_item_recover.c | 38 ++++++++++-----------
> fs/xfs/xfs_dquot_item_recover.c | 20 +++++------
> fs/xfs/xfs_exchmaps_item.c | 8 ++---
> fs/xfs/xfs_extfree_item.c | 59 +++++++++++++++++----------------
> fs/xfs/xfs_icreate_item.c | 2 +-
> fs/xfs/xfs_inode_item.c | 6 ++--
> fs/xfs/xfs_inode_item.h | 4 +--
> fs/xfs/xfs_inode_item_recover.c | 26 +++++++--------
> fs/xfs/xfs_log_recover.c | 16 ++++-----
> fs/xfs/xfs_refcount_item.c | 34 +++++++++----------
> fs/xfs/xfs_rmap_item.c | 34 +++++++++----------
> fs/xfs/xfs_trans.h | 1 -
> 17 files changed, 157 insertions(+), 155 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h
> index 66c7916fb5cd..95de23095030 100644
> --- a/fs/xfs/libxfs/xfs_log_recover.h
> +++ b/fs/xfs/libxfs/xfs_log_recover.h
> @@ -104,7 +104,7 @@ struct xlog_recover_item {
> struct list_head ri_list;
> int ri_cnt; /* count of regions found */
> int ri_total; /* total regions */
> - struct xfs_log_iovec *ri_buf; /* ptr to regions buffer */
> + struct kvec *ri_buf; /* ptr to regions buffer */
> const struct xlog_recover_item_ops *ri_ops;
> };
>
> @@ -117,7 +117,7 @@ struct xlog_recover {
> struct list_head r_itemq; /* q for items */
> };
>
> -#define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr)
> +#define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].iov_base)
>
> #define XLOG_RECOVER_CRCPASS 0
> #define XLOG_RECOVER_PASS1 1
> diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
> index 2b3dde2eec9c..bc970aa6832f 100644
> --- a/fs/xfs/xfs_attr_item.c
> +++ b/fs/xfs/xfs_attr_item.c
> @@ -954,50 +954,50 @@ static inline void *
> xfs_attri_validate_name_iovec(
> struct xfs_mount *mp,
> struct xfs_attri_log_format *attri_formatp,
> - const struct xfs_log_iovec *iovec,
> + const struct kvec *iovec,
> unsigned int name_len)
> {
> - if (iovec->i_len != xlog_calc_iovec_len(name_len)) {
> + if (iovec->iov_len != xlog_calc_iovec_len(name_len)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> attri_formatp, sizeof(*attri_formatp));
> return NULL;
> }
>
> - if (!xfs_attr_namecheck(attri_formatp->alfi_attr_filter, iovec->i_addr,
> + if (!xfs_attr_namecheck(attri_formatp->alfi_attr_filter, iovec->iov_base,
> name_len)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> attri_formatp, sizeof(*attri_formatp));
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - iovec->i_addr, iovec->i_len);
> + iovec->iov_base, iovec->iov_len);
> return NULL;
> }
>
> - return iovec->i_addr;
> + return iovec->iov_base;
> }
>
> static inline void *
> xfs_attri_validate_value_iovec(
> struct xfs_mount *mp,
> struct xfs_attri_log_format *attri_formatp,
> - const struct xfs_log_iovec *iovec,
> + const struct kvec *iovec,
> unsigned int value_len)
> {
> - if (iovec->i_len != xlog_calc_iovec_len(value_len)) {
> + if (iovec->iov_len != xlog_calc_iovec_len(value_len)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> attri_formatp, sizeof(*attri_formatp));
> return NULL;
> }
>
> if ((attri_formatp->alfi_attr_filter & XFS_ATTR_PARENT) &&
> - !xfs_parent_valuecheck(mp, iovec->i_addr, value_len)) {
> + !xfs_parent_valuecheck(mp, iovec->iov_base, value_len)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> attri_formatp, sizeof(*attri_formatp));
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - iovec->i_addr, iovec->i_len);
> + iovec->iov_base, iovec->iov_len);
> return NULL;
> }
>
> - return iovec->i_addr;
> + return iovec->iov_base;
> }
>
> STATIC int
> @@ -1024,13 +1024,13 @@ xlog_recover_attri_commit_pass2(
>
> /* Validate xfs_attri_log_format before the large memory allocation */
> len = sizeof(struct xfs_attri_log_format);
> - if (item->ri_buf[i].i_len != len) {
> + if (item->ri_buf[i].iov_len != len) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> - attri_formatp = item->ri_buf[i].i_addr;
> + attri_formatp = item->ri_buf[i].iov_base;
> if (!xfs_attri_validate(mp, attri_formatp)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> attri_formatp, len);
> @@ -1219,10 +1219,10 @@ xlog_recover_attrd_commit_pass2(
> {
> struct xfs_attrd_log_format *attrd_formatp;
>
> - attrd_formatp = item->ri_buf[0].i_addr;
> - if (item->ri_buf[0].i_len != sizeof(struct xfs_attrd_log_format)) {
> + attrd_formatp = item->ri_buf[0].iov_base;
> + if (item->ri_buf[0].iov_len != sizeof(struct xfs_attrd_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
> index 646c515ee355..80f0c4bcc483 100644
> --- a/fs/xfs/xfs_bmap_item.c
> +++ b/fs/xfs/xfs_bmap_item.c
> @@ -654,24 +654,24 @@ xlog_recover_bui_commit_pass2(
> struct xfs_bui_log_format *bui_formatp;
> size_t len;
>
> - bui_formatp = item->ri_buf[0].i_addr;
> + bui_formatp = item->ri_buf[0].iov_base;
>
> - if (item->ri_buf[0].i_len < xfs_bui_log_format_sizeof(0)) {
> + if (item->ri_buf[0].iov_len < xfs_bui_log_format_sizeof(0)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> if (bui_formatp->bui_nextents != XFS_BUI_MAX_FAST_EXTENTS) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> len = xfs_bui_log_format_sizeof(bui_formatp->bui_nextents);
> - if (item->ri_buf[0].i_len != len) {
> + if (item->ri_buf[0].iov_len != len) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -705,10 +705,10 @@ xlog_recover_bud_commit_pass2(
> {
> struct xfs_bud_log_format *bud_formatp;
>
> - bud_formatp = item->ri_buf[0].i_addr;
> - if (item->ri_buf[0].i_len != sizeof(struct xfs_bud_log_format)) {
> + bud_formatp = item->ri_buf[0].iov_base;
> + if (item->ri_buf[0].iov_len != sizeof(struct xfs_bud_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index 90139e0f3271..e0ce0975d399 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -35,16 +35,16 @@ static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip)
> /* Is this log iovec plausibly large enough to contain the buffer log format? */
> bool
> xfs_buf_log_check_iovec(
> - struct xfs_log_iovec *iovec)
> + struct kvec *iovec)
> {
> - struct xfs_buf_log_format *blfp = iovec->i_addr;
> + struct xfs_buf_log_format *blfp = iovec->iov_base;
> char *bmp_end;
> char *item_end;
>
> - if (offsetof(struct xfs_buf_log_format, blf_data_map) > iovec->i_len)
> + if (offsetof(struct xfs_buf_log_format, blf_data_map) > iovec->iov_len)
> return false;
>
> - item_end = (char *)iovec->i_addr + iovec->i_len;
> + item_end = (char *)iovec->iov_base + iovec->iov_len;
> bmp_end = (char *)&blfp->blf_data_map[blfp->blf_map_size];
> return bmp_end <= item_end;
> }
> diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h
> index e10e324cd245..26c7af1a211d 100644
> --- a/fs/xfs/xfs_buf_item.h
> +++ b/fs/xfs/xfs_buf_item.h
> @@ -62,7 +62,7 @@ static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
> }
> #endif /* CONFIG_XFS_QUOTA */
> void xfs_buf_iodone(struct xfs_buf *);
> -bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
> +bool xfs_buf_log_check_iovec(struct kvec *iovec);
>
> unsigned int xfs_buf_inval_log_space(unsigned int map_count,
> unsigned int blocksize);
> diff --git a/fs/xfs/xfs_buf_item_recover.c b/fs/xfs/xfs_buf_item_recover.c
> index d4c5cef5bc43..5d58e2ae4972 100644
> --- a/fs/xfs/xfs_buf_item_recover.c
> +++ b/fs/xfs/xfs_buf_item_recover.c
> @@ -159,7 +159,7 @@ STATIC enum xlog_recover_reorder
> xlog_recover_buf_reorder(
> struct xlog_recover_item *item)
> {
> - struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
> + struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
>
> if (buf_f->blf_flags & XFS_BLF_CANCEL)
> return XLOG_REORDER_CANCEL_LIST;
> @@ -173,7 +173,7 @@ xlog_recover_buf_ra_pass2(
> struct xlog *log,
> struct xlog_recover_item *item)
> {
> - struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
> + struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
>
> xlog_buf_readahead(log, buf_f->blf_blkno, buf_f->blf_len, NULL);
> }
> @@ -187,11 +187,11 @@ xlog_recover_buf_commit_pass1(
> struct xlog *log,
> struct xlog_recover_item *item)
> {
> - struct xfs_buf_log_format *bf = item->ri_buf[0].i_addr;
> + struct xfs_buf_log_format *bf = item->ri_buf[0].iov_base;
>
> if (!xfs_buf_log_check_iovec(&item->ri_buf[0])) {
> - xfs_err(log->l_mp, "bad buffer log item size (%d)",
> - item->ri_buf[0].i_len);
> + xfs_err(log->l_mp, "bad buffer log item size (%zd)",
> + item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -487,8 +487,8 @@ xlog_recover_do_reg_buffer(
> nbits = xfs_contig_bits(buf_f->blf_data_map,
> buf_f->blf_map_size, bit);
> ASSERT(nbits > 0);
> - ASSERT(item->ri_buf[i].i_addr != NULL);
> - ASSERT(item->ri_buf[i].i_len % XFS_BLF_CHUNK == 0);
> + ASSERT(item->ri_buf[i].iov_base != NULL);
> + ASSERT(item->ri_buf[i].iov_len % XFS_BLF_CHUNK == 0);
> ASSERT(BBTOB(bp->b_length) >=
> ((uint)bit << XFS_BLF_SHIFT) + (nbits << XFS_BLF_SHIFT));
>
> @@ -500,8 +500,8 @@ xlog_recover_do_reg_buffer(
> * the log. Hence we need to trim nbits back to the length of
> * the current region being copied out of the log.
> */
> - if (item->ri_buf[i].i_len < (nbits << XFS_BLF_SHIFT))
> - nbits = item->ri_buf[i].i_len >> XFS_BLF_SHIFT;
> + if (item->ri_buf[i].iov_len < (nbits << XFS_BLF_SHIFT))
> + nbits = item->ri_buf[i].iov_len >> XFS_BLF_SHIFT;
>
> /*
> * Do a sanity check if this is a dquot buffer. Just checking
> @@ -511,18 +511,18 @@ xlog_recover_do_reg_buffer(
> fa = NULL;
> if (buf_f->blf_flags &
> (XFS_BLF_UDQUOT_BUF|XFS_BLF_PDQUOT_BUF|XFS_BLF_GDQUOT_BUF)) {
> - if (item->ri_buf[i].i_addr == NULL) {
> + if (item->ri_buf[i].iov_base == NULL) {
> xfs_alert(mp,
> "XFS: NULL dquot in %s.", __func__);
> goto next;
> }
> - if (item->ri_buf[i].i_len < size_disk_dquot) {
> + if (item->ri_buf[i].iov_len < size_disk_dquot) {
> xfs_alert(mp,
> - "XFS: dquot too small (%d) in %s.",
> - item->ri_buf[i].i_len, __func__);
> + "XFS: dquot too small (%zd) in %s.",
> + item->ri_buf[i].iov_len, __func__);
> goto next;
> }
> - fa = xfs_dquot_verify(mp, item->ri_buf[i].i_addr, -1);
> + fa = xfs_dquot_verify(mp, item->ri_buf[i].iov_base, -1);
> if (fa) {
> xfs_alert(mp,
> "dquot corrupt at %pS trying to replay into block 0x%llx",
> @@ -533,7 +533,7 @@ xlog_recover_do_reg_buffer(
>
> memcpy(xfs_buf_offset(bp,
> (uint)bit << XFS_BLF_SHIFT), /* dest */
> - item->ri_buf[i].i_addr, /* source */
> + item->ri_buf[i].iov_base, /* source */
> nbits<<XFS_BLF_SHIFT); /* length */
> next:
> i++;
> @@ -669,8 +669,8 @@ xlog_recover_do_inode_buffer(
> if (next_unlinked_offset < reg_buf_offset)
> continue;
>
> - ASSERT(item->ri_buf[item_index].i_addr != NULL);
> - ASSERT((item->ri_buf[item_index].i_len % XFS_BLF_CHUNK) == 0);
> + ASSERT(item->ri_buf[item_index].iov_base != NULL);
> + ASSERT((item->ri_buf[item_index].iov_len % XFS_BLF_CHUNK) == 0);
> ASSERT((reg_buf_offset + reg_buf_bytes) <= BBTOB(bp->b_length));
>
> /*
> @@ -678,7 +678,7 @@ xlog_recover_do_inode_buffer(
> * current di_next_unlinked field. Extract its value
> * and copy it to the buffer copy.
> */
> - logged_nextp = item->ri_buf[item_index].i_addr +
> + logged_nextp = item->ri_buf[item_index].iov_base +
> next_unlinked_offset - reg_buf_offset;
> if (XFS_IS_CORRUPT(mp, *logged_nextp == 0)) {
> xfs_alert(mp,
> @@ -1002,7 +1002,7 @@ xlog_recover_buf_commit_pass2(
> struct xlog_recover_item *item,
> xfs_lsn_t current_lsn)
> {
> - struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
> + struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
> struct xfs_mount *mp = log->l_mp;
> struct xfs_buf *bp;
> int error;
> diff --git a/fs/xfs/xfs_dquot_item_recover.c b/fs/xfs/xfs_dquot_item_recover.c
> index 2c2720ce6923..89bc9bcaf51e 100644
> --- a/fs/xfs/xfs_dquot_item_recover.c
> +++ b/fs/xfs/xfs_dquot_item_recover.c
> @@ -34,10 +34,10 @@ xlog_recover_dquot_ra_pass2(
> if (mp->m_qflags == 0)
> return;
>
> - recddq = item->ri_buf[1].i_addr;
> + recddq = item->ri_buf[1].iov_base;
> if (recddq == NULL)
> return;
> - if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot))
> + if (item->ri_buf[1].iov_len < sizeof(struct xfs_disk_dquot))
> return;
>
> type = recddq->d_type & XFS_DQTYPE_REC_MASK;
> @@ -45,7 +45,7 @@ xlog_recover_dquot_ra_pass2(
> if (log->l_quotaoffs_flag & type)
> return;
>
> - dq_f = item->ri_buf[0].i_addr;
> + dq_f = item->ri_buf[0].iov_base;
> ASSERT(dq_f);
> ASSERT(dq_f->qlf_len == 1);
>
> @@ -79,14 +79,14 @@ xlog_recover_dquot_commit_pass2(
> if (mp->m_qflags == 0)
> return 0;
>
> - recddq = item->ri_buf[1].i_addr;
> + recddq = item->ri_buf[1].iov_base;
> if (recddq == NULL) {
> xfs_alert(log->l_mp, "NULL dquot in %s.", __func__);
> return -EFSCORRUPTED;
> }
> - if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot)) {
> - xfs_alert(log->l_mp, "dquot too small (%d) in %s.",
> - item->ri_buf[1].i_len, __func__);
> + if (item->ri_buf[1].iov_len < sizeof(struct xfs_disk_dquot)) {
> + xfs_alert(log->l_mp, "dquot too small (%zd) in %s.",
> + item->ri_buf[1].iov_len, __func__);
> return -EFSCORRUPTED;
> }
>
> @@ -108,7 +108,7 @@ xlog_recover_dquot_commit_pass2(
> * The other possibility, of course, is that the quota subsystem was
> * removed since the last mount - ENOSYS.
> */
> - dq_f = item->ri_buf[0].i_addr;
> + dq_f = item->ri_buf[0].iov_base;
> ASSERT(dq_f);
> fa = xfs_dquot_verify(mp, recddq, dq_f->qlf_id);
> if (fa) {
> @@ -147,7 +147,7 @@ xlog_recover_dquot_commit_pass2(
> }
> }
>
> - memcpy(ddq, recddq, item->ri_buf[1].i_len);
> + memcpy(ddq, recddq, item->ri_buf[1].iov_len);
> if (xfs_has_crc(mp)) {
> xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
> XFS_DQUOT_CRC_OFF);
> @@ -192,7 +192,7 @@ xlog_recover_quotaoff_commit_pass1(
> struct xlog *log,
> struct xlog_recover_item *item)
> {
> - struct xfs_qoff_logformat *qoff_f = item->ri_buf[0].i_addr;
> + struct xfs_qoff_logformat *qoff_f = item->ri_buf[0].iov_base;
> ASSERT(qoff_f);
>
> /*
> diff --git a/fs/xfs/xfs_exchmaps_item.c b/fs/xfs/xfs_exchmaps_item.c
> index 264a121c5e16..229cbe0adf17 100644
> --- a/fs/xfs/xfs_exchmaps_item.c
> +++ b/fs/xfs/xfs_exchmaps_item.c
> @@ -558,12 +558,12 @@ xlog_recover_xmi_commit_pass2(
> size_t len;
>
> len = sizeof(struct xfs_xmi_log_format);
> - if (item->ri_buf[0].i_len != len) {
> + if (item->ri_buf[0].iov_len != len) {
> XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
> return -EFSCORRUPTED;
> }
>
> - xmi_formatp = item->ri_buf[0].i_addr;
> + xmi_formatp = item->ri_buf[0].iov_base;
> if (xmi_formatp->__pad != 0) {
> XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
> return -EFSCORRUPTED;
> @@ -598,8 +598,8 @@ xlog_recover_xmd_commit_pass2(
> {
> struct xfs_xmd_log_format *xmd_formatp;
>
> - xmd_formatp = item->ri_buf[0].i_addr;
> - if (item->ri_buf[0].i_len != sizeof(struct xfs_xmd_log_format)) {
> + xmd_formatp = item->ri_buf[0].iov_base;
> + if (item->ri_buf[0].iov_len != sizeof(struct xfs_xmd_log_format)) {
> XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
> return -EFSCORRUPTED;
> }
> diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
> index d574f5f639fa..47ee598a9827 100644
> --- a/fs/xfs/xfs_extfree_item.c
> +++ b/fs/xfs/xfs_extfree_item.c
> @@ -182,15 +182,18 @@ xfs_efi_init(
> * It will handle the conversion of formats if necessary.
> */
> STATIC int
> -xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
> +xfs_efi_copy_format(
> + struct kvec *buf,
> + struct xfs_efi_log_format *dst_efi_fmt)
> {
> - xfs_efi_log_format_t *src_efi_fmt = buf->i_addr;
> - uint i;
> - uint len = xfs_efi_log_format_sizeof(src_efi_fmt->efi_nextents);
> - uint len32 = xfs_efi_log_format32_sizeof(src_efi_fmt->efi_nextents);
> - uint len64 = xfs_efi_log_format64_sizeof(src_efi_fmt->efi_nextents);
> + struct xfs_efi_log_format *src_efi_fmt = buf->iov_base;
> + uint len, len32, len64, i;
>
> - if (buf->i_len == len) {
> + len = xfs_efi_log_format_sizeof(src_efi_fmt->efi_nextents);
> + len32 = xfs_efi_log_format32_sizeof(src_efi_fmt->efi_nextents);
> + len64 = xfs_efi_log_format64_sizeof(src_efi_fmt->efi_nextents);
> +
> + if (buf->iov_len == len) {
> memcpy(dst_efi_fmt, src_efi_fmt,
> offsetof(struct xfs_efi_log_format, efi_extents));
> for (i = 0; i < src_efi_fmt->efi_nextents; i++)
> @@ -198,8 +201,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
> &src_efi_fmt->efi_extents[i],
> sizeof(struct xfs_extent));
> return 0;
> - } else if (buf->i_len == len32) {
> - xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->i_addr;
> + } else if (buf->iov_len == len32) {
> + xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->iov_base;
>
> dst_efi_fmt->efi_type = src_efi_fmt_32->efi_type;
> dst_efi_fmt->efi_size = src_efi_fmt_32->efi_size;
> @@ -212,8 +215,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
> src_efi_fmt_32->efi_extents[i].ext_len;
> }
> return 0;
> - } else if (buf->i_len == len64) {
> - xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->i_addr;
> + } else if (buf->iov_len == len64) {
> + xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->iov_base;
>
> dst_efi_fmt->efi_type = src_efi_fmt_64->efi_type;
> dst_efi_fmt->efi_size = src_efi_fmt_64->efi_size;
> @@ -227,8 +230,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
> }
> return 0;
> }
> - XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, NULL, buf->i_addr,
> - buf->i_len);
> + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, NULL, buf->iov_base,
> + buf->iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -865,11 +868,11 @@ xlog_recover_efi_commit_pass2(
> struct xfs_efi_log_format *efi_formatp;
> int error;
>
> - efi_formatp = item->ri_buf[0].i_addr;
> + efi_formatp = item->ri_buf[0].iov_base;
>
> - if (item->ri_buf[0].i_len < xfs_efi_log_format_sizeof(0)) {
> + if (item->ri_buf[0].iov_len < xfs_efi_log_format_sizeof(0)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -904,11 +907,11 @@ xlog_recover_rtefi_commit_pass2(
> struct xfs_efi_log_format *efi_formatp;
> int error;
>
> - efi_formatp = item->ri_buf[0].i_addr;
> + efi_formatp = item->ri_buf[0].iov_base;
>
> - if (item->ri_buf[0].i_len < xfs_efi_log_format_sizeof(0)) {
> + if (item->ri_buf[0].iov_len < xfs_efi_log_format_sizeof(0)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -933,7 +936,7 @@ xlog_recover_rtefi_commit_pass2(
> xfs_lsn_t lsn)
> {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
> #endif
> @@ -958,9 +961,9 @@ xlog_recover_efd_commit_pass2(
> xfs_lsn_t lsn)
> {
> struct xfs_efd_log_format *efd_formatp;
> - int buflen = item->ri_buf[0].i_len;
> + int buflen = item->ri_buf[0].iov_len;
>
> - efd_formatp = item->ri_buf[0].i_addr;
> + efd_formatp = item->ri_buf[0].iov_base;
>
> if (buflen < sizeof(struct xfs_efd_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> @@ -968,9 +971,9 @@ xlog_recover_efd_commit_pass2(
> return -EFSCORRUPTED;
> }
>
> - if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof(
> + if (item->ri_buf[0].iov_len != xfs_efd_log_format32_sizeof(
> efd_formatp->efd_nextents) &&
> - item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof(
> + item->ri_buf[0].iov_len != xfs_efd_log_format64_sizeof(
> efd_formatp->efd_nextents)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> efd_formatp, buflen);
> @@ -995,9 +998,9 @@ xlog_recover_rtefd_commit_pass2(
> xfs_lsn_t lsn)
> {
> struct xfs_efd_log_format *efd_formatp;
> - int buflen = item->ri_buf[0].i_len;
> + int buflen = item->ri_buf[0].iov_len;
>
> - efd_formatp = item->ri_buf[0].i_addr;
> + efd_formatp = item->ri_buf[0].iov_base;
>
> if (buflen < sizeof(struct xfs_efd_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> @@ -1005,9 +1008,9 @@ xlog_recover_rtefd_commit_pass2(
> return -EFSCORRUPTED;
> }
>
> - if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof(
> + if (item->ri_buf[0].iov_len != xfs_efd_log_format32_sizeof(
> efd_formatp->efd_nextents) &&
> - item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof(
> + item->ri_buf[0].iov_len != xfs_efd_log_format64_sizeof(
> efd_formatp->efd_nextents)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> efd_formatp, buflen);
> diff --git a/fs/xfs/xfs_icreate_item.c b/fs/xfs/xfs_icreate_item.c
> index 4345db501714..f83ec2bd0583 100644
> --- a/fs/xfs/xfs_icreate_item.c
> +++ b/fs/xfs/xfs_icreate_item.c
> @@ -158,7 +158,7 @@ xlog_recover_icreate_commit_pass2(
> int nbufs;
> int i;
>
> - icl = (struct xfs_icreate_log *)item->ri_buf[0].i_addr;
> + icl = (struct xfs_icreate_log *)item->ri_buf[0].iov_base;
> if (icl->icl_type != XFS_LI_ICREATE) {
> xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad type");
> return -EINVAL;
> diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
> index c6cb0b6b9e46..5d81d0d4af05 100644
> --- a/fs/xfs/xfs_inode_item.c
> +++ b/fs/xfs/xfs_inode_item.c
> @@ -1179,12 +1179,12 @@ xfs_iflush_shutdown_abort(
> */
> int
> xfs_inode_item_format_convert(
> - struct xfs_log_iovec *buf,
> + struct kvec *buf,
> struct xfs_inode_log_format *in_f)
> {
> - struct xfs_inode_log_format_32 *in_f32 = buf->i_addr;
> + struct xfs_inode_log_format_32 *in_f32 = buf->iov_base;
>
> - if (buf->i_len != sizeof(*in_f32)) {
> + if (buf->iov_len != sizeof(*in_f32)) {
> XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL);
> return -EFSCORRUPTED;
> }
> diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
> index 377e06007804..ba92ce11a011 100644
> --- a/fs/xfs/xfs_inode_item.h
> +++ b/fs/xfs/xfs_inode_item.h
> @@ -46,8 +46,8 @@ extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
> extern void xfs_inode_item_destroy(struct xfs_inode *);
> extern void xfs_iflush_abort(struct xfs_inode *);
> extern void xfs_iflush_shutdown_abort(struct xfs_inode *);
> -extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
> - struct xfs_inode_log_format *);
> +int xfs_inode_item_format_convert(struct kvec *buf,
> + struct xfs_inode_log_format *in_f);
>
> extern struct kmem_cache *xfs_ili_cache;
>
> diff --git a/fs/xfs/xfs_inode_item_recover.c b/fs/xfs/xfs_inode_item_recover.c
> index 7205fd14f6b3..9d1999d41be1 100644
> --- a/fs/xfs/xfs_inode_item_recover.c
> +++ b/fs/xfs/xfs_inode_item_recover.c
> @@ -30,13 +30,13 @@ xlog_recover_inode_ra_pass2(
> struct xlog *log,
> struct xlog_recover_item *item)
> {
> - if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) {
> - struct xfs_inode_log_format *ilfp = item->ri_buf[0].i_addr;
> + if (item->ri_buf[0].iov_len == sizeof(struct xfs_inode_log_format)) {
> + struct xfs_inode_log_format *ilfp = item->ri_buf[0].iov_base;
>
> xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
> &xfs_inode_buf_ra_ops);
> } else {
> - struct xfs_inode_log_format_32 *ilfp = item->ri_buf[0].i_addr;
> + struct xfs_inode_log_format_32 *ilfp = item->ri_buf[0].iov_base;
>
> xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
> &xfs_inode_buf_ra_ops);
> @@ -326,8 +326,8 @@ xlog_recover_inode_commit_pass2(
> int need_free = 0;
> xfs_failaddr_t fa;
>
> - if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) {
> - in_f = item->ri_buf[0].i_addr;
> + if (item->ri_buf[0].iov_len == sizeof(struct xfs_inode_log_format)) {
> + in_f = item->ri_buf[0].iov_base;
> } else {
> in_f = kmalloc(sizeof(struct xfs_inode_log_format),
> GFP_KERNEL | __GFP_NOFAIL);
> @@ -366,7 +366,7 @@ xlog_recover_inode_commit_pass2(
> error = -EFSCORRUPTED;
> goto out_release;
> }
> - ldip = item->ri_buf[1].i_addr;
> + ldip = item->ri_buf[1].iov_base;
> if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) {
> xfs_alert(mp,
> "%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld",
> @@ -472,12 +472,12 @@ xlog_recover_inode_commit_pass2(
> goto out_release;
> }
> isize = xfs_log_dinode_size(mp);
> - if (unlikely(item->ri_buf[1].i_len > isize)) {
> + if (unlikely(item->ri_buf[1].iov_len > isize)) {
> XFS_CORRUPTION_ERROR("Bad log dinode size", XFS_ERRLEVEL_LOW,
> mp, ldip, sizeof(*ldip));
> xfs_alert(mp,
> - "Bad inode 0x%llx log dinode size 0x%x",
> - in_f->ilf_ino, item->ri_buf[1].i_len);
> + "Bad inode 0x%llx log dinode size 0x%zx",
> + in_f->ilf_ino, item->ri_buf[1].iov_len);
> error = -EFSCORRUPTED;
> goto out_release;
> }
> @@ -500,8 +500,8 @@ xlog_recover_inode_commit_pass2(
>
> if (in_f->ilf_size == 2)
> goto out_owner_change;
> - len = item->ri_buf[2].i_len;
> - src = item->ri_buf[2].i_addr;
> + len = item->ri_buf[2].iov_len;
> + src = item->ri_buf[2].iov_base;
> ASSERT(in_f->ilf_size <= 4);
> ASSERT((in_f->ilf_size == 3) || (fields & XFS_ILOG_AFORK));
> ASSERT(!(fields & XFS_ILOG_DFORK) ||
> @@ -538,8 +538,8 @@ xlog_recover_inode_commit_pass2(
> } else {
> attr_index = 2;
> }
> - len = item->ri_buf[attr_index].i_len;
> - src = item->ri_buf[attr_index].i_addr;
> + len = item->ri_buf[attr_index].iov_len;
> + src = item->ri_buf[attr_index].iov_base;
> ASSERT(len == xlog_calc_iovec_len(in_f->ilf_asize));
>
> switch (in_f->ilf_fields & XFS_ILOG_AFORK) {
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 2f76531842f8..e6ed9e09c027 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -2131,15 +2131,15 @@ xlog_recover_add_to_cont_trans(
> item = list_entry(trans->r_itemq.prev, struct xlog_recover_item,
> ri_list);
>
> - old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
> - old_len = item->ri_buf[item->ri_cnt-1].i_len;
> + old_ptr = item->ri_buf[item->ri_cnt-1].iov_base;
> + old_len = item->ri_buf[item->ri_cnt-1].iov_len;
>
> ptr = kvrealloc(old_ptr, len + old_len, GFP_KERNEL);
> if (!ptr)
> return -ENOMEM;
> memcpy(&ptr[old_len], dp, len);
> - item->ri_buf[item->ri_cnt-1].i_len += len;
> - item->ri_buf[item->ri_cnt-1].i_addr = ptr;
> + item->ri_buf[item->ri_cnt-1].iov_len += len;
> + item->ri_buf[item->ri_cnt-1].iov_base = ptr;
> trace_xfs_log_recover_item_add_cont(log, trans, item, 0);
> return 0;
> }
> @@ -2223,7 +2223,7 @@ xlog_recover_add_to_trans(
> }
>
> item->ri_total = in_f->ilf_size;
> - item->ri_buf = kzalloc(item->ri_total * sizeof(xfs_log_iovec_t),
> + item->ri_buf = kcalloc(item->ri_total, sizeof(*item->ri_buf),
> GFP_KERNEL | __GFP_NOFAIL);
> }
>
> @@ -2237,8 +2237,8 @@ xlog_recover_add_to_trans(
> }
>
> /* Description region is ri_buf[0] */
> - item->ri_buf[item->ri_cnt].i_addr = ptr;
> - item->ri_buf[item->ri_cnt].i_len = len;
> + item->ri_buf[item->ri_cnt].iov_base = ptr;
> + item->ri_buf[item->ri_cnt].iov_len = len;
> item->ri_cnt++;
> trace_xfs_log_recover_item_add(log, trans, item, 0);
> return 0;
> @@ -2262,7 +2262,7 @@ xlog_recover_free_trans(
> /* Free the regions in the item. */
> list_del(&item->ri_list);
> for (i = 0; i < item->ri_cnt; i++)
> - kvfree(item->ri_buf[i].i_addr);
> + kvfree(item->ri_buf[i].iov_base);
> /* Free the item itself */
> kfree(item->ri_buf);
> kfree(item);
> diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
> index 076501123d89..3728234699a2 100644
> --- a/fs/xfs/xfs_refcount_item.c
> +++ b/fs/xfs/xfs_refcount_item.c
> @@ -717,18 +717,18 @@ xlog_recover_cui_commit_pass2(
> struct xfs_cui_log_format *cui_formatp;
> size_t len;
>
> - cui_formatp = item->ri_buf[0].i_addr;
> + cui_formatp = item->ri_buf[0].iov_base;
>
> - if (item->ri_buf[0].i_len < xfs_cui_log_format_sizeof(0)) {
> + if (item->ri_buf[0].iov_len < xfs_cui_log_format_sizeof(0)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> len = xfs_cui_log_format_sizeof(cui_formatp->cui_nextents);
> - if (item->ri_buf[0].i_len != len) {
> + if (item->ri_buf[0].iov_len != len) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -759,18 +759,18 @@ xlog_recover_rtcui_commit_pass2(
> struct xfs_cui_log_format *cui_formatp;
> size_t len;
>
> - cui_formatp = item->ri_buf[0].i_addr;
> + cui_formatp = item->ri_buf[0].iov_base;
>
> - if (item->ri_buf[0].i_len < xfs_cui_log_format_sizeof(0)) {
> + if (item->ri_buf[0].iov_len < xfs_cui_log_format_sizeof(0)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> len = xfs_cui_log_format_sizeof(cui_formatp->cui_nextents);
> - if (item->ri_buf[0].i_len != len) {
> + if (item->ri_buf[0].iov_len != len) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -791,7 +791,7 @@ xlog_recover_rtcui_commit_pass2(
> xfs_lsn_t lsn)
> {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
> #endif
> @@ -817,10 +817,10 @@ xlog_recover_cud_commit_pass2(
> {
> struct xfs_cud_log_format *cud_formatp;
>
> - cud_formatp = item->ri_buf[0].i_addr;
> - if (item->ri_buf[0].i_len != sizeof(struct xfs_cud_log_format)) {
> + cud_formatp = item->ri_buf[0].iov_base;
> + if (item->ri_buf[0].iov_len != sizeof(struct xfs_cud_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -843,10 +843,10 @@ xlog_recover_rtcud_commit_pass2(
> {
> struct xfs_cud_log_format *cud_formatp;
>
> - cud_formatp = item->ri_buf[0].i_addr;
> - if (item->ri_buf[0].i_len != sizeof(struct xfs_cud_log_format)) {
> + cud_formatp = item->ri_buf[0].iov_base;
> + if (item->ri_buf[0].iov_len != sizeof(struct xfs_cud_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
> index c99700318ec2..15f0903f6fd4 100644
> --- a/fs/xfs/xfs_rmap_item.c
> +++ b/fs/xfs/xfs_rmap_item.c
> @@ -746,18 +746,18 @@ xlog_recover_rui_commit_pass2(
> struct xfs_rui_log_format *rui_formatp;
> size_t len;
>
> - rui_formatp = item->ri_buf[0].i_addr;
> + rui_formatp = item->ri_buf[0].iov_base;
>
> - if (item->ri_buf[0].i_len < xfs_rui_log_format_sizeof(0)) {
> + if (item->ri_buf[0].iov_len < xfs_rui_log_format_sizeof(0)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> len = xfs_rui_log_format_sizeof(rui_formatp->rui_nextents);
> - if (item->ri_buf[0].i_len != len) {
> + if (item->ri_buf[0].iov_len != len) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -788,18 +788,18 @@ xlog_recover_rtrui_commit_pass2(
> struct xfs_rui_log_format *rui_formatp;
> size_t len;
>
> - rui_formatp = item->ri_buf[0].i_addr;
> + rui_formatp = item->ri_buf[0].iov_base;
>
> - if (item->ri_buf[0].i_len < xfs_rui_log_format_sizeof(0)) {
> + if (item->ri_buf[0].iov_len < xfs_rui_log_format_sizeof(0)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> len = xfs_rui_log_format_sizeof(rui_formatp->rui_nextents);
> - if (item->ri_buf[0].i_len != len) {
> + if (item->ri_buf[0].iov_len != len) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -820,7 +820,7 @@ xlog_recover_rtrui_commit_pass2(
> xfs_lsn_t lsn)
> {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
> + item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
> #endif
> @@ -846,10 +846,10 @@ xlog_recover_rud_commit_pass2(
> {
> struct xfs_rud_log_format *rud_formatp;
>
> - rud_formatp = item->ri_buf[0].i_addr;
> - if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) {
> + rud_formatp = item->ri_buf[0].iov_base;
> + if (item->ri_buf[0].iov_len != sizeof(struct xfs_rud_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - rud_formatp, item->ri_buf[0].i_len);
> + rud_formatp, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> @@ -872,10 +872,10 @@ xlog_recover_rtrud_commit_pass2(
> {
> struct xfs_rud_log_format *rud_formatp;
>
> - rud_formatp = item->ri_buf[0].i_addr;
> - if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) {
> + rud_formatp = item->ri_buf[0].iov_base;
> + if (item->ri_buf[0].iov_len != sizeof(struct xfs_rud_log_format)) {
> XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
> - rud_formatp, item->ri_buf[0].i_len);
> + rud_formatp, item->ri_buf[0].iov_len);
> return -EFSCORRUPTED;
> }
>
> diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
> index 2b366851e9a4..fa1724b4690e 100644
> --- a/fs/xfs/xfs_trans.h
> +++ b/fs/xfs/xfs_trans.h
> @@ -15,7 +15,6 @@ struct xfs_efd_log_item;
> struct xfs_efi_log_item;
> struct xfs_inode;
> struct xfs_item_ops;
> -struct xfs_log_iovec;
> struct xfs_mount;
> struct xfs_trans;
> struct xfs_trans_res;
> --
> 2.47.2
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: cleanup log item formatting
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (16 preceding siblings ...)
2025-06-10 5:15 ` [PATCH 17/17] xfs: move struct xfs_log_vec to xfs_log_priv.h Christoph Hellwig
@ 2025-06-17 22:35 ` Dave Chinner
2025-06-18 4:50 ` Christoph Hellwig
2025-06-18 9:24 ` Dave Chinner
2025-06-19 6:58 ` Dave Chinner
19 siblings, 1 reply; 31+ messages in thread
From: Dave Chinner @ 2025-06-17 22:35 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs
On Tue, Jun 10, 2025 at 07:14:57AM +0200, Christoph Hellwig wrote:
> Hi all,
>
> I dug into a rabit hole about the log item formatting recently,
> and noticed that the handling of the opheaders is still pretty
> ugly because it leaks pre-delayed logging implementation
> details into the log item implementations.
>
> The core of this series is to remove the to reserve space in the
> CIL buffers/shadow buffers for the opheaders that already were
> generated more or less on the fly by the lowlevel log write
> code anyway, but there's lots of other cleanups around it.
>
> Diffstat:
> libxfs/xfs_log_format.h | 54 -----
> libxfs/xfs_log_recover.h | 6
> xfs_attr_item.c | 156 +++++++-------
> xfs_attr_item.h | 8
> xfs_bmap_item.c | 28 +-
> xfs_buf_item.c | 27 +-
> xfs_buf_item.h | 2
> xfs_buf_item_recover.c | 38 +--
> xfs_dquot_item.c | 9
> xfs_dquot_item_recover.c | 20 -
> xfs_exchmaps_item.c | 19 -
> xfs_extfree_item.c | 69 +++---
> xfs_icreate_item.c | 8
> xfs_inode_item.c | 55 ++---
> xfs_inode_item.h | 4
> xfs_inode_item_recover.c | 26 +-
> xfs_log.c | 503 ++++++++++++++++++-----------------------------
> xfs_log.h | 106 ++++-----
> xfs_log_cil.c | 195 ++++++++++--------
> xfs_log_priv.h | 29 ++
> xfs_log_recover.c | 16 -
> xfs_refcount_item.c | 44 +---
> xfs_rmap_item.c | 44 +---
> xfs_trans.h | 5
> 24 files changed, 668 insertions(+), 803 deletions(-)
That's a pretty major rewrite of the core journal formatting and
iclog writing subsystem. That's going to need a lot of careful
review as well as correctness and recovery testing. It probably also
needs perf regression testing, as these paths are critical for
metadata performance...
Do you have a git branch for this series that I can pull?
-Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: cleanup log item formatting
2025-06-17 22:35 ` cleanup log item formatting Dave Chinner
@ 2025-06-18 4:50 ` Christoph Hellwig
0 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-18 4:50 UTC (permalink / raw)
To: Dave Chinner; +Cc: Christoph Hellwig, Carlos Maiolino, linux-xfs
On Wed, Jun 18, 2025 at 08:35:21AM +1000, Dave Chinner wrote:
> Do you have a git branch for this series that I can pull?
git://git.infradead.org/users/hch/misc.git xfs-log-format-cleanups
https://git.infradead.org/?p=users/hch/misc.git;a=shortlog;h=refs/heads/xfs-log-format-cleanups
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: cleanup log item formatting
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (17 preceding siblings ...)
2025-06-17 22:35 ` cleanup log item formatting Dave Chinner
@ 2025-06-18 9:24 ` Dave Chinner
2025-06-24 14:38 ` Christoph Hellwig
2025-06-19 6:58 ` Dave Chinner
19 siblings, 1 reply; 31+ messages in thread
From: Dave Chinner @ 2025-06-18 9:24 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs
On Tue, Jun 10, 2025 at 07:14:57AM +0200, Christoph Hellwig wrote:
> Hi all,
>
> I dug into a rabit hole about the log item formatting recently,
> and noticed that the handling of the opheaders is still pretty
> ugly because it leaks pre-delayed logging implementation
> details into the log item implementations.
>
> The core of this series is to remove the to reserve space in the
> CIL buffers/shadow buffers for the opheaders that already were
> generated more or less on the fly by the lowlevel log write
> code anyway, but there's lots of other cleanups around it.
OK, so I found the xfs-log-format-cleanups branch in your
tree. I just had check-parallel fail with:
[ 5060.219054] XFS (loop210): xlog_recovery_process_trans: bad flag 0x1
[ 5060.225296] XFS: Assertion failed: 0, file: fs/xfs/xfs_log_recover.c, line: 2324
[ 5060.233223] ------------[ cut here ]------------
[ 5060.243515] kernel BUG at fs/xfs/xfs_message.c:102!
[ 5060.262119] Oops: invalid opcode: 0000 [#2] SMP NOPTI
[ 5060.295341] CPU: 9 UID: 0 PID: 2180403 Comm: mount Tainted: G D 6.15.0-dgc+ #338 PREEMPT(full)
[ 5060.295347] Tainted: [D]=DIE
[ 5060.295348] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 5060.295350] RIP: 0010:assfail+0x3a/0x40
[ 5060.295360] Code: 89 f1 48 89 fe 48 c7 c7 8a f7 ed 82 48 c7 c2 f2 85 e8 82 e8 c8 fc ff ff 80 3d 19 b6 50 03 01 74 09 0f 0b 5d c3 cc cc cc cc cc <0f> 0b 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
[ 5060.295363] RSP: 0018:ffffc900198a79c8 EFLAGS: 00010246
[ 5060.317824] RAX: f72505c615164000 RBX: ffff8888c8204680 RCX: f72505c615164000
[ 5060.317826] RDX: ffffc900198a7898 RSI: 000000000000000a RDI: ffffffff82edf78a
[ 5060.317827] RBP: ffffc900198a79c8 R08: 0000000000000000 R09: 000000000000000a
[ 5060.317829] R10: 0000000000000000 R11: 0000000000000021 R12: ffff88821c475800
[ 5060.317830] R13: ffff8881d27bcc70 R14: ffff8881d27bcc7c R15: ffffc900198a7b58
[ 5060.317834] FS: 00007f6d916b8840(0000) GS:ffff88889a6be000(0000) knlGS:0000000000000000
[ 5060.317835] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 5060.317836] CR2: 00007f4c2650d350 CR3: 0000000226620000 CR4: 0000000000350ef0
[ 5060.317841] Call Trace:
[ 5060.341040] <TASK>
[ 5060.341043] xlog_recovery_process_trans+0xd6/0x100
[ 5060.341050] xlog_recover_process_ophdr+0xdd/0x140
[ 5060.341052] xlog_recover_process_data+0x9b/0x160
[ 5060.341054] xlog_recover_process+0xb2/0x110
[ 5060.341056] xlog_do_recovery_pass+0x685/0x900
[ 5060.341059] xlog_do_log_recovery+0x43/0xb0
[ 5060.341061] xlog_do_recover+0x2c/0x190
[ 5060.341063] xlog_recover+0x165/0x180
[ 5060.341065] xfs_log_mount+0x14d/0x270
[ 5060.376607] xfs_mountfs+0x3aa/0x990
[ 5060.376616] xfs_fs_fill_super+0x701/0x870
[ 5060.376619] ? __pfx_xfs_fs_fill_super+0x10/0x10
[ 5060.474403] get_tree_bdev_flags+0x120/0x1a0
[ 5060.476710] get_tree_bdev+0x10/0x20
[ 5060.478520] xfs_fs_get_tree+0x15/0x20
[ 5060.480175] vfs_get_tree+0x28/0xe0
[ 5060.481861] vfs_cmd_create+0x5f/0xd0
[ 5060.483491] vfs_fsconfig_locked+0x50/0x130
[ 5060.485358] __se_sys_fsconfig+0x349/0x3d0
[ 5060.487273] __x64_sys_fsconfig+0x25/0x30
[ 5060.489136] x64_sys_call+0x3be/0x2f60
[ 5060.491533] do_syscall_64+0x6c/0x140
[ 5060.493430] ? exc_page_fault+0x62/0xc0
[ 5060.495220] entry_SYSCALL_64_after_hwframe+0x76/0x7e
The test that triggered is was xfs/609 running with this config:
[xfs_1k]
FSTYP=xfs
MKFS_OPTIONS="-m rmapbt=1 -b size=1k -i exchange=1"
TEST_MKFS_OPTS="-m rmapbt=1 -b size=1k -i exchange=1"
I don't know if this is reproducable yet.
The assert failure is this case in xlog_recovery_process_trans():
case XLOG_START_TRANS:
default:
xfs_warn(log->l_mp, "%s: bad flag 0x%x", __func__, flags);
ASSERT(0);
error = -EFSCORRUPTED;
break;
}
This implies that more that one ophdr in a transaction had the
XLOG_START_TRANS flag set, or that there are duplicate transaction
IDs in the journal. i.e. something likely went wrong in xlog_write()
at runtime, but it's not until the journal is recovered that the
issue is noticed....
This reminds me of the subtle, hard to hit xlog_write bugs that
took me months of recovery testing to shake out last time I rewrote
the checkpoint and xlog_write() code... :/
-Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: cleanup log item formatting
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
` (18 preceding siblings ...)
2025-06-18 9:24 ` Dave Chinner
@ 2025-06-19 6:58 ` Dave Chinner
19 siblings, 0 replies; 31+ messages in thread
From: Dave Chinner @ 2025-06-19 6:58 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs
On Tue, Jun 10, 2025 at 07:14:57AM +0200, Christoph Hellwig wrote:
> Hi all,
>
> I dug into a rabit hole about the log item formatting recently,
> and noticed that the handling of the opheaders is still pretty
> ugly because it leaks pre-delayed logging implementation
> details into the log item implementations.
>
> The core of this series is to remove the to reserve space in the
> CIL buffers/shadow buffers for the opheaders that already were
> generated more or less on the fly by the lowlevel log write
> code anyway, but there's lots of other cleanups around it.
Another journal header corruption failure - I've hit the original
one I reported and this one a few times today:
[ 2217.226513] XFS (loop220): bad number of regions (33206) in inode log format
[ 2217.231292] XFS: Assertion failed: 0, file: fs/xfs/xfs_log_recover.c, line: 2220
[ 2217.236193] ------------[ cut here ]------------
[ 2217.239216] kernel BUG at fs/xfs/xfs_message.c:102!
[ 2217.253064] Oops: invalid opcode: 0000 [#1] SMP NOPTI
[ 2217.253224] XFS (loop390): Unmounting Filesystem d3058266-1835-4b17-a51a-7276edbea3e9
[ 2217.267570] CPU: 31 UID: 0 PID: 1291175 Comm: mount Not tainted 6.15.0-dgc+ #339 PREEMPT(full)
[ 2217.267574] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 2217.267577] RIP: 0010:assfail+0x3a/0x40
[ 2217.267588] Code: 89 f1 48 89 fe 48 c7 c7 8a f7 ed 82 48 c7 c2 f2 85 e8 82 e8 c8 fc ff ff 80 3d 19 b6 50 03 01 74 09 0f 0b 5d c3 cc cc cc cc cc <0f> 0b 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
[ 2217.285594] RSP: 0018:ffffc90028293980 EFLAGS: 00010246
[ 2217.285598] RAX: ad5e2cca7393a700 RBX: 0000000000000000 RCX: ad5e2cca7393a700
[ 2217.285600] RDX: ffffc90028293848 RSI: 000000000000000a RDI: ffffffff82edf78a
[ 2217.285602] RBP: ffffc90028293980 R08: 0000000000000000 R09: 000000000000000a
[ 2217.285603] R10: 0000000000000000 R11: 0000000000000021 R12: ffff8888e4108c80
[ 2217.285605] R13: 00000000000000b0 R14: ffff8889008165c0 R15: ffff8889008165f0
[ 2217.285609] FS: 00007fc3143ce840(0000) GS:ffff88909a83e000(0000) knlGS:0000000000000000
[ 2217.285612] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2217.285614] CR2: 00007ff4b56f0000 CR3: 000000013aaab000 CR4: 0000000000350ef0
[ 2217.285619] Call Trace:
[ 2217.285622] <TASK>
[ 2217.285625] xlog_recover_add_to_trans+0x24e/0x2a0
[ 2217.294934] xlog_recovery_process_trans+0x67/0x100
[ 2217.294937] xlog_recover_process_ophdr+0xdd/0x140
[ 2217.294939] xlog_recover_process_data+0x9b/0x160
[ 2217.294942] xlog_recover_process+0xb2/0x110
[ 2217.294943] xlog_do_recovery_pass+0x685/0x900
[ 2217.294946] xlog_do_log_recovery+0x43/0xb0
[ 2217.306831] xlog_do_recover+0x2c/0x190
[ 2217.306834] xlog_recover+0x165/0x180
[ 2217.306835] xfs_log_mount+0x14d/0x270
[ 2217.306843] xfs_mountfs+0x3aa/0x990
[ 2217.306846] xfs_fs_fill_super+0x701/0x870
[ 2217.306850] ? __pfx_xfs_fs_fill_super+0x10/0x10
[ 2217.321294] get_tree_bdev_flags+0x120/0x1a0
[ 2217.321314] get_tree_bdev+0x10/0x20
[ 2217.321316] xfs_fs_get_tree+0x15/0x20
[ 2217.321319] vfs_get_tree+0x28/0xe0
[ 2217.321321] vfs_cmd_create+0x5f/0xd0
[ 2217.321326] vfs_fsconfig_locked+0x50/0x130
[ 2217.321329] __se_sys_fsconfig+0x349/0x3d0
[ 2217.321332] __x64_sys_fsconfig+0x25/0x30
[ 2217.321336] x64_sys_call+0x3be/0x2f60
I'm going to stop testing this branch now and leave it until the
next version is posted for review.
-Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: cleanup log item formatting
2025-06-18 9:24 ` Dave Chinner
@ 2025-06-24 14:38 ` Christoph Hellwig
0 siblings, 0 replies; 31+ messages in thread
From: Christoph Hellwig @ 2025-06-24 14:38 UTC (permalink / raw)
To: Dave Chinner; +Cc: Christoph Hellwig, Carlos Maiolino, linux-xfs
On Wed, Jun 18, 2025 at 07:24:42PM +1000, Dave Chinner wrote:
> [ 5060.295341] CPU: 9 UID: 0 PID: 2180403 Comm: mount Tainted: G D 6.15.0-dgc+ #338 PREEMPT(full)
Just curious: what's the exact tree you are running? Because my branch
is based on 6.16-rc1 and should report that.
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2025-06-24 14:38 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 5:14 cleanup log item formatting Christoph Hellwig
2025-06-10 5:14 ` [PATCH 01/17] xfs: don't pass the old lv to xfs_cil_prepare_item Christoph Hellwig
2025-06-10 7:20 ` Carlos Maiolino
2025-06-10 5:14 ` [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items Christoph Hellwig
2025-06-10 7:56 ` Carlos Maiolino
2025-06-10 13:32 ` Christoph Hellwig
2025-06-10 14:00 ` Carlos Maiolino
2025-06-10 5:15 ` [PATCH 03/17] xfs: use better names for size members in xfs_log_vec Christoph Hellwig
2025-06-10 9:07 ` Carlos Maiolino
2025-06-10 5:15 ` [PATCH 04/17] xfs: don't use a xfs_log_iovec for attr_item names and values Christoph Hellwig
2025-06-10 9:17 ` Carlos Maiolino
2025-06-10 13:33 ` Christoph Hellwig
2025-06-10 5:15 ` [PATCH 05/17] xfs: don't use a xfs_log_iovec for ri_buf in log recovery Christoph Hellwig
2025-06-11 10:33 ` Carlos Maiolino
2025-06-10 5:15 ` [PATCH 06/17] xfs: improve the ->iop_format interface Christoph Hellwig
2025-06-10 5:15 ` [PATCH 07/17] xfs: add a xlog_write_one_vec helper Christoph Hellwig
2025-06-10 5:15 ` [PATCH 08/17] xfs: set lv_bytes in xlog_write_one_vec Christoph Hellwig
2025-06-10 5:15 ` [PATCH 09/17] xfs: create ophdrs on the fly in xlog_write Christoph Hellwig
2025-06-10 5:15 ` [PATCH 10/17] xfs: special case continuation records in xlog_write_region a litte less Christoph Hellwig
2025-06-10 5:15 ` [PATCH 11/17] xfs: factor the split iclog handling out of xlog_write_partial Christoph Hellwig
2025-06-10 5:15 ` [PATCH 12/17] xfs: remove xlog_write_full Christoph Hellwig
2025-06-10 5:15 ` [PATCH 13/17] xfs: improve argument handling for the xlog_write helpers Christoph Hellwig
2025-06-10 5:15 ` [PATCH 14/17] xfs: remove the xlog_op_header_t typedef Christoph Hellwig
2025-06-10 5:15 ` [PATCH 15/17] xfs: remove the xfs_trans_header_t typedef Christoph Hellwig
2025-06-10 5:15 ` [PATCH 16/17] xfs: move the XLOG_REG_ constants out of xfs_log_format.h Christoph Hellwig
2025-06-10 5:15 ` [PATCH 17/17] xfs: move struct xfs_log_vec to xfs_log_priv.h Christoph Hellwig
2025-06-17 22:35 ` cleanup log item formatting Dave Chinner
2025-06-18 4:50 ` Christoph Hellwig
2025-06-18 9:24 ` Dave Chinner
2025-06-24 14:38 ` Christoph Hellwig
2025-06-19 6:58 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).