Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CEAB7083C for ; Tue, 10 Jun 2025 05:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749532613; cv=none; b=aBOJUs4qDLg+UV+kobUZ/U6l4vTAG5OTy+fd21eTx8GTpOJVQpjTRvJCe2YwoLHB8qSeS1JjwZNELtNLA1SdmN93IUJCzaRuCUyc3hScBxguz0/WGMNi3Rqxs/0DXrqGnCOLc/uBzPEv1caZfb1Y2gLmklZozxREhSrUCk2JeQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749532613; c=relaxed/simple; bh=z/oCUt+yJ2TyjgUpZ32YulJgANLGV16FyDxOJ38HRSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VRSJKKzSZfjzSx+TPm2ixH3ZX1ON1xK2yPtKMvMfddULAhajIFNx6ggLbTXQypttso8LAUvx2kYVykGyCTnWy/LLgSbQvg8p8JADZl/mB9bilNq4PhfywKfBp4ADbeeqp+3f9hA/2lcSwyXpGENOYDh2t0ZrJsdtuk8fpkuA+rY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=2DzMIzdq; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="2DzMIzdq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=MYqhGjJJhC9LWjyoWF6/bTRMjeGsDkspZkY8fl05mkE=; b=2DzMIzdq5bMcEhNahUxv2j66T7 YuTjFyKUtmaFwMX2A9Cut0tSyxvhUaaHKNZCt/FrCsRFf009nr2cWYEyWjDbadaFRASb3rojtVlNI JtTkh0KRDGhiLQrD4hygbd5U+edP+ja5c4KKv7FF0aFC3Wy1YbuojlZPyhNPsxaGguLs8W9RL7mGp fSehDFw6PUwwC8gWyweQiBGQL1AYzUN2A1wFQ97NiZvIlXjAEcotRj0j46nex2qH+EBUQN46TIsF+ MxhKoBK12F3LdXqt6RgvOQjQVw4LtSBBOf9zoJJELfoKmRXnGa0QY0u9y0JCrpXvJozn33Y0p6yz1 tbRBqQyw==; Received: from 2a02-8389-2341-5b80-d601-7564-c2e0-491c.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:d601:7564:c2e0:491c] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1uOrLu-00000005pGU-47j6; Tue, 10 Jun 2025 05:16:51 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: linux-xfs@vger.kernel.org Subject: [PATCH 02/17] xfs: cleanup the ordered item logic in xlog_cil_insert_format_items Date: Tue, 10 Jun 2025 07:14:59 +0200 Message-ID: <20250610051644.2052814-3-hch@lst.de> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250610051644.2052814-1-hch@lst.de> References: <20250610051644.2052814-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 --- 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