Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] libxfs: check all defer ops types
Date: Fri, 26 Oct 2018 09:19:05 -0700	[thread overview]
Message-ID: <20181026161905.GH28243@magnolia> (raw)

From: Darrick J. Wong <darrick.wong@oracle.com>

Make sure we have all the defer ops types loaded before proceeding.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libxfs/init.c      |    5 +++++
 libxfs/xfs_defer.c |   12 ++++++++++++
 libxfs/xfs_defer.h |    1 +
 3 files changed, 18 insertions(+)

diff --git a/libxfs/init.c b/libxfs/init.c
index 750b8f20..d1fdc3a8 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -253,6 +253,11 @@ libxfs_init(libxfs_init_t *a)
 	xfs_rmap_update_init_defer_op();
 	xfs_refcount_update_init_defer_op();
 	xfs_bmap_update_init_defer_op();
+	if (!xfs_defer_check_all_present()) {
+		fprintf(stderr, _("%s: defer ops not all there\n"),
+			progname);
+		goto done;
+	}
 
 	radix_tree_init();
 
diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c
index 5a6da0f3..cd3a8ef3 100644
--- a/libxfs/xfs_defer.c
+++ b/libxfs/xfs_defer.c
@@ -545,3 +545,15 @@ xfs_defer_move(
 
 	xfs_defer_reset(stp);
 }
+
+/* Make sure we filled out all the defer_ops types. */
+bool
+xfs_defer_check_all_present(void)
+{
+	int		x;
+
+	for(x = 0; x < XFS_DEFER_OPS_TYPE_MAX; x++)
+		if (defer_op_types[x] == NULL)
+			return false;
+	return true;
+}
diff --git a/libxfs/xfs_defer.h b/libxfs/xfs_defer.h
index 2584a5b9..bc7ae7ff 100644
--- a/libxfs/xfs_defer.h
+++ b/libxfs/xfs_defer.h
@@ -57,5 +57,6 @@ struct xfs_defer_op_type {
 };
 
 void xfs_defer_init_op_type(const struct xfs_defer_op_type *type);
+bool xfs_defer_check_all_present(void);
 
 #endif /* __XFS_DEFER_H__ */

             reply	other threads:[~2018-10-27  0:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 16:19 Darrick J. Wong [this message]
2018-10-26 19:02 ` [PATCH] libxfs: check all defer ops types Eric Sandeen
2018-10-26 19:11   ` Eric Sandeen
2018-10-26 19:18     ` Darrick J. Wong
2018-10-26 19:26       ` Christoph Hellwig
2018-10-26 19:24     ` Christoph Hellwig
2018-10-26 19:26       ` Eric Sandeen

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=20181026161905.GH28243@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox