Skip to content

Commit 0177479

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: cleanup the ordered item logic in xlog_cil_insert_format_items
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> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 4693422 commit 0177479

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

fs/xfs/xfs_log_cil.c

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,8 @@ xlog_cil_insert_format_items(
452452
}
453453

454454
list_for_each_entry(lip, &tp->t_items, li_trans) {
455-
struct xfs_log_vec *lv;
456-
struct xfs_log_vec *shadow;
457-
bool ordered = false;
455+
struct xfs_log_vec *lv = lip->li_lv;
456+
struct xfs_log_vec *shadow = lip->li_lv_shadow;
458457

459458
/* Skip items which aren't dirty in this transaction. */
460459
if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
@@ -464,21 +463,23 @@ xlog_cil_insert_format_items(
464463
* The formatting size information is already attached to
465464
* the shadow lv on the log item.
466465
*/
467-
shadow = lip->li_lv_shadow;
468-
if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED)
469-
ordered = true;
466+
if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED) {
467+
if (!lv) {
468+
lv = shadow;
469+
lv->lv_item = lip;
470+
}
471+
ASSERT(shadow->lv_size == lv->lv_size);
472+
xfs_cil_prepare_item(log, lip, lv, diff_len);
473+
continue;
474+
}
470475

471476
/* Skip items that do not have any vectors for writing */
472-
if (!shadow->lv_niovecs && !ordered)
477+
if (!shadow->lv_niovecs)
473478
continue;
474479

475480
/* compare to existing item size */
476-
if (lip->li_lv && shadow->lv_size <= lip->li_lv->lv_size) {
481+
if (lv && shadow->lv_size <= lv->lv_size) {
477482
/* same or smaller, optimise common overwrite case */
478-
lv = lip->li_lv;
479-
480-
if (ordered)
481-
goto insert;
482483

483484
/*
484485
* set the item up as though it is a new insertion so
@@ -498,16 +499,10 @@ xlog_cil_insert_format_items(
498499
/* switch to shadow buffer! */
499500
lv = shadow;
500501
lv->lv_item = lip;
501-
if (ordered) {
502-
/* track as an ordered logvec */
503-
ASSERT(lip->li_lv == NULL);
504-
goto insert;
505-
}
506502
}
507503

508504
ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
509505
lip->li_ops->iop_format(lip, lv);
510-
insert:
511506
xfs_cil_prepare_item(log, lip, lv, diff_len);
512507
}
513508
}

0 commit comments

Comments
 (0)