summaryrefslogtreecommitdiff
path: root/fs/kernfs/kernfs-internal.h
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2021-07-16 12:28:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-27 10:29:15 +0300
commit7ba0273b2f34a55efe967d3c7381fb1da2ca195f (patch)
treeb8c0df46d2918cd7fc27c87fa1f9e058bbfd6aeb /fs/kernfs/kernfs-internal.h
parentc7e7c04274b13f98f758fb69b03f2ab61976ea80 (diff)
downloadlinux-7ba0273b2f34a55efe967d3c7381fb1da2ca195f.tar.xz
kernfs: switch kernfs to use an rwsem
The kernfs global lock restricts the ability to perform kernfs node lookup operations in parallel during path walks. Change the kernfs mutex to an rwsem so that, when opportunity arises, node searches can be done in parallel with path walk lookups. Reviewed-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Ian Kent <raven@themaw.net> Link: https://lore.kernel.org/r/162642770946.63632.2218304587223241374.stgit@web.messagingengine.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/kernfs-internal.h')
-rw-r--r--fs/kernfs/kernfs-internal.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
index c2ae58f3b202..f9cc912c31e1 100644
--- a/fs/kernfs/kernfs-internal.h
+++ b/fs/kernfs/kernfs-internal.h
@@ -13,6 +13,7 @@
#include <linux/lockdep.h>
#include <linux/fs.h>
#include <linux/mutex.h>
+#include <linux/rwsem.h>
#include <linux/xattr.h>
#include <linux/kernfs.h>
@@ -69,7 +70,7 @@ struct kernfs_super_info {
*/
const void *ns;
- /* anchored at kernfs_root->supers, protected by kernfs_mutex */
+ /* anchored at kernfs_root->supers, protected by kernfs_rwsem */
struct list_head node;
};
#define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
@@ -121,7 +122,7 @@ int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);
/*
* dir.c
*/
-extern struct mutex kernfs_mutex;
+extern struct rw_semaphore kernfs_rwsem;
extern const struct dentry_operations kernfs_dops;
extern const struct file_operations kernfs_dir_fops;
extern const struct inode_operations kernfs_dir_iops;