hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/fs/dcache.c
....@@ -2503,10 +2503,9 @@
25032503 static inline unsigned start_dir_add(struct inode *dir)
25042504 {
25052505
2506
- preempt_disable_rt();
25072506 for (;;) {
2508
- unsigned n = dir->__i_dir_seq;
2509
- if (!(n & 1) && cmpxchg(&dir->__i_dir_seq, n, n + 1) == n)
2507
+ unsigned n = dir->i_dir_seq;
2508
+ if (!(n & 1) && cmpxchg(&dir->i_dir_seq, n, n + 1) == n)
25102509 return n;
25112510 cpu_relax();
25122511 }
....@@ -2514,30 +2513,26 @@
25142513
25152514 static inline void end_dir_add(struct inode *dir, unsigned n)
25162515 {
2517
- smp_store_release(&dir->__i_dir_seq, n + 2);
2518
- preempt_enable_rt();
2516
+ smp_store_release(&dir->i_dir_seq, n + 2);
25192517 }
25202518
25212519 static void d_wait_lookup(struct dentry *dentry)
25222520 {
2523
- struct swait_queue __wait;
2524
-
2525
- if (!d_in_lookup(dentry))
2526
- return;
2527
-
2528
- INIT_LIST_HEAD(&__wait.task_list);
2529
- do {
2530
- prepare_to_swait_exclusive(dentry->d_wait, &__wait, TASK_UNINTERRUPTIBLE);
2531
- spin_unlock(&dentry->d_lock);
2532
- schedule();
2533
- spin_lock(&dentry->d_lock);
2534
- } while (d_in_lookup(dentry));
2535
- finish_swait(dentry->d_wait, &__wait);
2521
+ if (d_in_lookup(dentry)) {
2522
+ DECLARE_WAITQUEUE(wait, current);
2523
+ add_wait_queue(dentry->d_wait, &wait);
2524
+ do {
2525
+ set_current_state(TASK_UNINTERRUPTIBLE);
2526
+ spin_unlock(&dentry->d_lock);
2527
+ schedule();
2528
+ spin_lock(&dentry->d_lock);
2529
+ } while (d_in_lookup(dentry));
2530
+ }
25362531 }
25372532
25382533 struct dentry *d_alloc_parallel(struct dentry *parent,
25392534 const struct qstr *name,
2540
- struct swait_queue_head *wq)
2535
+ wait_queue_head_t *wq)
25412536 {
25422537 unsigned int hash = name->hash;
25432538 struct hlist_bl_head *b = in_lookup_hash(parent, hash);
....@@ -2551,7 +2546,7 @@
25512546
25522547 retry:
25532548 rcu_read_lock();
2554
- seq = smp_load_acquire(&parent->d_inode->__i_dir_seq);
2549
+ seq = smp_load_acquire(&parent->d_inode->i_dir_seq);
25552550 r_seq = read_seqbegin(&rename_lock);
25562551 dentry = __d_lookup_rcu(parent, name, &d_seq);
25572552 if (unlikely(dentry)) {
....@@ -2579,7 +2574,7 @@
25792574 }
25802575
25812576 hlist_bl_lock(b);
2582
- if (unlikely(READ_ONCE(parent->d_inode->__i_dir_seq) != seq)) {
2577
+ if (unlikely(READ_ONCE(parent->d_inode->i_dir_seq) != seq)) {
25832578 hlist_bl_unlock(b);
25842579 rcu_read_unlock();
25852580 goto retry;
....@@ -2652,7 +2647,7 @@
26522647 hlist_bl_lock(b);
26532648 dentry->d_flags &= ~DCACHE_PAR_LOOKUP;
26542649 __hlist_bl_del(&dentry->d_u.d_in_lookup_hash);
2655
- swake_up_all(dentry->d_wait);
2650
+ wake_up_all(dentry->d_wait);
26562651 dentry->d_wait = NULL;
26572652 hlist_bl_unlock(b);
26582653 INIT_HLIST_NODE(&dentry->d_u.d_alias);