From: Christoph Hellwig Date: Thu, 22 May 2025 04:32:14 +0000 (+0200) Subject: xfs: remove xlog_write_full X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=997d497f4843a031c47737a4f523f215502d6f1d;p=users%2Fhch%2Fmisc.git xfs: remove xlog_write_full 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 --- 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);