From 6778948f9de86c3cfaf36725a7c87dcff9ba247f Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 11 Dec 2023 08:20:59 +0000 Subject: [PATCH] kernel_5.10 no rt --- kernel/fs/dcache.c | 39 +++++++++++++++++---------------------- 1 files changed, 17 insertions(+), 22 deletions(-) diff --git a/kernel/fs/dcache.c b/kernel/fs/dcache.c index ddc695a..cb588ce 100644 --- a/kernel/fs/dcache.c +++ b/kernel/fs/dcache.c @@ -2503,10 +2503,9 @@ static inline unsigned start_dir_add(struct inode *dir) { - preempt_disable_rt(); for (;;) { - unsigned n = dir->__i_dir_seq; - if (!(n & 1) && cmpxchg(&dir->__i_dir_seq, n, n + 1) == n) + unsigned n = dir->i_dir_seq; + if (!(n & 1) && cmpxchg(&dir->i_dir_seq, n, n + 1) == n) return n; cpu_relax(); } @@ -2514,30 +2513,26 @@ static inline void end_dir_add(struct inode *dir, unsigned n) { - smp_store_release(&dir->__i_dir_seq, n + 2); - preempt_enable_rt(); + smp_store_release(&dir->i_dir_seq, n + 2); } static void d_wait_lookup(struct dentry *dentry) { - struct swait_queue __wait; - - if (!d_in_lookup(dentry)) - return; - - INIT_LIST_HEAD(&__wait.task_list); - do { - prepare_to_swait_exclusive(dentry->d_wait, &__wait, TASK_UNINTERRUPTIBLE); - spin_unlock(&dentry->d_lock); - schedule(); - spin_lock(&dentry->d_lock); - } while (d_in_lookup(dentry)); - finish_swait(dentry->d_wait, &__wait); + if (d_in_lookup(dentry)) { + DECLARE_WAITQUEUE(wait, current); + add_wait_queue(dentry->d_wait, &wait); + do { + set_current_state(TASK_UNINTERRUPTIBLE); + spin_unlock(&dentry->d_lock); + schedule(); + spin_lock(&dentry->d_lock); + } while (d_in_lookup(dentry)); + } } struct dentry *d_alloc_parallel(struct dentry *parent, const struct qstr *name, - struct swait_queue_head *wq) + wait_queue_head_t *wq) { unsigned int hash = name->hash; struct hlist_bl_head *b = in_lookup_hash(parent, hash); @@ -2551,7 +2546,7 @@ retry: rcu_read_lock(); - seq = smp_load_acquire(&parent->d_inode->__i_dir_seq); + seq = smp_load_acquire(&parent->d_inode->i_dir_seq); r_seq = read_seqbegin(&rename_lock); dentry = __d_lookup_rcu(parent, name, &d_seq); if (unlikely(dentry)) { @@ -2579,7 +2574,7 @@ } hlist_bl_lock(b); - if (unlikely(READ_ONCE(parent->d_inode->__i_dir_seq) != seq)) { + if (unlikely(READ_ONCE(parent->d_inode->i_dir_seq) != seq)) { hlist_bl_unlock(b); rcu_read_unlock(); goto retry; @@ -2652,7 +2647,7 @@ hlist_bl_lock(b); dentry->d_flags &= ~DCACHE_PAR_LOOKUP; __hlist_bl_del(&dentry->d_u.d_in_lookup_hash); - swake_up_all(dentry->d_wait); + wake_up_all(dentry->d_wait); dentry->d_wait = NULL; hlist_bl_unlock(b); INIT_HLIST_NODE(&dentry->d_u.d_alias); -- Gitblit v1.6.2