History

make simple_positive() public

Al Viro committed 11 years ago

Commit dc3f4191 parent 5d754ce14 files · +25 −60Browse files

Unified · Split

14 files
  1. arch/powerpc/platforms/cell/spufs/inode.c +1 −1
  2. arch/s390/hypfs/inode.c +1 −6
  3. drivers/block/drbd/drbd_debugfs.c +1 −9
  4. drivers/infiniband/hw/ipath/ipath_fs.c +1 −1
  5. drivers/infiniband/hw/qib/qib_fs.c +1 −1
  6. fs/autofs4/autofs_i.h +0 −5
  7. fs/ceph/dir.c +1 −1
  8. fs/configfs/inode.c +1 −1
  9. fs/debugfs/inode.c +3 −8
  10. fs/libfs.c +0 −5
  11. fs/nfs/dir.c +1 −1
  12. fs/tracefs/inode.c +3 −8
  13. include/linux/dcache.h +5 −0
  14. security/inode.c +6 −13
arch/powerpc/platforms/cell/spufs/inode.c+1−1
@@ -166,7 +166,7 @@ static void spufs_prune_dir(struct dentry *dir) · 165 unmodified lines
166166 mutex_lock(&d_inode(dir)->i_mutex);
167167 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
168168 spin_lock(&dentry->d_lock);
169− if (!(d_unhashed(dentry)) && d_really_is_positive(dentry)) {
169+ if (simple_positive(dentry)) {
170170 dget_dlock(dentry);
171171 __d_drop(dentry);
172172 spin_unlock(&dentry->d_lock);
arch/s390/hypfs/inode.c+1−6
@@ -62,18 +62,13 @@ static void hypfs_add_dentry(struct dentry *dentry) · 61 unmodified lines
6262 hypfs_last_dentry = dentry;
6363 }
6464
65−static inline int hypfs_positive(struct dentry *dentry)
66−{
67− return d_really_is_positive(dentry) && !d_unhashed(dentry);
68−}
69−
7065 static void hypfs_remove(struct dentry *dentry)
7166 {
7267 struct dentry *parent;
7368
7469 parent = dentry->d_parent;
7570 mutex_lock(&d_inode(parent)->i_mutex);
76− if (hypfs_positive(dentry)) {
71+ if (simple_positive(dentry)) {
7772 if (d_is_dir(dentry))
7873 simple_rmdir(d_inode(parent), dentry);
7974 else
drivers/block/drbd/drbd_debugfs.c+1−9
@@ -419,14 +419,6 @@ static int in_flight_summary_show(struct seq_file *m, void *pos) · 418 unmodified lines
419419 return 0;
420420 }
421421
422−/* simple_positive(file->f_path.dentry) respectively debugfs_positive(),
423− * but neither is "reachable" from here.
424− * So we have our own inline version of it above. :-( */
425−static inline int debugfs_positive(struct dentry *dentry)
426−{
427− return d_really_is_positive(dentry) && !d_unhashed(dentry);
428−}
429−
430422 /* make sure at *open* time that the respective object won't go away. */
431423 static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, void *),
432424 void *data, struct kref *kref,
@@ -444,7 +436,7 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo · 11 unmodified lines
444436 /* serialize with d_delete() */
445437 mutex_lock(&d_inode(parent)->i_mutex);
446438 /* Make sure the object is still alive */
447− if (debugfs_positive(file->f_path.dentry)
439+ if (simple_positive(file->f_path.dentry)
448440 && kref_get_unless_zero(kref))
449441 ret = 0;
450442 mutex_unlock(&d_inode(parent)->i_mutex);
drivers/infiniband/hw/ipath/ipath_fs.c+1−1
@@ -277,7 +277,7 @@ static int remove_file(struct dentry *parent, char *name) · 276 unmodified lines
277277 }
278278
279279 spin_lock(&tmp->d_lock);
280− if (!d_unhashed(tmp) && d_really_is_positive(tmp)) {
280+ if (simple_positive(tmp)) {
281281 dget_dlock(tmp);
282282 __d_drop(tmp);
283283 spin_unlock(&tmp->d_lock);
drivers/infiniband/hw/qib/qib_fs.c+1−1
@@ -455,7 +455,7 @@ static int remove_file(struct dentry *parent, char *name) · 454 unmodified lines
455455 }
456456
457457 spin_lock(&tmp->d_lock);
458− if (!d_unhashed(tmp) && d_really_is_positive(tmp)) {
458+ if (simple_positive(tmp)) {
459459 __d_drop(tmp);
460460 spin_unlock(&tmp->d_lock);
461461 simple_unlink(d_inode(parent), tmp);
fs/autofs4/autofs_i.h+0−5
@@ -238,11 +238,6 @@ static inline u64 autofs4_get_ino(struct autofs_sb_info *sbi) · 237 unmodified lines
238238 return d_inode(sbi->sb->s_root)->i_ino;
239239 }
240240
241−static inline int simple_positive(struct dentry *dentry)
242−{
243− return d_really_is_positive(dentry) && !d_unhashed(dentry);
244−}
245−
246241 static inline void __autofs4_add_expiring(struct dentry *dentry)
247242 {
248243 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
fs/ceph/dir.c+1−1
@@ -161,7 +161,7 @@ more: · 160 unmodified lines
161161 }
162162 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
163163 if (di->lease_shared_gen == shared_gen &&
164− !d_unhashed(dentry) && d_really_is_positive(dentry) &&
164+ simple_positive(dentry) &&
165165 ceph_snap(d_inode(dentry)) != CEPH_SNAPDIR &&
166166 ceph_ino(d_inode(dentry)) != CEPH_INO_CEPH &&
167167 fpos_cmp(ctx->pos, di->offset) <= 0)
fs/configfs/inode.c+1−1
@@ -236,7 +236,7 @@ void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent) · 235 unmodified lines
236236
237237 if (dentry) {
238238 spin_lock(&dentry->d_lock);
239− if (!d_unhashed(dentry) && d_really_is_positive(dentry)) {
239+ if (simple_positive(dentry)) {
240240 dget_dlock(dentry);
241241 __d_drop(dentry);
242242 spin_unlock(&dentry->d_lock);
fs/debugfs/inode.c+3−8
@@ -44,11 +44,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb) · 43 unmodified lines
4444 return inode;
4545 }
4646
47−static inline int debugfs_positive(struct dentry *dentry)
48−{
49− return d_really_is_positive(dentry) && !d_unhashed(dentry);
50−}
51−
5247 struct debugfs_mount_opts {
5348 kuid_t uid;
5449 kgid_t gid;
@@ -522,7 +517,7 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) · 467 unmodified lines
522517 {
523518 int ret = 0;
524519
525− if (debugfs_positive(dentry)) {
520+ if (simple_positive(dentry)) {
526521 dget(dentry);
527522 if (d_is_dir(dentry))
528523 ret = simple_rmdir(d_inode(parent), dentry);
@@ -602,7 +597,7 @@ void debugfs_remove_recursive(struct dentry *dentry) · 73 unmodified lines
602597 */
603598 spin_lock(&parent->d_lock);
604599 list_for_each_entry(child, &parent->d_subdirs, d_child) {
605− if (!debugfs_positive(child))
600+ if (!simple_positive(child))
606601 continue;
607602
608603 /* perhaps simple_empty(child) makes more sense */
@@ -623,7 +618,7 @@ void debugfs_remove_recursive(struct dentry *dentry) · 14 unmodified lines
623618 * from d_subdirs. When releasing the parent->d_lock we can
624619 * no longer trust that the next pointer is valid.
625620 * Restart the loop. We'll skip this one with the
626− * debugfs_positive() check.
621+ * simple_positive() check.
627622 */
628623 goto loop;
629624 }
fs/libfs.c+0−5
@@ -20,11 +20,6 @@ · 19 unmodified lines
2020
2121 #include "internal.h"
2222
23−static inline int simple_positive(struct dentry *dentry)
24−{
25− return d_really_is_positive(dentry) && !d_unhashed(dentry);
26−}
27−
2823 int simple_getattr(struct vfsmount *mnt, struct dentry *dentry,
2924 struct kstat *stat)
3025 {
fs/nfs/dir.c+1−1
@@ -1771,7 +1771,7 @@ EXPORT_SYMBOL_GPL(nfs_mkdir); · 1770 unmodified lines
17711771
17721772 static void nfs_dentry_handle_enoent(struct dentry *dentry)
17731773 {
1774− if (d_really_is_positive(dentry) && !d_unhashed(dentry))
1774+ if (simple_positive(dentry))
17751775 d_delete(dentry);
17761776 }
17771777
fs/tracefs/inode.c+3−8
@@ -496,16 +496,11 @@ struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *pare · 495 unmodified lines
496496 return dentry;
497497 }
498498
499−static inline int tracefs_positive(struct dentry *dentry)
500−{
501− return dentry->d_inode && !d_unhashed(dentry);
502−}
503−
504499 static int __tracefs_remove(struct dentry *dentry, struct dentry *parent)
505500 {
506501 int ret = 0;
507502
508− if (tracefs_positive(dentry)) {
503+ if (simple_positive(dentry)) {
509504 if (dentry->d_inode) {
510505 dget(dentry);
511506 switch (dentry->d_inode->i_mode & S_IFMT) {
@@ -582,7 +577,7 @@ void tracefs_remove_recursive(struct dentry *dentry) · 70 unmodified lines
582577 */
583578 spin_lock(&parent->d_lock);
584579 list_for_each_entry(child, &parent->d_subdirs, d_child) {
585− if (!tracefs_positive(child))
580+ if (!simple_positive(child))
586581 continue;
587582
588583 /* perhaps simple_empty(child) makes more sense */
@@ -603,7 +598,7 @@ void tracefs_remove_recursive(struct dentry *dentry) · 14 unmodified lines
603598 * from d_subdirs. When releasing the parent->d_lock we can
604599 * no longer trust that the next pointer is valid.
605600 * Restart the loop. We'll skip this one with the
606− * tracefs_positive() check.
601+ * simple_positive() check.
607602 */
608603 goto loop;
609604 }
include/linux/dcache.h+5−0
@@ -507,6 +507,11 @@ static inline bool d_really_is_positive(const struct dentry *dentry) · 506 unmodified lines
507507 return dentry->d_inode != NULL;
508508 }
509509
510+static inline int simple_positive(struct dentry *dentry)
511+{
512+ return d_really_is_positive(dentry) && !d_unhashed(dentry);
513+}
514+
510515 extern void d_set_fallthru(struct dentry *dentry);
511516
512517 static inline bool d_is_fallthru(const struct dentry *dentry)
security/inode.c+6−13
@@ -25,11 +25,6 @@ · 24 unmodified lines
2525 static struct vfsmount *mount;
2626 static int mount_count;
2727
28−static inline int positive(struct dentry *dentry)
29−{
30− return d_really_is_positive(dentry) && !d_unhashed(dentry);
31−}
32−
3328 static int fill_super(struct super_block *sb, void *data, int silent)
3429 {
3530 static struct tree_descr files[] = {{""}};
@@ -201,14 +196,12 @@ void securityfs_remove(struct dentry *dentry) · 165 unmodified lines
201196 return;
202197
203198 mutex_lock(&d_inode(parent)->i_mutex);
204− if (positive(dentry)) {
205− if (d_really_is_positive(dentry)) {
206− if (d_is_dir(dentry))
207− simple_rmdir(d_inode(parent), dentry);
208− else
209− simple_unlink(d_inode(parent), dentry);
210− dput(dentry);
211− }
199+ if (simple_positive(dentry)) {
200+ if (d_is_dir(dentry))
201+ simple_rmdir(d_inode(parent), dentry);
202+ else
203+ simple_unlink(d_inode(parent), dentry);
204+ dput(dentry);
212205 }
213206 mutex_unlock(&d_inode(parent)->i_mutex);
214207 simple_release_fs(&mount, &mount_count);