Skip to content

Commit 6fa67e7

Browse files
author
Al Viro
committed
get rid of 'parent' argument of ->d_compare()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent d3fe198 commit 6fa67e7

22 files changed

Lines changed: 40 additions & 38 deletions

File tree

‎Documentation/filesystems/Locking‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ prototypes:
1212
int (*d_revalidate)(struct dentry *, unsigned int);
1313
int (*d_weak_revalidate)(struct dentry *, unsigned int);
1414
int (*d_hash)(const struct dentry *, struct qstr *);
15-
int (*d_compare)(const struct dentry *, const struct dentry *,
15+
int (*d_compare)(const struct dentry *,
1616
unsigned int, const char *, const struct qstr *);
1717
int (*d_delete)(struct dentry *);
1818
int (*d_init)(struct dentry *);

‎Documentation/filesystems/porting‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,10 @@ in your dentry operations instead.
585585
in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
586586
called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack
587587
->d_instantiate() uses not just ->getxattr() but ->setxattr() as well.
588+
--
589+
[mandatory]
590+
->d_compare() doesn't get parent as a separate argument anymore. If you
591+
used it for finding the struct super_block involved, dentry->d_sb will
592+
work just as well; if it's something more complicated, use dentry->d_parent.
593+
Just be careful not to assume that fetching it more than once will yield
594+
the same value - in RCU mode it could change under you.

‎Documentation/filesystems/vfs.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ struct dentry_operations {
931931
int (*d_revalidate)(struct dentry *, unsigned int);
932932
int (*d_weak_revalidate)(struct dentry *, unsigned int);
933933
int (*d_hash)(const struct dentry *, struct qstr *);
934-
int (*d_compare)(const struct dentry *, const struct dentry *,
934+
int (*d_compare)(const struct dentry *,
935935
unsigned int, const char *, const struct qstr *);
936936
int (*d_delete)(const struct dentry *);
937937
int (*d_init)(struct dentry *);

‎drivers/staging/lustre/lustre/llite/dcache.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void ll_release(struct dentry *de)
7878
* INVALID) so d_lookup() matches it, but we have no lock on it (so
7979
* lock_match() fails) and we spin around real_lookup().
8080
*/
81-
static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
81+
static int ll_dcompare(const struct dentry *dentry,
8282
unsigned int len, const char *str,
8383
const struct qstr *name)
8484
{

‎fs/adfs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ adfs_hash(const struct dentry *parent, struct qstr *qstr)
227227
* requirements of the underlying filesystem.
228228
*/
229229
static int
230-
adfs_compare(const struct dentry *parent, const struct dentry *dentry,
230+
adfs_compare(const struct dentry *dentry,
231231
unsigned int len, const char *str, const struct qstr *name)
232232
{
233233
int i;

‎fs/affs/namei.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ typedef int (*toupper_t)(int);
1414

1515
static int affs_toupper(int ch);
1616
static int affs_hash_dentry(const struct dentry *, struct qstr *);
17-
static int affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
17+
static int affs_compare_dentry(const struct dentry *dentry,
1818
unsigned int len, const char *str, const struct qstr *name);
1919
static int affs_intl_toupper(int ch);
2020
static int affs_intl_hash_dentry(const struct dentry *, struct qstr *);
21-
static int affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
21+
static int affs_intl_compare_dentry(const struct dentry *dentry,
2222
unsigned int len, const char *str, const struct qstr *name);
2323

2424
const struct dentry_operations affs_dentry_operations = {
@@ -131,7 +131,7 @@ static inline int __affs_compare_dentry(unsigned int len,
131131
}
132132

133133
static int
134-
affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
134+
affs_compare_dentry(const struct dentry *dentry,
135135
unsigned int len, const char *str, const struct qstr *name)
136136
{
137137

@@ -140,7 +140,7 @@ affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
140140
}
141141

142142
static int
143-
affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
143+
affs_intl_compare_dentry(const struct dentry *dentry,
144144
unsigned int len, const char *str, const struct qstr *name)
145145
{
146146
return __affs_compare_dentry(len, str, name, affs_intl_toupper,

‎fs/cifs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ static int cifs_ci_hash(const struct dentry *dentry, struct qstr *q)
903903
return 0;
904904
}
905905

906-
static int cifs_ci_compare(const struct dentry *parent, const struct dentry *dentry,
906+
static int cifs_ci_compare(const struct dentry *dentry,
907907
unsigned int len, const char *str, const struct qstr *name)
908908
{
909909
struct nls_table *codepage = CIFS_SB(dentry->d_sb)->local_nls;

‎fs/dcache.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ static inline bool d_same_name(const struct dentry *dentry,
20472047
return false;
20482048
return dentry_cmp(dentry, name->name, name->len) == 0;
20492049
}
2050-
return parent->d_op->d_compare(parent, dentry,
2050+
return parent->d_op->d_compare(dentry,
20512051
dentry->d_name.len, dentry->d_name.name,
20522052
name) == 0;
20532053
}
@@ -2150,7 +2150,7 @@ struct dentry *__d_lookup_rcu(const struct dentry *parent,
21502150
cpu_relax();
21512151
goto seqretry;
21522152
}
2153-
if (parent->d_op->d_compare(parent, dentry,
2153+
if (parent->d_op->d_compare(dentry,
21542154
tlen, tname, name) != 0)
21552155
continue;
21562156
} else {

‎fs/efivarfs/super.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ static struct super_block *efivarfs_sb;
4545
* So we need to perform a case-sensitive match on part 1 and a
4646
* case-insensitive match on part 2.
4747
*/
48-
static int efivarfs_d_compare(const struct dentry *parent,
49-
const struct dentry *dentry,
48+
static int efivarfs_d_compare(const struct dentry *dentry,
5049
unsigned int len, const char *str,
5150
const struct qstr *name)
5251
{

‎fs/fat/namei_msdos.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static int msdos_hash(const struct dentry *dentry, struct qstr *qstr)
162162
* Compare two msdos names. If either of the names are invalid,
163163
* we fall back to doing the standard name comparison.
164164
*/
165-
static int msdos_cmp(const struct dentry *parent, const struct dentry *dentry,
165+
static int msdos_cmp(const struct dentry *dentry,
166166
unsigned int len, const char *str, const struct qstr *name)
167167
{
168168
struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options;

0 commit comments

Comments
 (0)