From: Dave Chinner <david@fromorbit.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] hlist-bl: add hlist_bl_fake()
Date: Tue, 6 Apr 2021 22:33:42 +1000 [thread overview]
Message-ID: <20210406123343.1739669-3-david@fromorbit.com> (raw)
In-Reply-To: <20210406123343.1739669-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
in preparation for switching the VFS inode cache over the hlist_bl
lists, we nee dto be able to fake a list node that looks like it is
hased for correct operation of filesystems that don't directly use
the VFS indoe cache.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
include/linux/list_bl.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index ae1b541446c9..8ee2bf5af131 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -143,6 +143,28 @@ static inline void hlist_bl_del_init(struct hlist_bl_node *n)
}
}
+/**
+ * hlist_bl_add_fake - create a fake list consisting of a single headless node
+ * @n: Node to make a fake list out of
+ *
+ * This makes @n appear to be its own predecessor on a headless hlist.
+ * The point of this is to allow things like hlist_bl_del() to work correctly
+ * in cases where there is no list.
+ */
+static inline void hlist_bl_add_fake(struct hlist_bl_node *n)
+{
+ n->pprev = &n->next;
+}
+
+/**
+ * hlist_fake: Is this node a fake hlist_bl?
+ * @h: Node to check for being a self-referential fake hlist.
+ */
+static inline bool hlist_bl_fake(struct hlist_bl_node *n)
+{
+ return n->pprev == &n->next;
+}
+
static inline void hlist_bl_lock(struct hlist_bl_head *b)
{
bit_spin_lock(0, (unsigned long *)b);
--
2.31.0
next prev parent reply other threads:[~2021-04-06 12:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 12:33 [RFC PATCH 0/3] vfs: convert inode cache to hlist-bl Dave Chinner
2021-04-06 12:33 ` [PATCH 1/3] vfs: factor out inode hash head calculation Dave Chinner
2021-04-06 22:06 ` Kent Overstreet
2021-04-06 12:33 ` Dave Chinner [this message]
2021-04-06 22:07 ` [PATCH 2/3] hlist-bl: add hlist_bl_fake() Kent Overstreet
2021-04-06 12:33 ` [PATCH 3/3] vfs: inode cache conversion to hash-bl Dave Chinner
2021-04-06 13:28 ` bl_list and lockdep Matthew Wilcox
2021-04-06 21:22 ` Dave Chinner
2021-04-12 15:20 ` Thomas Gleixner
2021-04-12 22:15 ` Dave Chinner
2021-04-12 23:18 ` Thomas Gleixner
2021-04-13 9:58 ` Dave Chinner
2021-04-13 21:24 ` Thomas Gleixner
2021-04-06 22:16 ` [PATCH 3/3] vfs: inode cache conversion to hash-bl Kent Overstreet
2021-04-06 22:03 ` [RFC PATCH 0/3] vfs: convert inode cache to hlist-bl Kent Overstreet
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=20210406123343.1739669-3-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox