diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:27 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:19 -0500 |
commit | 621e155a3591962420eacdd39f6f0aa29ceb221e (patch) | |
tree | 387a9fb396f1bf24514b712c294182e36ba51076 /fs/fat/namei_msdos.c | |
parent | fb2d5b86aff355a27ebfc132d3c99f4a940cc3fe (diff) |
fs: change d_compare for rcu-walk
Change d_compare so it may be called from lock-free RCU lookups. This
does put significant restrictions on what may be done from the callback,
however there don't seem to have been any problems with in-tree fses.
If some strange use case pops up that _really_ cannot cope with the
rcu-walk rules, we can just add new rcu-unaware callbacks, which would
cause name lookup to drop out of rcu-walk mode.
For in-tree filesystems, this is just a mechanical change.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/fat/namei_msdos.c')
-rw-r--r-- | fs/fat/namei_msdos.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index 3345aabd1dd7..99d3c7ac973c 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
@@ -164,16 +164,18 @@ static int msdos_hash(struct dentry *dentry, struct qstr *qstr) | |||
164 | * Compare two msdos names. If either of the names are invalid, | 164 | * Compare two msdos names. If either of the names are invalid, |
165 | * we fall back to doing the standard name comparison. | 165 | * we fall back to doing the standard name comparison. |
166 | */ | 166 | */ |
167 | static int msdos_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b) | 167 | static int msdos_cmp(const struct dentry *parent, const struct inode *pinode, |
168 | const struct dentry *dentry, const struct inode *inode, | ||
169 | unsigned int len, const char *str, const struct qstr *name) | ||
168 | { | 170 | { |
169 | struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options; | 171 | struct fat_mount_options *options = &MSDOS_SB(parent->d_sb)->options; |
170 | unsigned char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME]; | 172 | unsigned char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME]; |
171 | int error; | 173 | int error; |
172 | 174 | ||
173 | error = msdos_format_name(a->name, a->len, a_msdos_name, options); | 175 | error = msdos_format_name(name->name, name->len, a_msdos_name, options); |
174 | if (error) | 176 | if (error) |
175 | goto old_compare; | 177 | goto old_compare; |
176 | error = msdos_format_name(b->name, b->len, b_msdos_name, options); | 178 | error = msdos_format_name(str, len, b_msdos_name, options); |
177 | if (error) | 179 | if (error) |
178 | goto old_compare; | 180 | goto old_compare; |
179 | error = memcmp(a_msdos_name, b_msdos_name, MSDOS_NAME); | 181 | error = memcmp(a_msdos_name, b_msdos_name, MSDOS_NAME); |
@@ -182,8 +184,8 @@ out: | |||
182 | 184 | ||
183 | old_compare: | 185 | old_compare: |
184 | error = 1; | 186 | error = 1; |
185 | if (a->len == b->len) | 187 | if (name->len == len) |
186 | error = memcmp(a->name, b->name, a->len); | 188 | error = memcmp(name->name, str, len); |
187 | goto out; | 189 | goto out; |
188 | } | 190 | } |
189 | 191 | ||