Commit 02618164 authored by Al Viro's avatar Al Viro Committed by Ben Hutchings

move d_rcu from overlapping d_child to overlapping d_alias

commit 946e51f2 upstream.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
[bwh: Backported to 3.2:
 - Apply name changes in all the different places we use d_alias and d_child
 - Move the WARN_ON() in __d_free() to d_free() as we don't have dentry_free()]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 060d1132
...@@ -165,7 +165,7 @@ static void spufs_prune_dir(struct dentry *dir) ...@@ -165,7 +165,7 @@ static void spufs_prune_dir(struct dentry *dir)
struct dentry *dentry, *tmp; struct dentry *dentry, *tmp;
mutex_lock(&dir->d_inode->i_mutex); mutex_lock(&dir->d_inode->i_mutex);
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
if (!(d_unhashed(dentry)) && dentry->d_inode) { if (!(d_unhashed(dentry)) && dentry->d_inode) {
dget_dlock(dentry); dget_dlock(dentry);
...@@ -223,7 +223,7 @@ static int spufs_fill_dir(struct dentry *dir, ...@@ -223,7 +223,7 @@ static int spufs_fill_dir(struct dentry *dir,
* - free child's inode if possible * - free child's inode if possible
* - free child * - free child
*/ */
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
dput(dentry); dput(dentry);
} }
......
...@@ -212,7 +212,7 @@ static void update_bus(struct dentry *bus) ...@@ -212,7 +212,7 @@ static void update_bus(struct dentry *bus)
mutex_lock(&bus->d_inode->i_mutex); mutex_lock(&bus->d_inode->i_mutex);
list_for_each_entry(dev, &bus->d_subdirs, d_u.d_child) list_for_each_entry(dev, &bus->d_subdirs, d_child)
if (dev->d_inode) if (dev->d_inode)
update_dev(dev); update_dev(dev);
...@@ -229,7 +229,7 @@ static void update_sb(struct super_block *sb) ...@@ -229,7 +229,7 @@ static void update_sb(struct super_block *sb)
mutex_lock_nested(&root->d_inode->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&root->d_inode->i_mutex, I_MUTEX_PARENT);
list_for_each_entry(bus, &root->d_subdirs, d_u.d_child) { list_for_each_entry(bus, &root->d_subdirs, d_child) {
if (bus->d_inode) { if (bus->d_inode) {
switch (S_IFMT & bus->d_inode->i_mode) { switch (S_IFMT & bus->d_inode->i_mode) {
case S_IFDIR: case S_IFDIR:
...@@ -345,7 +345,7 @@ static int usbfs_empty (struct dentry *dentry) ...@@ -345,7 +345,7 @@ static int usbfs_empty (struct dentry *dentry)
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
list_for_each(list, &dentry->d_subdirs) { list_for_each(list, &dentry->d_subdirs) {
struct dentry *de = list_entry(list, struct dentry, d_u.d_child); struct dentry *de = list_entry(list, struct dentry, d_child);
spin_lock_nested(&de->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&de->d_lock, DENTRY_D_LOCK_NESTED);
if (usbfs_positive(de)) { if (usbfs_positive(de)) {
......
...@@ -81,7 +81,7 @@ static struct dentry *v9fs_dentry_from_dir_inode(struct inode *inode) ...@@ -81,7 +81,7 @@ static struct dentry *v9fs_dentry_from_dir_inode(struct inode *inode)
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
/* Directory should have only one entry. */ /* Directory should have only one entry. */
BUG_ON(S_ISDIR(inode->i_mode) && !list_is_singular(&inode->i_dentry)); BUG_ON(S_ISDIR(inode->i_mode) && !list_is_singular(&inode->i_dentry));
dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias); dentry = list_entry(inode->i_dentry.next, struct dentry, d_u.d_alias);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
return dentry; return dentry;
} }
......
...@@ -132,7 +132,7 @@ affs_fix_dcache(struct dentry *dentry, u32 entry_ino) ...@@ -132,7 +132,7 @@ affs_fix_dcache(struct dentry *dentry, u32 entry_ino)
head = &inode->i_dentry; head = &inode->i_dentry;
next = head->next; next = head->next;
while (next != head) { while (next != head) {
dentry = list_entry(next, struct dentry, d_alias); dentry = list_entry(next, struct dentry, d_u.d_alias);
if (entry_ino == (u32)(long)dentry->d_fsdata) { if (entry_ino == (u32)(long)dentry->d_fsdata) {
dentry->d_fsdata = data; dentry->d_fsdata = data;
break; break;
......
...@@ -100,7 +100,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, ...@@ -100,7 +100,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev,
p = prev; p = prev;
spin_lock(&p->d_lock); spin_lock(&p->d_lock);
again: again:
next = p->d_u.d_child.next; next = p->d_child.next;
start: start:
if (next == &root->d_subdirs) { if (next == &root->d_subdirs) {
spin_unlock(&p->d_lock); spin_unlock(&p->d_lock);
...@@ -109,7 +109,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, ...@@ -109,7 +109,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev,
return NULL; return NULL;
} }
q = list_entry(next, struct dentry, d_u.d_child); q = list_entry(next, struct dentry, d_child);
spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
/* Negative dentry - try next */ /* Negative dentry - try next */
...@@ -165,13 +165,13 @@ static struct dentry *get_next_positive_dentry(struct dentry *prev, ...@@ -165,13 +165,13 @@ static struct dentry *get_next_positive_dentry(struct dentry *prev,
goto relock; goto relock;
} }
spin_unlock(&p->d_lock); spin_unlock(&p->d_lock);
next = p->d_u.d_child.next; next = p->d_child.next;
p = parent; p = parent;
if (next != &parent->d_subdirs) if (next != &parent->d_subdirs)
break; break;
} }
} }
ret = list_entry(next, struct dentry, d_u.d_child); ret = list_entry(next, struct dentry, d_child);
spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED);
/* Negative dentry - try next */ /* Negative dentry - try next */
...@@ -455,7 +455,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, ...@@ -455,7 +455,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
spin_lock(&sbi->lookup_lock); spin_lock(&sbi->lookup_lock);
spin_lock(&expired->d_parent->d_lock); spin_lock(&expired->d_parent->d_lock);
spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED);
list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); list_move(&expired->d_parent->d_subdirs, &expired->d_child);
spin_unlock(&expired->d_lock); spin_unlock(&expired->d_lock);
spin_unlock(&expired->d_parent->d_lock); spin_unlock(&expired->d_parent->d_lock);
spin_unlock(&sbi->lookup_lock); spin_unlock(&sbi->lookup_lock);
......
...@@ -651,7 +651,7 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry) ...@@ -651,7 +651,7 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
/* only consider parents below dentrys in the root */ /* only consider parents below dentrys in the root */
if (IS_ROOT(parent->d_parent)) if (IS_ROOT(parent->d_parent))
return; return;
d_child = &dentry->d_u.d_child; d_child = &dentry->d_child;
/* Set parent managed if it's becoming empty */ /* Set parent managed if it's becoming empty */
if (d_child->next == &parent->d_subdirs && if (d_child->next == &parent->d_subdirs &&
d_child->prev == &parent->d_subdirs) d_child->prev == &parent->d_subdirs)
......
...@@ -104,7 +104,7 @@ static unsigned fpos_off(loff_t p) ...@@ -104,7 +104,7 @@ static unsigned fpos_off(loff_t p)
/* /*
* When possible, we try to satisfy a readdir by peeking at the * When possible, we try to satisfy a readdir by peeking at the
* dcache. We make this work by carefully ordering dentries on * dcache. We make this work by carefully ordering dentries on
* d_u.d_child when we initially get results back from the MDS, and * d_child when we initially get results back from the MDS, and
* falling back to a "normal" sync readdir if any dentries in the dir * falling back to a "normal" sync readdir if any dentries in the dir
* are dropped. * are dropped.
* *
...@@ -140,11 +140,11 @@ static int __dcache_readdir(struct file *filp, ...@@ -140,11 +140,11 @@ static int __dcache_readdir(struct file *filp,
p = parent->d_subdirs.prev; p = parent->d_subdirs.prev;
dout(" initial p %p/%p\n", p->prev, p->next); dout(" initial p %p/%p\n", p->prev, p->next);
} else { } else {
p = last->d_u.d_child.prev; p = last->d_child.prev;
} }
more: more:
dentry = list_entry(p, struct dentry, d_u.d_child); dentry = list_entry(p, struct dentry, d_child);
di = ceph_dentry(dentry); di = ceph_dentry(dentry);
while (1) { while (1) {
dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next, dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next,
...@@ -166,7 +166,7 @@ static int __dcache_readdir(struct file *filp, ...@@ -166,7 +166,7 @@ static int __dcache_readdir(struct file *filp,
!dentry->d_inode ? " null" : ""); !dentry->d_inode ? " null" : "");
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
p = p->prev; p = p->prev;
dentry = list_entry(p, struct dentry, d_u.d_child); dentry = list_entry(p, struct dentry, d_child);
di = ceph_dentry(dentry); di = ceph_dentry(dentry);
} }
......
...@@ -868,9 +868,9 @@ static void ceph_set_dentry_offset(struct dentry *dn) ...@@ -868,9 +868,9 @@ static void ceph_set_dentry_offset(struct dentry *dn)
spin_lock(&dir->d_lock); spin_lock(&dir->d_lock);
spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED);
list_move(&dn->d_u.d_child, &dir->d_subdirs); list_move(&dn->d_child, &dir->d_subdirs);
dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset,
dn->d_u.d_child.prev, dn->d_u.d_child.next); dn->d_child.prev, dn->d_child.next);
spin_unlock(&dn->d_lock); spin_unlock(&dn->d_lock);
spin_unlock(&dir->d_lock); spin_unlock(&dir->d_lock);
} }
...@@ -1256,7 +1256,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, ...@@ -1256,7 +1256,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
/* reorder parent's d_subdirs */ /* reorder parent's d_subdirs */
spin_lock(&parent->d_lock); spin_lock(&parent->d_lock);
spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED);
list_move(&dn->d_u.d_child, &parent->d_subdirs); list_move(&dn->d_child, &parent->d_subdirs);
spin_unlock(&dn->d_lock); spin_unlock(&dn->d_lock);
spin_unlock(&parent->d_lock); spin_unlock(&parent->d_lock);
} }
......
...@@ -823,7 +823,7 @@ inode_has_hashed_dentries(struct inode *inode) ...@@ -823,7 +823,7 @@ inode_has_hashed_dentries(struct inode *inode)
struct dentry *dentry; struct dentry *dentry;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
list_for_each_entry(dentry, &inode->i_dentry, d_alias) { list_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
if (!d_unhashed(dentry) || IS_ROOT(dentry)) { if (!d_unhashed(dentry) || IS_ROOT(dentry)) {
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
return true; return true;
......
...@@ -95,7 +95,7 @@ static void coda_flag_children(struct dentry *parent, int flag) ...@@ -95,7 +95,7 @@ static void coda_flag_children(struct dentry *parent, int flag)
spin_lock(&parent->d_lock); spin_lock(&parent->d_lock);
list_for_each(child, &parent->d_subdirs) list_for_each(child, &parent->d_subdirs)
{ {
de = list_entry(child, struct dentry, d_u.d_child); de = list_entry(child, struct dentry, d_child);
/* don't know what to do with negative dentries */ /* don't know what to do with negative dentries */
if ( ! de->d_inode ) if ( ! de->d_inode )
continue; continue;
......
This diff is collapsed.
...@@ -399,7 +399,7 @@ void debugfs_remove_recursive(struct dentry *dentry) ...@@ -399,7 +399,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
* use the d_u.d_child as the rcu head and corrupt this list. * use the d_u.d_child as the rcu head and corrupt this list.
*/ */
spin_lock(&parent->d_lock); spin_lock(&parent->d_lock);
list_for_each_entry(child, &parent->d_subdirs, d_u.d_child) { list_for_each_entry(child, &parent->d_subdirs, d_child) {
if (!debugfs_positive(child)) if (!debugfs_positive(child))
continue; continue;
......
...@@ -50,7 +50,7 @@ find_acceptable_alias(struct dentry *result, ...@@ -50,7 +50,7 @@ find_acceptable_alias(struct dentry *result,
inode = result->d_inode; inode = result->d_inode;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
list_for_each_entry(dentry, &inode->i_dentry, d_alias) { list_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
dget(dentry); dget(dentry);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
if (toput) if (toput)
......
...@@ -139,7 +139,7 @@ static int ext4_sync_parent(struct inode *inode) ...@@ -139,7 +139,7 @@ static int ext4_sync_parent(struct inode *inode)
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (!list_empty(&inode->i_dentry)) { if (!list_empty(&inode->i_dentry)) {
dentry = list_first_entry(&inode->i_dentry, dentry = list_first_entry(&inode->i_dentry,
struct dentry, d_alias); struct dentry, d_u.d_alias);
dget(dentry); dget(dentry);
} }
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
......
...@@ -104,18 +104,18 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin) ...@@ -104,18 +104,18 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
/* d_lock not required for cursor */ /* d_lock not required for cursor */
list_del(&cursor->d_u.d_child); list_del(&cursor->d_child);
p = dentry->d_subdirs.next; p = dentry->d_subdirs.next;
while (n && p != &dentry->d_subdirs) { while (n && p != &dentry->d_subdirs) {
struct dentry *next; struct dentry *next;
next = list_entry(p, struct dentry, d_u.d_child); next = list_entry(p, struct dentry, d_child);
spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
if (simple_positive(next)) if (simple_positive(next))
n--; n--;
spin_unlock(&next->d_lock); spin_unlock(&next->d_lock);
p = p->next; p = p->next;
} }
list_add_tail(&cursor->d_u.d_child, p); list_add_tail(&cursor->d_child, p);
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
} }
} }
...@@ -139,7 +139,7 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -139,7 +139,7 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
{ {
struct dentry *dentry = filp->f_path.dentry; struct dentry *dentry = filp->f_path.dentry;
struct dentry *cursor = filp->private_data; struct dentry *cursor = filp->private_data;
struct list_head *p, *q = &cursor->d_u.d_child; struct list_head *p, *q = &cursor->d_child;
ino_t ino; ino_t ino;
int i = filp->f_pos; int i = filp->f_pos;
...@@ -165,7 +165,7 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -165,7 +165,7 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
for (p=q->next; p != &dentry->d_subdirs; p=p->next) { for (p=q->next; p != &dentry->d_subdirs; p=p->next) {
struct dentry *next; struct dentry *next;
next = list_entry(p, struct dentry, d_u.d_child); next = list_entry(p, struct dentry, d_child);
spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
if (!simple_positive(next)) { if (!simple_positive(next)) {
spin_unlock(&next->d_lock); spin_unlock(&next->d_lock);
...@@ -282,7 +282,7 @@ int simple_empty(struct dentry *dentry) ...@@ -282,7 +282,7 @@ int simple_empty(struct dentry *dentry)
int ret = 0; int ret = 0;
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) { list_for_each_entry(child, &dentry->d_subdirs, d_child) {
spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
if (simple_positive(child)) { if (simple_positive(child)) {
spin_unlock(&child->d_lock); spin_unlock(&child->d_lock);
......
...@@ -391,7 +391,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos) ...@@ -391,7 +391,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
spin_lock(&parent->d_lock); spin_lock(&parent->d_lock);
next = parent->d_subdirs.next; next = parent->d_subdirs.next;
while (next != &parent->d_subdirs) { while (next != &parent->d_subdirs) {
dent = list_entry(next, struct dentry, d_u.d_child); dent = list_entry(next, struct dentry, d_child);
if ((unsigned long)dent->d_fsdata == fpos) { if ((unsigned long)dent->d_fsdata == fpos) {
if (dent->d_inode) if (dent->d_inode)
dget(dent); dget(dent);
......
...@@ -194,7 +194,7 @@ ncp_renew_dentries(struct dentry *parent) ...@@ -194,7 +194,7 @@ ncp_renew_dentries(struct dentry *parent)
spin_lock(&parent->d_lock); spin_lock(&parent->d_lock);
next = parent->d_subdirs.next; next = parent->d_subdirs.next;
while (next != &parent->d_subdirs) { while (next != &parent->d_subdirs) {
dentry = list_entry(next, struct dentry, d_u.d_child); dentry = list_entry(next, struct dentry, d_child);
if (dentry->d_fsdata == NULL) if (dentry->d_fsdata == NULL)
ncp_age_dentry(server, dentry); ncp_age_dentry(server, dentry);
...@@ -216,7 +216,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent) ...@@ -216,7 +216,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent)
spin_lock(&parent->d_lock); spin_lock(&parent->d_lock);
next = parent->d_subdirs.next; next = parent->d_subdirs.next;
while (next != &parent->d_subdirs) { while (next != &parent->d_subdirs) {
dentry = list_entry(next, struct dentry, d_u.d_child); dentry = list_entry(next, struct dentry, d_child);
dentry->d_fsdata = NULL; dentry->d_fsdata = NULL;
ncp_age_dentry(server, dentry); ncp_age_dentry(server, dentry);
next = next->next; next = next->next;
......
...@@ -65,7 +65,7 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i ...@@ -65,7 +65,7 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
*/ */
spin_lock(&sb->s_root->d_inode->i_lock); spin_lock(&sb->s_root->d_inode->i_lock);
spin_lock(&sb->s_root->d_lock); spin_lock(&sb->s_root->d_lock);
list_del_init(&sb->s_root->d_alias); list_del_init(&sb->s_root->d_u.d_alias);
spin_unlock(&sb->s_root->d_lock); spin_unlock(&sb->s_root->d_lock);
spin_unlock(&sb->s_root->d_inode->i_lock); spin_unlock(&sb->s_root->d_inode->i_lock);
} }
......
...@@ -62,14 +62,14 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode) ...@@ -62,14 +62,14 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode)
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
/* run all of the dentries associated with this inode. Since this is a /* run all of the dentries associated with this inode. Since this is a
* directory, there damn well better only be one item on this list */ * directory, there damn well better only be one item on this list */
list_for_each_entry(alias, &inode->i_dentry, d_alias) { list_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
struct dentry *child; struct dentry *child;
/* run all of the children of the original inode and fix their /* run all of the children of the original inode and fix their
* d_flags to indicate parental interest (their parent is the * d_flags to indicate parental interest (their parent is the
* original inode) */ * original inode) */
spin_lock(&alias->d_lock); spin_lock(&alias->d_lock);
list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { list_for_each_entry(child, &alias->d_subdirs, d_child) {
if (!child->d_inode) if (!child->d_inode)
continue; continue;
......
...@@ -175,7 +175,7 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, ...@@ -175,7 +175,7 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode,
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
list_for_each(p, &inode->i_dentry) { list_for_each(p, &inode->i_dentry) {
dentry = list_entry(p, struct dentry, d_alias); dentry = list_entry(p, struct dentry, d_u.d_alias);
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
......
...@@ -133,15 +133,15 @@ struct dentry { ...@@ -133,15 +133,15 @@ struct dentry {
void *d_fsdata; /* fs-specific data */ void *d_fsdata; /* fs-specific data */
struct list_head d_lru; /* LRU list */ struct list_head d_lru; /* LRU list */
struct list_head d_child; /* child of parent list */
struct list_head d_subdirs; /* our children */
/* /*
* d_child and d_rcu can share memory * d_alias and d_rcu can share memory
*/ */
union { union {
struct list_head d_child; /* child of parent list */ struct list_head d_alias; /* inode alias list */
struct rcu_head d_rcu; struct rcu_head d_rcu;
} d_u; } d_u;
struct list_head d_subdirs; /* our children */
struct list_head d_alias; /* inode alias list */
}; };
/* /*
......
...@@ -881,7 +881,7 @@ static void cgroup_clear_directory(struct dentry *dentry) ...@@ -881,7 +881,7 @@ static void cgroup_clear_directory(struct dentry *dentry)
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
node = dentry->d_subdirs.next; node = dentry->d_subdirs.next;
while (node != &dentry->d_subdirs) { while (node != &dentry->d_subdirs) {
struct dentry *d = list_entry(node, struct dentry, d_u.d_child); struct dentry *d = list_entry(node, struct dentry, d_child);
spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED);
list_del_init(node); list_del_init(node);
...@@ -915,7 +915,7 @@ static void cgroup_d_remove_dir(struct dentry *dentry) ...@@ -915,7 +915,7 @@ static void cgroup_d_remove_dir(struct dentry *dentry)
parent = dentry->d_parent; parent = dentry->d_parent;
spin_lock(&parent->d_lock); spin_lock(&parent->d_lock);
spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
list_del_init(&dentry->d_u.d_child); list_del_init(&dentry->d_child);
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
spin_unlock(&parent->d_lock); spin_unlock(&parent->d_lock);
remove_dir(dentry); remove_dir(dentry);
......
...@@ -1197,7 +1197,7 @@ static void sel_remove_entries(struct dentry *de) ...@@ -1197,7 +1197,7 @@ static void sel_remove_entries(struct dentry *de)
spin_lock(&de->d_lock); spin_lock(&de->d_lock);
node = de->d_subdirs.next; node = de->d_subdirs.next;
while (node != &de->d_subdirs) { while (node != &de->d_subdirs) {
struct dentry *d = list_entry(node, struct dentry, d_u.d_child); struct dentry *d = list_entry(node, struct dentry, d_child);
spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED);
list_del_init(node); list_del_init(node);
...@@ -1704,12 +1704,12 @@ static void sel_remove_classes(void) ...@@ -1704,12 +1704,12 @@ static void sel_remove_classes(void)
list_for_each(class_node, &class_dir->d_subdirs) { list_for_each(class_node, &class_dir->d_subdirs) {
struct dentry *class_subdir = list_entry(class_node, struct dentry *class_subdir = list_entry(class_node,
struct dentry, d_u.d_child); struct dentry, d_child);
struct list_head *class_subdir_node; struct list_head *class_subdir_node;
list_for_each(class_subdir_node, &class_subdir->d_subdirs) { list_for_each(class_subdir_node, &class_subdir->d_subdirs) {
struct dentry *d = list_entry(class_subdir_node, struct dentry *d = list_entry(class_subdir_node,
struct dentry, d_u.d_child); struct dentry, d_child);
if (d->d_inode) if (d->d_inode)
if (d->d_inode->i_mode & S_IFDIR) if (d->d_inode->i_mode & S_IFDIR)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment