2022-05-17 20:17:25

by Xiubo Li

[permalink] [raw]
Subject: [PATCH v2 0/2] ceph: wait async unlink to finish

V2:
- Add one dedicated spin lock to protect the list_add/del_rcu
- Other small fixes
- Fix the compile error from kernel test robot


Xiubo Li (2):
fs/dcache: add d_compare() helper support
ceph: wait the first reply of inflight unlink/rmdir

fs/ceph/dir.c | 70 ++++++++++++++++++++++++++++++++++++++---
fs/ceph/file.c | 5 +++
fs/ceph/mds_client.c | 71 ++++++++++++++++++++++++++++++++++++++++++
fs/ceph/mds_client.h | 1 +
fs/ceph/super.c | 3 ++
fs/ceph/super.h | 19 ++++++++---
fs/dcache.c | 15 +++++++++
include/linux/dcache.h | 2 ++
8 files changed, 176 insertions(+), 10 deletions(-)

--
2.36.0.rc1



2022-05-18 04:55:41

by Xiubo Li

[permalink] [raw]
Subject: [PATCH v2 1/2] fs/dcache: add d_compare() helper support

Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Xiubo Li <[email protected]>
---
fs/dcache.c | 15 +++++++++++++++
include/linux/dcache.h | 2 ++
2 files changed, 17 insertions(+)

diff --git a/fs/dcache.c b/fs/dcache.c
index 93f4f5ee07bf..95a72f92a94b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2262,6 +2262,21 @@ static inline bool d_same_name(const struct dentry *dentry,
name) == 0;
}

+/**
+ * d_compare - compare dentry name with case-exact name
+ * @parent: parent dentry
+ * @dentry: the negative dentry that was passed to the parent's lookup func
+ * @name: the case-exact name to be associated with the returned dentry
+ *
+ * Return: 0 if names are same, or 1
+ */
+bool d_compare(const struct dentry *parent, const struct dentry *dentry,
+ const struct qstr *name)
+{
+ return !d_same_name(dentry, parent, name);
+}
+EXPORT_SYMBOL(d_compare);
+
/**
* __d_lookup_rcu - search for a dentry (racy, store-free)
* @parent: parent dentry
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index f5bba51480b2..444b2230e5c3 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -233,6 +233,8 @@ extern struct dentry * d_alloc_parallel(struct dentry *, const struct qstr *,
wait_queue_head_t *);
extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
+extern bool d_compare(const struct dentry *parent, const struct dentry *dentry,
+ const struct qstr *name);
extern struct dentry * d_exact_alias(struct dentry *, struct inode *);
extern struct dentry *d_find_any_alias(struct inode *inode);
extern struct dentry * d_obtain_alias(struct inode *);
--
2.36.0.rc1