History

__d_materialise_dentry(): flip the order of arguments

... thus making it much closer to (now unreachable, BTW) IS_ROOT(dentry) case in __d_move(). A bit more and it'll fold in.

Al Viro committed 12 years ago

Commit 44536411 parent 9d8cd301 file · +20 −24Browse files

Unified · Split

fs/dcache.c+20−24
@@ -2635,38 +2635,34 @@ out_err: · 2634 unmodified lines
26352635 * Prepare an anonymous dentry for life in the superblock's dentry tree as a
26362636 * named dentry in place of the dentry to be replaced.
26372637 */
2638−static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
2638+static void __d_materialise_dentry(struct dentry *dentry, struct dentry *target)
26392639 {
2640− struct dentry *dparent;
2641−
2642− dentry_lock_for_move(anon, dentry);
2640+ dentry_lock_for_move(dentry, target);
26432641
26442642 write_seqcount_begin(&dentry->d_seq);
2645− write_seqcount_begin_nested(&anon->d_seq, DENTRY_D_LOCK_NESTED);
2646−
2647− dparent = dentry->d_parent;
2643+ write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED);
26482644
2649− switch_names(dentry, anon);
2650− swap(dentry->d_name.hash, anon->d_name.hash);
2645+ switch_names(dentry, target);
2646+ swap(dentry->d_name.hash, target->d_name.hash);
26512647
2652− dentry->d_parent = dentry;
2653− list_del_init(&dentry->d_u.d_child);
2654− anon->d_parent = dparent;
2655− list_move(&anon->d_u.d_child, &dparent->d_subdirs);
2656− if (likely(!d_unhashed(anon))) {
2657− hlist_bl_lock(&anon->d_sb->s_anon);
2658− __hlist_bl_del(&anon->d_hash);
2659− anon->d_hash.pprev = NULL;
2660− hlist_bl_unlock(&anon->d_sb->s_anon);
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);
26612657 }
2662− __d_rehash(anon, d_hash(anon->d_parent, anon->d_name.hash));
2658+ __d_rehash(dentry, d_hash(dentry->d_parent, dentry->d_name.hash));
26632659
2660+ write_seqcount_end(&target->d_seq);
26642661 write_seqcount_end(&dentry->d_seq);
2665− write_seqcount_end(&anon->d_seq);
26662662
2667− dentry_unlock_parents_for_move(anon, dentry);
2663+ dentry_unlock_parents_for_move(dentry, target);
2664+ spin_unlock(&target->d_lock);
26682665 spin_unlock(&dentry->d_lock);
2669− spin_unlock(&anon->d_lock);
26702666 }
26712667
26722668 /**
@@ -2714,7 +2710,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) · 41 unmodified lines
27142710 return ERR_PTR(-EIO);
27152711 }
27162712 write_seqlock(&rename_lock);
2717− __d_materialise_dentry(dentry, new);
2713+ __d_materialise_dentry(new, dentry);
27182714 write_sequnlock(&rename_lock);
27192715 spin_unlock(&inode->i_lock);
27202716 security_d_instantiate(new, inode);
@@ -2775,7 +2771,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) · 54 unmodified lines
27752771 } else if (IS_ROOT(alias)) {
27762772 /* Is this an anonymous mountpoint that we
27772773 * could splice into our tree? */
2778− __d_materialise_dentry(dentry, alias);
2774+ __d_materialise_dentry(alias, dentry);
27792775 write_sequnlock(&rename_lock);
27802776 goto found;
27812777 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t