All of lore.kernel.org
 help / color / mirror / Atom feed
From: xiakaixu1987@gmail.com
To: linux-xfs@vger.kernel.org
Cc: darrick.wong@oracle.com, Kaixu Xia <kaixuxia@tencent.com>
Subject: [PATCH] xfs: do the assert for all the log done items in xfs_trans_cancel
Date: Wed, 16 Sep 2020 19:19:07 +0800	[thread overview]
Message-ID: <1600255152-16086-5-git-send-email-kaixuxia@tencent.com> (raw)
In-Reply-To: <1600255152-16086-1-git-send-email-kaixuxia@tencent.com>

From: Kaixu Xia <kaixuxia@tencent.com>

We should do the assert for all the log done items if they appear
here. This patch also add the XFS_ITEM_LOG_DONE flag to check if
the item is a log done item.

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 fs/xfs/xfs_bmap_item.c     | 2 +-
 fs/xfs/xfs_extfree_item.c  | 2 +-
 fs/xfs/xfs_refcount_item.c | 2 +-
 fs/xfs/xfs_rmap_item.c     | 2 +-
 fs/xfs/xfs_trans.c         | 2 +-
 fs/xfs/xfs_trans.h         | 4 ++++
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index ec3691372e7c..2e49f48666f1 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -202,7 +202,7 @@ xfs_bud_item_release(
 }
 
 static const struct xfs_item_ops xfs_bud_item_ops = {
-	.flags		= XFS_ITEM_RELEASE_WHEN_COMMITTED,
+	.flags		= XFS_ITEM_LOG_DONE_FLAG,
 	.iop_size	= xfs_bud_item_size,
 	.iop_format	= xfs_bud_item_format,
 	.iop_release	= xfs_bud_item_release,
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 6cb8cd11072a..f2c6cb67262e 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -307,7 +307,7 @@ xfs_efd_item_release(
 }
 
 static const struct xfs_item_ops xfs_efd_item_ops = {
-	.flags		= XFS_ITEM_RELEASE_WHEN_COMMITTED,
+	.flags		= XFS_ITEM_LOG_DONE_FLAG,
 	.iop_size	= xfs_efd_item_size,
 	.iop_format	= xfs_efd_item_format,
 	.iop_release	= xfs_efd_item_release,
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index ca93b6488377..551bcc93acdd 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -208,7 +208,7 @@ xfs_cud_item_release(
 }
 
 static const struct xfs_item_ops xfs_cud_item_ops = {
-	.flags		= XFS_ITEM_RELEASE_WHEN_COMMITTED,
+	.flags		= XFS_ITEM_LOG_DONE_FLAG,
 	.iop_size	= xfs_cud_item_size,
 	.iop_format	= xfs_cud_item_format,
 	.iop_release	= xfs_cud_item_release,
diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
index dc5b0753cd51..427f90ef4509 100644
--- a/fs/xfs/xfs_rmap_item.c
+++ b/fs/xfs/xfs_rmap_item.c
@@ -231,7 +231,7 @@ xfs_rud_item_release(
 }
 
 static const struct xfs_item_ops xfs_rud_item_ops = {
-	.flags		= XFS_ITEM_RELEASE_WHEN_COMMITTED,
+	.flags		= XFS_ITEM_LOG_DONE_FLAG,
 	.iop_size	= xfs_rud_item_size,
 	.iop_format	= xfs_rud_item_format,
 	.iop_release	= xfs_rud_item_release,
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 4257fdb03778..d33d0ba6f3bd 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1050,7 +1050,7 @@ xfs_trans_cancel(
 		struct xfs_log_item *lip;
 
 		list_for_each_entry(lip, &tp->t_items, li_trans)
-			ASSERT(!(lip->li_type == XFS_LI_EFD));
+			ASSERT(!(lip->li_ops->flags & XFS_ITEM_LOG_DONE));
 	}
 #endif
 	xfs_trans_unreserve_and_mod_sb(tp);
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 7fb82eb92e65..b92138b13c40 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -85,6 +85,10 @@ struct xfs_item_ops {
  * intents that never need to be written back in place.
  */
 #define XFS_ITEM_RELEASE_WHEN_COMMITTED	(1 << 0)
+#define XFS_ITEM_LOG_DONE		(1 << 1)	/* log done item */
+
+#define XFS_ITEM_LOG_DONE_FLAG	(XFS_ITEM_RELEASE_WHEN_COMMITTED | \
+				 XFS_ITEM_LOG_DONE)
 
 void	xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
 			  int type, const struct xfs_item_ops *ops);
-- 
2.20.0


  parent reply	other threads:[~2020-09-16 21:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 11:19 [RFC PATCH 0/9]xfs: random fixes and code cleanup xiakaixu1987
2020-09-16 11:19 ` [PATCH] xfs: remove the unused SYNCHRONIZE macro xiakaixu1987
2020-09-16 21:28   ` Darrick J. Wong
2020-09-17  8:03   ` Christoph Hellwig
2020-09-16 11:19 ` [PATCH] xfs: use the existing type definition for di_projid xiakaixu1987
2020-09-16 21:30   ` Darrick J. Wong
2020-09-17  8:06   ` Christoph Hellwig
2020-09-16 11:19 ` [PATCH] xfs: remove the unnecessary xfs_dqid_t type cast xiakaixu1987
2020-09-16 21:30   ` Darrick J. Wong
2020-09-17  8:07   ` Christoph Hellwig
2020-09-16 11:19 ` xiakaixu1987 [this message]
2020-09-17  0:10   ` [PATCH] xfs: do the assert for all the log done items in xfs_trans_cancel Darrick J. Wong
2020-09-17  8:06     ` kaixuxia
2020-09-17  8:08     ` Christoph Hellwig
2020-09-16 11:19 ` [PATCH] xfs: add the XFS_ITEM_LOG_INTENT flag to mark the log intent item xiakaixu1987
2020-09-16 11:19 ` [PATCH] xfs: remove the unnecessary variable error in xfs_trans_unreserve_and_mod_sb xiakaixu1987
2020-09-16 16:45   ` Darrick J. Wong
2020-09-17  6:47     ` kaixuxia
2020-09-16 11:19 ` [PATCH] xfs: remove the repeated crc verification in xfs_attr3_rmt_verify xiakaixu1987
2020-09-16 18:45   ` Darrick J. Wong
2020-09-17  7:03     ` kaixuxia
2020-09-16 11:19 ` [PATCH] xfs: cleanup the useless backslash in xfs_attr_leaf_entsize_remote xiakaixu1987
2020-09-16 18:50   ` Darrick J. Wong
2020-09-17  7:17     ` kaixuxia
2020-09-16 11:19 ` [PATCH] xfs: fix some comments xiakaixu1987
2020-09-16 21:31   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1600255152-16086-5-git-send-email-kaixuxia@tencent.com \
    --to=xiakaixu1987@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=kaixuxia@tencent.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.