]> www.infradead.org Git - users/hch/misc.git/commitdiff
xfs: remove xlog_write_full
authorChristoph Hellwig <hch@lst.de>
Thu, 22 May 2025 04:32:14 +0000 (06:32 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 10 Jun 2025 05:09:55 +0000 (07:09 +0200)
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

index aa158bc4d36b3497d0c5d67f8e21c9fa7317bd15..b72f52ab95210e5d2d7bb0f0224a99eb983efb81 100644 (file)
@@ -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);