diff options
author | David Howells <dhowells@redhat.com> | 2015-03-17 18:25:59 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-15 15:06:57 -0400 |
commit | 2b0143b5c986be1ce8408b3aadc4709e0a94429d (patch) | |
tree | 98b1dee70f3d5d9ac9309f4638e41864ddcd0952 /fs/debugfs | |
parent | ce0b16ddf18df35026164fda4a642ef10c01f442 (diff) |
VFS: normal filesystems (and lustre): d_inode() annotations
that's the bulk of filesystem drivers dealing with inodes of their own
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/debugfs')
-rw-r--r-- | fs/debugfs/file.c | 2 | ||||
-rw-r--r-- | fs/debugfs/inode.c | 56 |
2 files changed, 29 insertions, 29 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 517e64938438..830a7e76f5c6 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -45,7 +45,7 @@ const struct file_operations debugfs_file_operations = { | |||
45 | 45 | ||
46 | static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 46 | static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
47 | { | 47 | { |
48 | nd_set_link(nd, dentry->d_inode->i_private); | 48 | nd_set_link(nd, d_inode(dentry)->i_private); |
49 | return NULL; | 49 | return NULL; |
50 | } | 50 | } |
51 | 51 | ||
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 26856ecdea5e..61dfe45fdb68 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -46,7 +46,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb) | |||
46 | 46 | ||
47 | static inline int debugfs_positive(struct dentry *dentry) | 47 | static inline int debugfs_positive(struct dentry *dentry) |
48 | { | 48 | { |
49 | return dentry->d_inode && !d_unhashed(dentry); | 49 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
50 | } | 50 | } |
51 | 51 | ||
52 | struct debugfs_mount_opts { | 52 | struct debugfs_mount_opts { |
@@ -124,7 +124,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts) | |||
124 | static int debugfs_apply_options(struct super_block *sb) | 124 | static int debugfs_apply_options(struct super_block *sb) |
125 | { | 125 | { |
126 | struct debugfs_fs_info *fsi = sb->s_fs_info; | 126 | struct debugfs_fs_info *fsi = sb->s_fs_info; |
127 | struct inode *inode = sb->s_root->d_inode; | 127 | struct inode *inode = d_inode(sb->s_root); |
128 | struct debugfs_mount_opts *opts = &fsi->mount_opts; | 128 | struct debugfs_mount_opts *opts = &fsi->mount_opts; |
129 | 129 | ||
130 | inode->i_mode &= ~S_IALLUGO; | 130 | inode->i_mode &= ~S_IALLUGO; |
@@ -188,7 +188,7 @@ static struct vfsmount *debugfs_automount(struct path *path) | |||
188 | { | 188 | { |
189 | struct vfsmount *(*f)(void *); | 189 | struct vfsmount *(*f)(void *); |
190 | f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata; | 190 | f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata; |
191 | return f(path->dentry->d_inode->i_private); | 191 | return f(d_inode(path->dentry)->i_private); |
192 | } | 192 | } |
193 | 193 | ||
194 | static const struct dentry_operations debugfs_dops = { | 194 | static const struct dentry_operations debugfs_dops = { |
@@ -267,20 +267,20 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
267 | if (!parent) | 267 | if (!parent) |
268 | parent = debugfs_mount->mnt_root; | 268 | parent = debugfs_mount->mnt_root; |
269 | 269 | ||
270 | mutex_lock(&parent->d_inode->i_mutex); | 270 | mutex_lock(&d_inode(parent)->i_mutex); |
271 | dentry = lookup_one_len(name, parent, strlen(name)); | 271 | dentry = lookup_one_len(name, parent, strlen(name)); |
272 | if (!IS_ERR(dentry) && dentry->d_inode) { | 272 | if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { |
273 | dput(dentry); | 273 | dput(dentry); |
274 | dentry = ERR_PTR(-EEXIST); | 274 | dentry = ERR_PTR(-EEXIST); |
275 | } | 275 | } |
276 | if (IS_ERR(dentry)) | 276 | if (IS_ERR(dentry)) |
277 | mutex_unlock(&parent->d_inode->i_mutex); | 277 | mutex_unlock(&d_inode(parent)->i_mutex); |
278 | return dentry; | 278 | return dentry; |
279 | } | 279 | } |
280 | 280 | ||
281 | static struct dentry *failed_creating(struct dentry *dentry) | 281 | static struct dentry *failed_creating(struct dentry *dentry) |
282 | { | 282 | { |
283 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 283 | mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); |
284 | dput(dentry); | 284 | dput(dentry); |
285 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 285 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
286 | return NULL; | 286 | return NULL; |
@@ -288,7 +288,7 @@ static struct dentry *failed_creating(struct dentry *dentry) | |||
288 | 288 | ||
289 | static struct dentry *end_creating(struct dentry *dentry) | 289 | static struct dentry *end_creating(struct dentry *dentry) |
290 | { | 290 | { |
291 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 291 | mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); |
292 | return dentry; | 292 | return dentry; |
293 | } | 293 | } |
294 | 294 | ||
@@ -341,7 +341,7 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode, | |||
341 | inode->i_fop = fops ? fops : &debugfs_file_operations; | 341 | inode->i_fop = fops ? fops : &debugfs_file_operations; |
342 | inode->i_private = data; | 342 | inode->i_private = data; |
343 | d_instantiate(dentry, inode); | 343 | d_instantiate(dentry, inode); |
344 | fsnotify_create(dentry->d_parent->d_inode, dentry); | 344 | fsnotify_create(d_inode(dentry->d_parent), dentry); |
345 | return end_creating(dentry); | 345 | return end_creating(dentry); |
346 | } | 346 | } |
347 | EXPORT_SYMBOL_GPL(debugfs_create_file); | 347 | EXPORT_SYMBOL_GPL(debugfs_create_file); |
@@ -381,7 +381,7 @@ struct dentry *debugfs_create_file_size(const char *name, umode_t mode, | |||
381 | struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); | 381 | struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); |
382 | 382 | ||
383 | if (de) | 383 | if (de) |
384 | de->d_inode->i_size = file_size; | 384 | d_inode(de)->i_size = file_size; |
385 | return de; | 385 | return de; |
386 | } | 386 | } |
387 | EXPORT_SYMBOL_GPL(debugfs_create_file_size); | 387 | EXPORT_SYMBOL_GPL(debugfs_create_file_size); |
@@ -423,8 +423,8 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) | |||
423 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | 423 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ |
424 | inc_nlink(inode); | 424 | inc_nlink(inode); |
425 | d_instantiate(dentry, inode); | 425 | d_instantiate(dentry, inode); |
426 | inc_nlink(dentry->d_parent->d_inode); | 426 | inc_nlink(d_inode(dentry->d_parent)); |
427 | fsnotify_mkdir(dentry->d_parent->d_inode, dentry); | 427 | fsnotify_mkdir(d_inode(dentry->d_parent), dentry); |
428 | return end_creating(dentry); | 428 | return end_creating(dentry); |
429 | } | 429 | } |
430 | EXPORT_SYMBOL_GPL(debugfs_create_dir); | 430 | EXPORT_SYMBOL_GPL(debugfs_create_dir); |
@@ -522,9 +522,9 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) | |||
522 | if (debugfs_positive(dentry)) { | 522 | if (debugfs_positive(dentry)) { |
523 | dget(dentry); | 523 | dget(dentry); |
524 | if (d_is_dir(dentry)) | 524 | if (d_is_dir(dentry)) |
525 | ret = simple_rmdir(parent->d_inode, dentry); | 525 | ret = simple_rmdir(d_inode(parent), dentry); |
526 | else | 526 | else |
527 | simple_unlink(parent->d_inode, dentry); | 527 | simple_unlink(d_inode(parent), dentry); |
528 | if (!ret) | 528 | if (!ret) |
529 | d_delete(dentry); | 529 | d_delete(dentry); |
530 | dput(dentry); | 530 | dput(dentry); |
@@ -554,12 +554,12 @@ void debugfs_remove(struct dentry *dentry) | |||
554 | return; | 554 | return; |
555 | 555 | ||
556 | parent = dentry->d_parent; | 556 | parent = dentry->d_parent; |
557 | if (!parent || !parent->d_inode) | 557 | if (!parent || d_really_is_negative(parent)) |
558 | return; | 558 | return; |
559 | 559 | ||
560 | mutex_lock(&parent->d_inode->i_mutex); | 560 | mutex_lock(&d_inode(parent)->i_mutex); |
561 | ret = __debugfs_remove(dentry, parent); | 561 | ret = __debugfs_remove(dentry, parent); |
562 | mutex_unlock(&parent->d_inode->i_mutex); | 562 | mutex_unlock(&d_inode(parent)->i_mutex); |
563 | if (!ret) | 563 | if (!ret) |
564 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 564 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
565 | } | 565 | } |
@@ -585,12 +585,12 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
585 | return; | 585 | return; |
586 | 586 | ||
587 | parent = dentry->d_parent; | 587 | parent = dentry->d_parent; |
588 | if (!parent || !parent->d_inode) | 588 | if (!parent || d_really_is_negative(parent)) |
589 | return; | 589 | return; |
590 | 590 | ||
591 | parent = dentry; | 591 | parent = dentry; |
592 | down: | 592 | down: |
593 | mutex_lock(&parent->d_inode->i_mutex); | 593 | mutex_lock(&d_inode(parent)->i_mutex); |
594 | loop: | 594 | loop: |
595 | /* | 595 | /* |
596 | * The parent->d_subdirs is protected by the d_lock. Outside that | 596 | * The parent->d_subdirs is protected by the d_lock. Outside that |
@@ -605,7 +605,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
605 | /* perhaps simple_empty(child) makes more sense */ | 605 | /* perhaps simple_empty(child) makes more sense */ |
606 | if (!list_empty(&child->d_subdirs)) { | 606 | if (!list_empty(&child->d_subdirs)) { |
607 | spin_unlock(&parent->d_lock); | 607 | spin_unlock(&parent->d_lock); |
608 | mutex_unlock(&parent->d_inode->i_mutex); | 608 | mutex_unlock(&d_inode(parent)->i_mutex); |
609 | parent = child; | 609 | parent = child; |
610 | goto down; | 610 | goto down; |
611 | } | 611 | } |
@@ -626,10 +626,10 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
626 | } | 626 | } |
627 | spin_unlock(&parent->d_lock); | 627 | spin_unlock(&parent->d_lock); |
628 | 628 | ||
629 | mutex_unlock(&parent->d_inode->i_mutex); | 629 | mutex_unlock(&d_inode(parent)->i_mutex); |
630 | child = parent; | 630 | child = parent; |
631 | parent = parent->d_parent; | 631 | parent = parent->d_parent; |
632 | mutex_lock(&parent->d_inode->i_mutex); | 632 | mutex_lock(&d_inode(parent)->i_mutex); |
633 | 633 | ||
634 | if (child != dentry) | 634 | if (child != dentry) |
635 | /* go up */ | 635 | /* go up */ |
@@ -637,7 +637,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
637 | 637 | ||
638 | if (!__debugfs_remove(child, parent)) | 638 | if (!__debugfs_remove(child, parent)) |
639 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 639 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
640 | mutex_unlock(&parent->d_inode->i_mutex); | 640 | mutex_unlock(&d_inode(parent)->i_mutex); |
641 | } | 641 | } |
642 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); | 642 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); |
643 | 643 | ||
@@ -669,27 +669,27 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | |||
669 | 669 | ||
670 | trap = lock_rename(new_dir, old_dir); | 670 | trap = lock_rename(new_dir, old_dir); |
671 | /* Source or destination directories don't exist? */ | 671 | /* Source or destination directories don't exist? */ |
672 | if (!old_dir->d_inode || !new_dir->d_inode) | 672 | if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir)) |
673 | goto exit; | 673 | goto exit; |
674 | /* Source does not exist, cyclic rename, or mountpoint? */ | 674 | /* Source does not exist, cyclic rename, or mountpoint? */ |
675 | if (!old_dentry->d_inode || old_dentry == trap || | 675 | if (d_really_is_negative(old_dentry) || old_dentry == trap || |
676 | d_mountpoint(old_dentry)) | 676 | d_mountpoint(old_dentry)) |
677 | goto exit; | 677 | goto exit; |
678 | dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); | 678 | dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); |
679 | /* Lookup failed, cyclic rename or target exists? */ | 679 | /* Lookup failed, cyclic rename or target exists? */ |
680 | if (IS_ERR(dentry) || dentry == trap || dentry->d_inode) | 680 | if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry)) |
681 | goto exit; | 681 | goto exit; |
682 | 682 | ||
683 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); | 683 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); |
684 | 684 | ||
685 | error = simple_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, | 685 | error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir), |
686 | dentry); | 686 | dentry); |
687 | if (error) { | 687 | if (error) { |
688 | fsnotify_oldname_free(old_name); | 688 | fsnotify_oldname_free(old_name); |
689 | goto exit; | 689 | goto exit; |
690 | } | 690 | } |
691 | d_move(old_dentry, dentry); | 691 | d_move(old_dentry, dentry); |
692 | fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name, | 692 | fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name, |
693 | d_is_dir(old_dentry), | 693 | d_is_dir(old_dentry), |
694 | NULL, old_dentry); | 694 | NULL, old_dentry); |
695 | fsnotify_oldname_free(old_name); | 695 | fsnotify_oldname_free(old_name); |