.. | .. |
---|
2503 | 2503 | static inline unsigned start_dir_add(struct inode *dir) |
---|
2504 | 2504 | { |
---|
2505 | 2505 | |
---|
2506 | | - preempt_disable_rt(); |
---|
2507 | 2506 | 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) |
---|
2510 | 2509 | return n; |
---|
2511 | 2510 | cpu_relax(); |
---|
2512 | 2511 | } |
---|
.. | .. |
---|
2514 | 2513 | |
---|
2515 | 2514 | static inline void end_dir_add(struct inode *dir, unsigned n) |
---|
2516 | 2515 | { |
---|
2517 | | - smp_store_release(&dir->__i_dir_seq, n + 2); |
---|
2518 | | - preempt_enable_rt(); |
---|
| 2516 | + smp_store_release(&dir->i_dir_seq, n + 2); |
---|
2519 | 2517 | } |
---|
2520 | 2518 | |
---|
2521 | 2519 | static void d_wait_lookup(struct dentry *dentry) |
---|
2522 | 2520 | { |
---|
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 | + } |
---|
2536 | 2531 | } |
---|
2537 | 2532 | |
---|
2538 | 2533 | struct dentry *d_alloc_parallel(struct dentry *parent, |
---|
2539 | 2534 | const struct qstr *name, |
---|
2540 | | - struct swait_queue_head *wq) |
---|
| 2535 | + wait_queue_head_t *wq) |
---|
2541 | 2536 | { |
---|
2542 | 2537 | unsigned int hash = name->hash; |
---|
2543 | 2538 | struct hlist_bl_head *b = in_lookup_hash(parent, hash); |
---|
.. | .. |
---|
2551 | 2546 | |
---|
2552 | 2547 | retry: |
---|
2553 | 2548 | 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); |
---|
2555 | 2550 | r_seq = read_seqbegin(&rename_lock); |
---|
2556 | 2551 | dentry = __d_lookup_rcu(parent, name, &d_seq); |
---|
2557 | 2552 | if (unlikely(dentry)) { |
---|
.. | .. |
---|
2579 | 2574 | } |
---|
2580 | 2575 | |
---|
2581 | 2576 | 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)) { |
---|
2583 | 2578 | hlist_bl_unlock(b); |
---|
2584 | 2579 | rcu_read_unlock(); |
---|
2585 | 2580 | goto retry; |
---|
.. | .. |
---|
2652 | 2647 | hlist_bl_lock(b); |
---|
2653 | 2648 | dentry->d_flags &= ~DCACHE_PAR_LOOKUP; |
---|
2654 | 2649 | __hlist_bl_del(&dentry->d_u.d_in_lookup_hash); |
---|
2655 | | - swake_up_all(dentry->d_wait); |
---|
| 2650 | + wake_up_all(dentry->d_wait); |
---|
2656 | 2651 | dentry->d_wait = NULL; |
---|
2657 | 2652 | hlist_bl_unlock(b); |
---|
2658 | 2653 | INIT_HLIST_NODE(&dentry->d_u.d_alias); |
---|