Lines Matching refs:target
2464 static void swap_names(struct dentry *dentry, struct dentry *target) in swap_names() argument
2466 if (unlikely(dname_external(target))) { in swap_names()
2471 swap(target->d_name.name, dentry->d_name.name); in swap_names()
2477 memcpy(target->d_iname, dentry->d_name.name, in swap_names()
2479 dentry->d_name.name = target->d_name.name; in swap_names()
2480 target->d_name.name = target->d_iname; in swap_names()
2488 memcpy(dentry->d_iname, target->d_name.name, in swap_names()
2489 target->d_name.len + 1); in swap_names()
2490 target->d_name.name = dentry->d_name.name; in swap_names()
2499 kmemcheck_mark_initialized(target->d_iname, DNAME_INLINE_LEN); in swap_names()
2502 ((long *) &target->d_iname)[i]); in swap_names()
2506 swap(dentry->d_name.hash_len, target->d_name.hash_len); in swap_names()
2509 static void copy_name(struct dentry *dentry, struct dentry *target) in copy_name() argument
2514 if (unlikely(dname_external(target))) { in copy_name()
2515 atomic_inc(&external_name(target)->u.count); in copy_name()
2516 dentry->d_name = target->d_name; in copy_name()
2518 memcpy(dentry->d_iname, target->d_name.name, in copy_name()
2519 target->d_name.len + 1); in copy_name()
2521 dentry->d_name.hash_len = target->d_name.hash_len; in copy_name()
2527 static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) in dentry_lock_for_move() argument
2532 if (IS_ROOT(dentry) || dentry->d_parent == target->d_parent) in dentry_lock_for_move()
2533 spin_lock(&target->d_parent->d_lock); in dentry_lock_for_move()
2535 if (d_ancestor(dentry->d_parent, target->d_parent)) { in dentry_lock_for_move()
2537 spin_lock_nested(&target->d_parent->d_lock, in dentry_lock_for_move()
2540 spin_lock(&target->d_parent->d_lock); in dentry_lock_for_move()
2545 if (target < dentry) { in dentry_lock_for_move()
2546 spin_lock_nested(&target->d_lock, 2); in dentry_lock_for_move()
2550 spin_lock_nested(&target->d_lock, 3); in dentry_lock_for_move()
2554 static void dentry_unlock_for_move(struct dentry *dentry, struct dentry *target) in dentry_unlock_for_move() argument
2556 if (target->d_parent != dentry->d_parent) in dentry_unlock_for_move()
2558 if (target->d_parent != target) in dentry_unlock_for_move()
2559 spin_unlock(&target->d_parent->d_lock); in dentry_unlock_for_move()
2560 spin_unlock(&target->d_lock); in dentry_unlock_for_move()
2589 static void __d_move(struct dentry *dentry, struct dentry *target, in __d_move() argument
2595 BUG_ON(d_ancestor(dentry, target)); in __d_move()
2596 BUG_ON(d_ancestor(target, dentry)); in __d_move()
2598 dentry_lock_for_move(dentry, target); in __d_move()
2601 write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED); in __d_move()
2610 __d_rehash(dentry, d_hash(target->d_parent, target->d_name.hash)); in __d_move()
2616 __d_drop(target); in __d_move()
2618 __d_rehash(target, in __d_move()
2624 swap_names(dentry, target); in __d_move()
2626 copy_name(dentry, target); in __d_move()
2632 dentry->d_parent = target->d_parent; in __d_move()
2633 target->d_parent = target; in __d_move()
2634 list_del_init(&target->d_child); in __d_move()
2638 swap(dentry->d_parent, target->d_parent); in __d_move()
2639 list_move(&target->d_child, &target->d_parent->d_subdirs); in __d_move()
2642 fsnotify_d_move(target); in __d_move()
2646 write_seqcount_end(&target->d_seq); in __d_move()
2649 dentry_unlock_for_move(dentry, target); in __d_move()
2661 void d_move(struct dentry *dentry, struct dentry *target) in d_move() argument
2664 __d_move(dentry, target, false); in d_move()