diff options
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 17e439138681..134d6775183f 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -71,7 +71,7 @@ struct dentry_stat_t dentry_stat = { | |||
71 | 71 | ||
72 | static void d_callback(struct rcu_head *head) | 72 | static void d_callback(struct rcu_head *head) |
73 | { | 73 | { |
74 | struct dentry * dentry = container_of(head, struct dentry, d_rcu); | 74 | struct dentry * dentry = container_of(head, struct dentry, d_u.d_rcu); |
75 | 75 | ||
76 | if (dname_external(dentry)) | 76 | if (dname_external(dentry)) |
77 | kfree(dentry->d_name.name); | 77 | kfree(dentry->d_name.name); |
@@ -86,7 +86,7 @@ static void d_free(struct dentry *dentry) | |||
86 | { | 86 | { |
87 | if (dentry->d_op && dentry->d_op->d_release) | 87 | if (dentry->d_op && dentry->d_op->d_release) |
88 | dentry->d_op->d_release(dentry); | 88 | dentry->d_op->d_release(dentry); |
89 | call_rcu(&dentry->d_rcu, d_callback); | 89 | call_rcu(&dentry->d_u.d_rcu, d_callback); |
90 | } | 90 | } |
91 | 91 | ||
92 | /* | 92 | /* |
@@ -193,7 +193,7 @@ kill_it: { | |||
193 | list_del(&dentry->d_lru); | 193 | list_del(&dentry->d_lru); |
194 | dentry_stat.nr_unused--; | 194 | dentry_stat.nr_unused--; |
195 | } | 195 | } |
196 | list_del(&dentry->d_child); | 196 | list_del(&dentry->d_u.d_child); |
197 | dentry_stat.nr_dentry--; /* For d_free, below */ | 197 | dentry_stat.nr_dentry--; /* For d_free, below */ |
198 | /*drops the locks, at that point nobody can reach this dentry */ | 198 | /*drops the locks, at that point nobody can reach this dentry */ |
199 | dentry_iput(dentry); | 199 | dentry_iput(dentry); |
@@ -367,7 +367,7 @@ static inline void prune_one_dentry(struct dentry * dentry) | |||
367 | struct dentry * parent; | 367 | struct dentry * parent; |
368 | 368 | ||
369 | __d_drop(dentry); | 369 | __d_drop(dentry); |
370 | list_del(&dentry->d_child); | 370 | list_del(&dentry->d_u.d_child); |
371 | dentry_stat.nr_dentry--; /* For d_free, below */ | 371 | dentry_stat.nr_dentry--; /* For d_free, below */ |
372 | dentry_iput(dentry); | 372 | dentry_iput(dentry); |
373 | parent = dentry->d_parent; | 373 | parent = dentry->d_parent; |
@@ -518,7 +518,7 @@ repeat: | |||
518 | resume: | 518 | resume: |
519 | while (next != &this_parent->d_subdirs) { | 519 | while (next != &this_parent->d_subdirs) { |
520 | struct list_head *tmp = next; | 520 | struct list_head *tmp = next; |
521 | struct dentry *dentry = list_entry(tmp, struct dentry, d_child); | 521 | struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); |
522 | next = tmp->next; | 522 | next = tmp->next; |
523 | /* Have we found a mount point ? */ | 523 | /* Have we found a mount point ? */ |
524 | if (d_mountpoint(dentry)) | 524 | if (d_mountpoint(dentry)) |
@@ -532,7 +532,7 @@ resume: | |||
532 | * All done at this level ... ascend and resume the search. | 532 | * All done at this level ... ascend and resume the search. |
533 | */ | 533 | */ |
534 | if (this_parent != parent) { | 534 | if (this_parent != parent) { |
535 | next = this_parent->d_child.next; | 535 | next = this_parent->d_u.d_child.next; |
536 | this_parent = this_parent->d_parent; | 536 | this_parent = this_parent->d_parent; |
537 | goto resume; | 537 | goto resume; |
538 | } | 538 | } |
@@ -569,7 +569,7 @@ repeat: | |||
569 | resume: | 569 | resume: |
570 | while (next != &this_parent->d_subdirs) { | 570 | while (next != &this_parent->d_subdirs) { |
571 | struct list_head *tmp = next; | 571 | struct list_head *tmp = next; |
572 | struct dentry *dentry = list_entry(tmp, struct dentry, d_child); | 572 | struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); |
573 | next = tmp->next; | 573 | next = tmp->next; |
574 | 574 | ||
575 | if (!list_empty(&dentry->d_lru)) { | 575 | if (!list_empty(&dentry->d_lru)) { |
@@ -610,7 +610,7 @@ dentry->d_parent->d_name.name, dentry->d_name.name, found); | |||
610 | * All done at this level ... ascend and resume the search. | 610 | * All done at this level ... ascend and resume the search. |
611 | */ | 611 | */ |
612 | if (this_parent != parent) { | 612 | if (this_parent != parent) { |
613 | next = this_parent->d_child.next; | 613 | next = this_parent->d_u.d_child.next; |
614 | this_parent = this_parent->d_parent; | 614 | this_parent = this_parent->d_parent; |
615 | #ifdef DCACHE_DEBUG | 615 | #ifdef DCACHE_DEBUG |
616 | printk(KERN_DEBUG "select_parent: ascending to %s/%s, found=%d\n", | 616 | printk(KERN_DEBUG "select_parent: ascending to %s/%s, found=%d\n", |
@@ -753,12 +753,12 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) | |||
753 | dentry->d_parent = dget(parent); | 753 | dentry->d_parent = dget(parent); |
754 | dentry->d_sb = parent->d_sb; | 754 | dentry->d_sb = parent->d_sb; |
755 | } else { | 755 | } else { |
756 | INIT_LIST_HEAD(&dentry->d_child); | 756 | INIT_LIST_HEAD(&dentry->d_u.d_child); |
757 | } | 757 | } |
758 | 758 | ||
759 | spin_lock(&dcache_lock); | 759 | spin_lock(&dcache_lock); |
760 | if (parent) | 760 | if (parent) |
761 | list_add(&dentry->d_child, &parent->d_subdirs); | 761 | list_add(&dentry->d_u.d_child, &parent->d_subdirs); |
762 | dentry_stat.nr_dentry++; | 762 | dentry_stat.nr_dentry++; |
763 | spin_unlock(&dcache_lock); | 763 | spin_unlock(&dcache_lock); |
764 | 764 | ||
@@ -808,10 +808,14 @@ void d_instantiate(struct dentry *entry, struct inode * inode) | |||
808 | * | 808 | * |
809 | * Fill in inode information in the entry. On success, it returns NULL. | 809 | * Fill in inode information in the entry. On success, it returns NULL. |
810 | * If an unhashed alias of "entry" already exists, then we return the | 810 | * If an unhashed alias of "entry" already exists, then we return the |
811 | * aliased dentry instead. | 811 | * aliased dentry instead and drop one reference to inode. |
812 | * | 812 | * |
813 | * Note that in order to avoid conflicts with rename() etc, the caller | 813 | * Note that in order to avoid conflicts with rename() etc, the caller |
814 | * had better be holding the parent directory semaphore. | 814 | * had better be holding the parent directory semaphore. |
815 | * | ||
816 | * This also assumes that the inode count has been incremented | ||
817 | * (or otherwise set) by the caller to indicate that it is now | ||
818 | * in use by the dcache. | ||
815 | */ | 819 | */ |
816 | struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) | 820 | struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) |
817 | { | 821 | { |
@@ -838,6 +842,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) | |||
838 | dget_locked(alias); | 842 | dget_locked(alias); |
839 | spin_unlock(&dcache_lock); | 843 | spin_unlock(&dcache_lock); |
840 | BUG_ON(!d_unhashed(alias)); | 844 | BUG_ON(!d_unhashed(alias)); |
845 | iput(inode); | ||
841 | return alias; | 846 | return alias; |
842 | } | 847 | } |
843 | list_add(&entry->d_alias, &inode->i_dentry); | 848 | list_add(&entry->d_alias, &inode->i_dentry); |
@@ -1310,8 +1315,8 @@ already_unhashed: | |||
1310 | /* Unhash the target: dput() will then get rid of it */ | 1315 | /* Unhash the target: dput() will then get rid of it */ |
1311 | __d_drop(target); | 1316 | __d_drop(target); |
1312 | 1317 | ||
1313 | list_del(&dentry->d_child); | 1318 | list_del(&dentry->d_u.d_child); |
1314 | list_del(&target->d_child); | 1319 | list_del(&target->d_u.d_child); |
1315 | 1320 | ||
1316 | /* Switch the names.. */ | 1321 | /* Switch the names.. */ |
1317 | switch_names(dentry, target); | 1322 | switch_names(dentry, target); |
@@ -1322,15 +1327,15 @@ already_unhashed: | |||
1322 | if (IS_ROOT(dentry)) { | 1327 | if (IS_ROOT(dentry)) { |
1323 | dentry->d_parent = target->d_parent; | 1328 | dentry->d_parent = target->d_parent; |
1324 | target->d_parent = target; | 1329 | target->d_parent = target; |
1325 | INIT_LIST_HEAD(&target->d_child); | 1330 | INIT_LIST_HEAD(&target->d_u.d_child); |
1326 | } else { | 1331 | } else { |
1327 | do_switch(dentry->d_parent, target->d_parent); | 1332 | do_switch(dentry->d_parent, target->d_parent); |
1328 | 1333 | ||
1329 | /* And add them back to the (new) parent lists */ | 1334 | /* And add them back to the (new) parent lists */ |
1330 | list_add(&target->d_child, &target->d_parent->d_subdirs); | 1335 | list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); |
1331 | } | 1336 | } |
1332 | 1337 | ||
1333 | list_add(&dentry->d_child, &dentry->d_parent->d_subdirs); | 1338 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); |
1334 | spin_unlock(&target->d_lock); | 1339 | spin_unlock(&target->d_lock); |
1335 | spin_unlock(&dentry->d_lock); | 1340 | spin_unlock(&dentry->d_lock); |
1336 | write_sequnlock(&rename_lock); | 1341 | write_sequnlock(&rename_lock); |
@@ -1568,7 +1573,7 @@ repeat: | |||
1568 | resume: | 1573 | resume: |
1569 | while (next != &this_parent->d_subdirs) { | 1574 | while (next != &this_parent->d_subdirs) { |
1570 | struct list_head *tmp = next; | 1575 | struct list_head *tmp = next; |
1571 | struct dentry *dentry = list_entry(tmp, struct dentry, d_child); | 1576 | struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); |
1572 | next = tmp->next; | 1577 | next = tmp->next; |
1573 | if (d_unhashed(dentry)||!dentry->d_inode) | 1578 | if (d_unhashed(dentry)||!dentry->d_inode) |
1574 | continue; | 1579 | continue; |
@@ -1579,7 +1584,7 @@ resume: | |||
1579 | atomic_dec(&dentry->d_count); | 1584 | atomic_dec(&dentry->d_count); |
1580 | } | 1585 | } |
1581 | if (this_parent != root) { | 1586 | if (this_parent != root) { |
1582 | next = this_parent->d_child.next; | 1587 | next = this_parent->d_u.d_child.next; |
1583 | atomic_dec(&this_parent->d_count); | 1588 | atomic_dec(&this_parent->d_count); |
1584 | this_parent = this_parent->d_parent; | 1589 | this_parent = this_parent->d_parent; |
1585 | goto resume; | 1590 | goto resume; |