diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-26 23:06:14 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-26 23:06:14 -0400 |
commit | 63cf427a570dd8eb66d8cfc4c2ed9367811d6d3e (patch) | |
tree | 5ce2e6494590744f238a491e0bd7932696153193 /fs | |
parent | 4453641fe85f2ffda653e2e61b6a554dba1f0581 (diff) |
kill __d_materialise_dentry()
it folds into __d_move() now
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dcache.c | 54 |
1 files changed, 10 insertions, 44 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 0551fcc7671c..6e543173a5d8 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -2511,28 +2511,28 @@ static void __d_move(struct dentry *dentry, struct dentry *target, | |||
2511 | switch_names(dentry, target); | 2511 | switch_names(dentry, target); |
2512 | swap(dentry->d_name.hash, target->d_name.hash); | 2512 | swap(dentry->d_name.hash, target->d_name.hash); |
2513 | 2513 | ||
2514 | /* ... and switch the parents */ | 2514 | /* ... and switch them in the tree */ |
2515 | if (IS_ROOT(dentry)) { | 2515 | if (IS_ROOT(dentry)) { |
2516 | /* splicing a tree */ | ||
2516 | dentry->d_parent = target->d_parent; | 2517 | dentry->d_parent = target->d_parent; |
2517 | target->d_parent = target; | 2518 | target->d_parent = target; |
2518 | list_del_init(&target->d_u.d_child); | 2519 | list_del_init(&target->d_u.d_child); |
2520 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2519 | } else { | 2521 | } else { |
2522 | /* swapping two dentries */ | ||
2520 | swap(dentry->d_parent, target->d_parent); | 2523 | swap(dentry->d_parent, target->d_parent); |
2521 | |||
2522 | /* And add them back to the (new) parent lists */ | ||
2523 | list_move(&target->d_u.d_child, &target->d_parent->d_subdirs); | 2524 | list_move(&target->d_u.d_child, &target->d_parent->d_subdirs); |
2525 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2526 | if (exchange) | ||
2527 | fsnotify_d_move(target); | ||
2528 | fsnotify_d_move(dentry); | ||
2524 | } | 2529 | } |
2525 | 2530 | ||
2526 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2527 | |||
2528 | write_seqcount_end(&target->d_seq); | 2531 | write_seqcount_end(&target->d_seq); |
2529 | write_seqcount_end(&dentry->d_seq); | 2532 | write_seqcount_end(&dentry->d_seq); |
2530 | 2533 | ||
2531 | dentry_unlock_parents_for_move(dentry, target); | 2534 | dentry_unlock_parents_for_move(dentry, target); |
2532 | if (exchange) | ||
2533 | fsnotify_d_move(target); | ||
2534 | spin_unlock(&target->d_lock); | 2535 | spin_unlock(&target->d_lock); |
2535 | fsnotify_d_move(dentry); | ||
2536 | spin_unlock(&dentry->d_lock); | 2536 | spin_unlock(&dentry->d_lock); |
2537 | } | 2537 | } |
2538 | 2538 | ||
@@ -2631,40 +2631,6 @@ out_err: | |||
2631 | return ret; | 2631 | return ret; |
2632 | } | 2632 | } |
2633 | 2633 | ||
2634 | /* | ||
2635 | * Prepare an anonymous dentry for life in the superblock's dentry tree as a | ||
2636 | * named dentry in place of the dentry to be replaced. | ||
2637 | */ | ||
2638 | static void __d_materialise_dentry(struct dentry *dentry, struct dentry *target) | ||
2639 | { | ||
2640 | dentry_lock_for_move(dentry, target); | ||
2641 | |||
2642 | write_seqcount_begin(&dentry->d_seq); | ||
2643 | write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED); | ||
2644 | |||
2645 | switch_names(dentry, target); | ||
2646 | swap(dentry->d_name.hash, target->d_name.hash); | ||
2647 | |||
2648 | dentry->d_parent = target->d_parent; | ||
2649 | target->d_parent = target; | ||
2650 | list_del_init(&target->d_u.d_child); | ||
2651 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2652 | if (likely(!d_unhashed(dentry))) { | ||
2653 | hlist_bl_lock(&dentry->d_sb->s_anon); | ||
2654 | __hlist_bl_del(&dentry->d_hash); | ||
2655 | dentry->d_hash.pprev = NULL; | ||
2656 | hlist_bl_unlock(&dentry->d_sb->s_anon); | ||
2657 | } | ||
2658 | __d_rehash(dentry, d_hash(dentry->d_parent, dentry->d_name.hash)); | ||
2659 | |||
2660 | write_seqcount_end(&target->d_seq); | ||
2661 | write_seqcount_end(&dentry->d_seq); | ||
2662 | |||
2663 | dentry_unlock_parents_for_move(dentry, target); | ||
2664 | spin_unlock(&target->d_lock); | ||
2665 | spin_unlock(&dentry->d_lock); | ||
2666 | } | ||
2667 | |||
2668 | /** | 2634 | /** |
2669 | * d_splice_alias - splice a disconnected dentry into the tree if one exists | 2635 | * d_splice_alias - splice a disconnected dentry into the tree if one exists |
2670 | * @inode: the inode which may have a disconnected dentry | 2636 | * @inode: the inode which may have a disconnected dentry |
@@ -2710,7 +2676,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
2710 | return ERR_PTR(-EIO); | 2676 | return ERR_PTR(-EIO); |
2711 | } | 2677 | } |
2712 | write_seqlock(&rename_lock); | 2678 | write_seqlock(&rename_lock); |
2713 | __d_materialise_dentry(new, dentry); | 2679 | __d_move(new, dentry, false); |
2714 | write_sequnlock(&rename_lock); | 2680 | write_sequnlock(&rename_lock); |
2715 | spin_unlock(&inode->i_lock); | 2681 | spin_unlock(&inode->i_lock); |
2716 | security_d_instantiate(new, inode); | 2682 | security_d_instantiate(new, inode); |
@@ -2771,7 +2737,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2771 | } else if (IS_ROOT(alias)) { | 2737 | } else if (IS_ROOT(alias)) { |
2772 | /* Is this an anonymous mountpoint that we | 2738 | /* Is this an anonymous mountpoint that we |
2773 | * could splice into our tree? */ | 2739 | * could splice into our tree? */ |
2774 | __d_materialise_dentry(alias, dentry); | 2740 | __d_move(alias, dentry, false); |
2775 | write_sequnlock(&rename_lock); | 2741 | write_sequnlock(&rename_lock); |
2776 | goto found; | 2742 | goto found; |
2777 | } else { | 2743 | } else { |