Skip to content

Commit b9e2780

Browse files
ebiedermtorvalds
authored andcommitted
sysfs: Remove support for tagged directories with untagged members (again)
In commit 8a9ea32 ("Merge git://.../davem/net-next") where my sysfs changes from the net tree merged with the sysfs rbtree changes from Mickulas Patocka the conflict resolution failed to preserve the simplified property that was the point of my changes. That is sysfs_find_dirent can now say something is a match if and only s_name and s_ns match what we are looking for, and sysfs_readdir can simply return all of the directory entries where s_ns matches the directory that we should be returning. Now that we are back to exact matches we can tweak sysfs_find_dirent and the name rb_tree to order sysfs_dirents by s_ns s_name and remove the second loop in sysfs_find_dirent. However that change seems a bit much for a conflict resolution so it can come later. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c9d6329 commit b9e2780

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/sysfs/dir.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
590590
#undef node
591591
}
592592

593-
if (found && ns) {
594-
while (found->s_ns && found->s_ns != ns) {
593+
if (found) {
594+
while (found->s_ns != ns) {
595595
p = rb_next(&found->name_node);
596596
if (!p)
597597
return NULL;
@@ -947,7 +947,7 @@ static struct sysfs_dirent *sysfs_dir_pos(const void *ns,
947947
#undef node
948948
}
949949
}
950-
while (pos && pos->s_ns && pos->s_ns != ns) {
950+
while (pos && pos->s_ns != ns) {
951951
struct rb_node *p = rb_next(&pos->inode_node);
952952
if (!p)
953953
pos = NULL;
@@ -967,7 +967,7 @@ static struct sysfs_dirent *sysfs_dir_next_pos(const void *ns,
967967
pos = NULL;
968968
else
969969
pos = rb_entry(p, struct sysfs_dirent, inode_node);
970-
} while (pos && pos->s_ns && pos->s_ns != ns);
970+
} while (pos && pos->s_ns != ns);
971971
return pos;
972972
}
973973

0 commit comments

Comments
 (0)