Lines Matching refs:target
2467 static void swap_names(struct dentry *dentry, struct dentry *target) in swap_names() argument
2469 if (unlikely(dname_external(target))) { in swap_names()
2474 swap(target->d_name.name, dentry->d_name.name); in swap_names()
2480 memcpy(target->d_iname, dentry->d_name.name, in swap_names()
2482 dentry->d_name.name = target->d_name.name; in swap_names()
2483 target->d_name.name = target->d_iname; in swap_names()
2491 memcpy(dentry->d_iname, target->d_name.name, in swap_names()
2492 target->d_name.len + 1); in swap_names()
2493 target->d_name.name = dentry->d_name.name; in swap_names()
2502 kmemcheck_mark_initialized(target->d_iname, DNAME_INLINE_LEN); in swap_names()
2505 ((long *) &target->d_iname)[i]); in swap_names()
2509 swap(dentry->d_name.hash_len, target->d_name.hash_len); in swap_names()
2512 static void copy_name(struct dentry *dentry, struct dentry *target) in copy_name() argument
2517 if (unlikely(dname_external(target))) { in copy_name()
2518 atomic_inc(&external_name(target)->u.count); in copy_name()
2519 dentry->d_name = target->d_name; in copy_name()
2521 memcpy(dentry->d_iname, target->d_name.name, in copy_name()
2522 target->d_name.len + 1); in copy_name()
2524 dentry->d_name.hash_len = target->d_name.hash_len; in copy_name()
2530 static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) in dentry_lock_for_move() argument
2535 if (IS_ROOT(dentry) || dentry->d_parent == target->d_parent) in dentry_lock_for_move()
2536 spin_lock(&target->d_parent->d_lock); in dentry_lock_for_move()
2538 if (d_ancestor(dentry->d_parent, target->d_parent)) { in dentry_lock_for_move()
2540 spin_lock_nested(&target->d_parent->d_lock, in dentry_lock_for_move()
2543 spin_lock(&target->d_parent->d_lock); in dentry_lock_for_move()
2548 if (target < dentry) { in dentry_lock_for_move()
2549 spin_lock_nested(&target->d_lock, 2); in dentry_lock_for_move()
2553 spin_lock_nested(&target->d_lock, 3); in dentry_lock_for_move()
2557 static void dentry_unlock_for_move(struct dentry *dentry, struct dentry *target) in dentry_unlock_for_move() argument
2559 if (target->d_parent != dentry->d_parent) in dentry_unlock_for_move()
2561 if (target->d_parent != target) in dentry_unlock_for_move()
2562 spin_unlock(&target->d_parent->d_lock); in dentry_unlock_for_move()
2563 spin_unlock(&target->d_lock); in dentry_unlock_for_move()
2592 static void __d_move(struct dentry *dentry, struct dentry *target, in __d_move() argument
2598 BUG_ON(d_ancestor(dentry, target)); in __d_move()
2599 BUG_ON(d_ancestor(target, dentry)); in __d_move()
2601 dentry_lock_for_move(dentry, target); in __d_move()
2604 write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED); in __d_move()
2613 __d_rehash(dentry, d_hash(target->d_parent, target->d_name.hash)); in __d_move()
2619 __d_drop(target); in __d_move()
2621 __d_rehash(target, in __d_move()
2627 swap_names(dentry, target); in __d_move()
2629 copy_name(dentry, target); in __d_move()
2635 dentry->d_parent = target->d_parent; in __d_move()
2636 target->d_parent = target; in __d_move()
2637 list_del_init(&target->d_child); in __d_move()
2641 swap(dentry->d_parent, target->d_parent); in __d_move()
2642 list_move(&target->d_child, &target->d_parent->d_subdirs); in __d_move()
2645 fsnotify_d_move(target); in __d_move()
2649 write_seqcount_end(&target->d_seq); in __d_move()
2652 dentry_unlock_for_move(dentry, target); in __d_move()
2664 void d_move(struct dentry *dentry, struct dentry *target) in d_move() argument
2667 __d_move(dentry, target, false); in d_move()