Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

struct dentry: make ->d_u anonymous

Making ->d_rcu and (then) ->d_child overlapping dates back to
2006; anon unions support had been added to gcc only in 4.6
(2011) and the minimal gcc version hadn't been bumped to that
until 4.19 (2018).

These days there's no reason not to keep that union named.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 2420067c 408d8af0

+30 -30
+1 -1
fs/ceph/mds_client.c
··· 4608 4608 goto out_unlock; 4609 4609 4610 4610 if (S_ISDIR(inode->i_mode)) { 4611 - alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); 4611 + alias = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); 4612 4612 if (!IS_ROOT(alias)) 4613 4613 dn = dget(alias); 4614 4614 goto out_unlock;
+24 -24
fs/dcache.c
··· 40 40 /* 41 41 * Usage: 42 42 * dcache->d_inode->i_lock protects: 43 - * - i_dentry, d_u.d_alias, d_inode of aliases 43 + * - i_dentry, d_alias, d_inode of aliases 44 44 * dcache_hash_bucket lock protects: 45 45 * - the dcache hash table 46 46 * s_roots bl list spinlock protects: ··· 55 55 * - d_unhashed() 56 56 * - d_parent and d_chilren 57 57 * - childrens' d_sib and d_parent 58 - * - d_u.d_alias, d_inode 58 + * - d_alias, d_inode 59 59 * 60 60 * Ordering: 61 61 * dentry->d_inode->i_lock ··· 341 341 342 342 static void __d_free(struct rcu_head *head) 343 343 { 344 - struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); 344 + struct dentry *dentry = container_of(head, struct dentry, d_rcu); 345 345 346 346 kmem_cache_free(dentry_cache, dentry); 347 347 } 348 348 349 349 static void __d_free_external(struct rcu_head *head) 350 350 { 351 - struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); 351 + struct dentry *dentry = container_of(head, struct dentry, d_rcu); 352 352 kfree(external_name(dentry)); 353 353 kmem_cache_free(dentry_cache, dentry); 354 354 } ··· 428 428 429 429 static void dentry_free(struct dentry *dentry) 430 430 { 431 - WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias)); 431 + WARN_ON(!hlist_unhashed(&dentry->d_alias)); 432 432 if (unlikely(dname_external(dentry))) { 433 433 struct external_name *p = external_name(dentry); 434 434 if (likely(atomic_dec_and_test(&p->count))) { 435 - call_rcu(&dentry->d_u.d_rcu, __d_free_external); 435 + call_rcu(&dentry->d_rcu, __d_free_external); 436 436 return; 437 437 } 438 438 } 439 439 /* if dentry was never visible to RCU, immediate free is OK */ 440 440 if (dentry->d_flags & DCACHE_NORCU) 441 - __d_free(&dentry->d_u.d_rcu); 441 + __d_free(&dentry->d_rcu); 442 442 else 443 - call_rcu(&dentry->d_u.d_rcu, __d_free); 443 + call_rcu(&dentry->d_rcu, __d_free); 444 444 } 445 445 446 446 /* ··· 455 455 456 456 raw_write_seqcount_begin(&dentry->d_seq); 457 457 __d_clear_type_and_inode(dentry); 458 - hlist_del_init(&dentry->d_u.d_alias); 458 + hlist_del_init(&dentry->d_alias); 459 459 raw_write_seqcount_end(&dentry->d_seq); 460 460 spin_unlock(&dentry->d_lock); 461 461 spin_unlock(&inode->i_lock); ··· 1010 1010 1011 1011 if (hlist_empty(&inode->i_dentry)) 1012 1012 return NULL; 1013 - alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); 1013 + alias = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); 1014 1014 lockref_get(&alias->d_lockref); 1015 1015 return alias; 1016 1016 } ··· 1093 1093 // used without having I_FREEING set, which means no aliases left 1094 1094 if (likely(!(inode_state_read(inode) & I_FREEING) && !hlist_empty(l))) { 1095 1095 if (S_ISDIR(inode->i_mode)) { 1096 - de = hlist_entry(l->first, struct dentry, d_u.d_alias); 1096 + de = hlist_entry(l->first, struct dentry, d_alias); 1097 1097 } else { 1098 - hlist_for_each_entry(de, l, d_u.d_alias) 1098 + hlist_for_each_entry(de, l, d_alias) 1099 1099 if (!d_unhashed(de)) 1100 1100 break; 1101 1101 } ··· 1787 1787 INIT_HLIST_BL_NODE(&dentry->d_hash); 1788 1788 INIT_LIST_HEAD(&dentry->d_lru); 1789 1789 INIT_HLIST_HEAD(&dentry->d_children); 1790 - INIT_HLIST_NODE(&dentry->d_u.d_alias); 1790 + INIT_HLIST_NODE(&dentry->d_alias); 1791 1791 INIT_HLIST_NODE(&dentry->d_sib); 1792 1792 1793 1793 if (dentry->d_op && dentry->d_op->d_init) { ··· 1980 1980 if ((dentry->d_flags & 1981 1981 (DCACHE_LRU_LIST|DCACHE_SHRINK_LIST)) == DCACHE_LRU_LIST) 1982 1982 this_cpu_dec(nr_dentry_negative); 1983 - hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); 1983 + hlist_add_head(&dentry->d_alias, &inode->i_dentry); 1984 1984 raw_write_seqcount_begin(&dentry->d_seq); 1985 1985 __d_set_inode_and_type(dentry, inode, add_flags); 1986 1986 raw_write_seqcount_end(&dentry->d_seq); ··· 2004 2004 2005 2005 void d_instantiate(struct dentry *entry, struct inode * inode) 2006 2006 { 2007 - BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); 2007 + BUG_ON(!hlist_unhashed(&entry->d_alias)); 2008 2008 if (inode) { 2009 2009 security_d_instantiate(entry, inode); 2010 2010 spin_lock(&inode->i_lock); ··· 2024 2024 */ 2025 2025 void d_instantiate_new(struct dentry *entry, struct inode *inode) 2026 2026 { 2027 - BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); 2027 + BUG_ON(!hlist_unhashed(&entry->d_alias)); 2028 2028 BUG_ON(!inode); 2029 2029 lockdep_annotate_inode_mutex_key(inode); 2030 2030 security_d_instantiate(entry, inode); ··· 2087 2087 2088 2088 spin_lock(&new->d_lock); 2089 2089 __d_set_inode_and_type(new, inode, add_flags); 2090 - hlist_add_head(&new->d_u.d_alias, &inode->i_dentry); 2090 + hlist_add_head(&new->d_alias, &inode->i_dentry); 2091 2091 if (!disconnected) { 2092 2092 hlist_bl_lock(&sb->s_roots); 2093 2093 hlist_bl_add_head(&new->d_hash, &sb->s_roots); ··· 2658 2658 * we unlock the chain. All fields are stable in everything 2659 2659 * we encounter. 2660 2660 */ 2661 - hlist_bl_for_each_entry(dentry, node, b, d_u.d_in_lookup_hash) { 2661 + hlist_bl_for_each_entry(dentry, node, b, d_in_lookup_hash) { 2662 2662 if (dentry->d_name.hash != hash) 2663 2663 continue; 2664 2664 if (dentry->d_parent != parent) ··· 2700 2700 } 2701 2701 rcu_read_unlock(); 2702 2702 new->d_wait = wq; 2703 - hlist_bl_add_head(&new->d_u.d_in_lookup_hash, b); 2703 + hlist_bl_add_head(&new->d_in_lookup_hash, b); 2704 2704 hlist_bl_unlock(b); 2705 2705 return new; 2706 2706 mismatch: ··· 2725 2725 b = in_lookup_hash(dentry->d_parent, dentry->d_name.hash); 2726 2726 hlist_bl_lock(b); 2727 2727 dentry->d_flags &= ~DCACHE_PAR_LOOKUP; 2728 - __hlist_bl_del(&dentry->d_u.d_in_lookup_hash); 2728 + __hlist_bl_del(&dentry->d_in_lookup_hash); 2729 2729 d_wait = dentry->d_wait; 2730 2730 dentry->d_wait = NULL; 2731 2731 hlist_bl_unlock(b); 2732 - INIT_HLIST_NODE(&dentry->d_u.d_alias); 2732 + INIT_HLIST_NODE(&dentry->d_alias); 2733 2733 INIT_LIST_HEAD(&dentry->d_lru); 2734 2734 return d_wait; 2735 2735 } ··· 2760 2760 d_set_d_op(dentry, ops); 2761 2761 if (inode) { 2762 2762 unsigned add_flags = d_flags_for_inode(inode); 2763 - hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); 2763 + hlist_add_head(&dentry->d_alias, &inode->i_dentry); 2764 2764 raw_write_seqcount_begin(&dentry->d_seq); 2765 2765 __d_set_inode_and_type(dentry, inode, add_flags); 2766 2766 raw_write_seqcount_end(&dentry->d_seq); ··· 2795 2795 2796 2796 struct dentry *d_make_persistent(struct dentry *dentry, struct inode *inode) 2797 2797 { 2798 - WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias)); 2798 + WARN_ON(!hlist_unhashed(&dentry->d_alias)); 2799 2799 WARN_ON(!inode); 2800 2800 security_d_instantiate(dentry, inode); 2801 2801 spin_lock(&inode->i_lock); ··· 3185 3185 struct dentry *dentry = file->f_path.dentry; 3186 3186 3187 3187 BUG_ON(dname_external(dentry) || 3188 - !hlist_unhashed(&dentry->d_u.d_alias) || 3188 + !hlist_unhashed(&dentry->d_alias) || 3189 3189 !d_unlinked(dentry)); 3190 3190 spin_lock(&dentry->d_parent->d_lock); 3191 3191 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
+1 -1
fs/inode.c
··· 754 754 return; 755 755 } 756 756 757 - dentry_ptr = container_of(dentry_first, struct dentry, d_u.d_alias); 757 + dentry_ptr = container_of(dentry_first, struct dentry, d_alias); 758 758 if (get_kernel_nofault(dentry, dentry_ptr) || 759 759 !dentry.d_parent || !dentry.d_name.name) { 760 760 pr_warn("aops:%ps ino:%lx invalid dentry:%px\n",
+1 -1
fs/nfs/dir.c
··· 1490 1490 if (hlist_empty(&dir->i_dentry)) 1491 1491 return; 1492 1492 this_parent = 1493 - hlist_entry(dir->i_dentry.first, struct dentry, d_u.d_alias); 1493 + hlist_entry(dir->i_dentry.first, struct dentry, d_alias); 1494 1494 1495 1495 spin_lock(&this_parent->d_lock); 1496 1496 nfs_unset_verifier_delegated(&this_parent->d_time);
+1 -1
fs/nfs/getroot.c
··· 54 54 */ 55 55 spin_lock(&d_inode(sb->s_root)->i_lock); 56 56 spin_lock(&sb->s_root->d_lock); 57 - hlist_del_init(&sb->s_root->d_u.d_alias); 57 + hlist_del_init(&sb->s_root->d_alias); 58 58 spin_unlock(&sb->s_root->d_lock); 59 59 spin_unlock(&d_inode(sb->s_root)->i_lock); 60 60 }
+2 -2
include/linux/dcache.h
··· 128 128 struct hlist_node d_alias; /* inode alias list */ 129 129 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */ 130 130 struct rcu_head d_rcu; 131 - } d_u; 131 + }; 132 132 }; 133 133 134 134 /* ··· 617 617 618 618 /* inode->i_lock must be held over that */ 619 619 #define for_each_alias(dentry, inode) \ 620 - hlist_for_each_entry(dentry, &(inode)->i_dentry, d_u.d_alias) 620 + hlist_for_each_entry(dentry, &(inode)->i_dentry, d_alias) 621 621 622 622 #endif /* __LINUX_DCACHE_H */