summaryrefslogtreecommitdiff
path: root/fs/libfs.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2023-07-24 10:43:57 -0400
committerChristian Brauner <brauner@kernel.org>2023-08-09 09:15:41 +0200
commitbbaef7973dd017954419718ab2df526ae1f66e93 (patch)
tree5ba3c6145923e62efcb497608d54c74bdd85bafa /fs/libfs.c
parenta2e459555c5f9da3e619b7e47a63f98574dc75f1 (diff)
libfs: Add a lock class for the offset map's xa_lock
Tie the dynamically-allocated xarray locks into a single class so contention on the directory offset xarrays can be observed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Message-Id: <169020933088.160441.9405180953116076087.stgit@manet.1015granger.net> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r--fs/libfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/libfs.c b/fs/libfs.c
index a7e56baf8bbd..3495f071093e 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -249,6 +249,8 @@ static u32 dentry2offset(struct dentry *dentry)
return (u32)((uintptr_t)(dentry->d_fsdata));
}
+static struct lock_class_key simple_offset_xa_lock;
+
/**
* simple_offset_init - initialize an offset_ctx
* @octx: directory offset map to be initialized
@@ -257,6 +259,7 @@ static u32 dentry2offset(struct dentry *dentry)
void simple_offset_init(struct offset_ctx *octx)
{
xa_init_flags(&octx->xa, XA_FLAGS_ALLOC1);
+ lockdep_set_class(&octx->xa.xa_lock, &simple_offset_xa_lock);
/* 0 is '.', 1 is '..', so always start with offset 2 */
octx->next_offset = 2;