diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-07-26 04:14:03 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-29 04:16:51 -0400 |
commit | a1da9e8ab687e6496482b7b2aa17d0da31e55b20 (patch) | |
tree | 8796d10b903e8f7600b223f25775cdaba5f71894 /fs/logfs | |
parent | e5a0726a953daf224ae42bcf5edaa64f71b4e8a7 (diff) |
switch logfs to ->mount()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/logfs')
-rw-r--r-- | fs/logfs/logfs.h | 3 | ||||
-rw-r--r-- | fs/logfs/super.c | 47 |
2 files changed, 23 insertions, 27 deletions
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h index 446c0f12d899..cd51a36b37f0 100644 --- a/fs/logfs/logfs.h +++ b/fs/logfs/logfs.h | |||
@@ -620,9 +620,6 @@ void emergency_read_end(struct page *page); | |||
620 | void logfs_crash_dump(struct super_block *sb); | 620 | void logfs_crash_dump(struct super_block *sb); |
621 | void *memchr_inv(const void *s, int c, size_t n); | 621 | void *memchr_inv(const void *s, int c, size_t n); |
622 | int logfs_statfs(struct dentry *dentry, struct kstatfs *stats); | 622 | int logfs_statfs(struct dentry *dentry, struct kstatfs *stats); |
623 | int logfs_get_sb_device(struct logfs_super *s, | ||
624 | struct file_system_type *type, int flags, | ||
625 | struct vfsmount *mnt); | ||
626 | int logfs_check_ds(struct logfs_disk_super *ds); | 623 | int logfs_check_ds(struct logfs_disk_super *ds); |
627 | int logfs_write_sb(struct super_block *sb); | 624 | int logfs_write_sb(struct super_block *sb); |
628 | 625 | ||
diff --git a/fs/logfs/super.c b/fs/logfs/super.c index f07d40e41c3f..33435e4b14d2 100644 --- a/fs/logfs/super.c +++ b/fs/logfs/super.c | |||
@@ -325,7 +325,7 @@ static int logfs_make_writeable(struct super_block *sb) | |||
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
327 | 327 | ||
328 | static int logfs_get_sb_final(struct super_block *sb, struct vfsmount *mnt) | 328 | static int logfs_get_sb_final(struct super_block *sb) |
329 | { | 329 | { |
330 | struct logfs_super *super = logfs_super(sb); | 330 | struct logfs_super *super = logfs_super(sb); |
331 | struct inode *rootdir; | 331 | struct inode *rootdir; |
@@ -356,7 +356,6 @@ static int logfs_get_sb_final(struct super_block *sb, struct vfsmount *mnt) | |||
356 | } | 356 | } |
357 | 357 | ||
358 | log_super("LogFS: Finished mounting\n"); | 358 | log_super("LogFS: Finished mounting\n"); |
359 | simple_set_mnt(mnt, sb); | ||
360 | return 0; | 359 | return 0; |
361 | 360 | ||
362 | fail: | 361 | fail: |
@@ -536,9 +535,8 @@ static void logfs_kill_sb(struct super_block *sb) | |||
536 | log_super("LogFS: Finished unmounting\n"); | 535 | log_super("LogFS: Finished unmounting\n"); |
537 | } | 536 | } |
538 | 537 | ||
539 | int logfs_get_sb_device(struct logfs_super *super, | 538 | static struct dentry *logfs_get_sb_device(struct logfs_super *super, |
540 | struct file_system_type *type, int flags, | 539 | struct file_system_type *type, int flags) |
541 | struct vfsmount *mnt) | ||
542 | { | 540 | { |
543 | struct super_block *sb; | 541 | struct super_block *sb; |
544 | int err = -ENOMEM; | 542 | int err = -ENOMEM; |
@@ -548,14 +546,17 @@ int logfs_get_sb_device(struct logfs_super *super, | |||
548 | 546 | ||
549 | err = -EINVAL; | 547 | err = -EINVAL; |
550 | sb = sget(type, logfs_sb_test, logfs_sb_set, super); | 548 | sb = sget(type, logfs_sb_test, logfs_sb_set, super); |
551 | if (IS_ERR(sb)) | 549 | if (IS_ERR(sb)) { |
552 | goto err0; | 550 | super->s_devops->put_device(super); |
551 | kfree(super); | ||
552 | return ERR_CAST(sb); | ||
553 | } | ||
553 | 554 | ||
554 | if (sb->s_root) { | 555 | if (sb->s_root) { |
555 | /* Device is already in use */ | 556 | /* Device is already in use */ |
556 | err = 0; | 557 | super->s_devops->put_device(super); |
557 | simple_set_mnt(mnt, sb); | 558 | kfree(super); |
558 | goto err0; | 559 | return dget(sb->s_root); |
559 | } | 560 | } |
560 | 561 | ||
561 | /* | 562 | /* |
@@ -573,10 +574,12 @@ int logfs_get_sb_device(struct logfs_super *super, | |||
573 | goto err1; | 574 | goto err1; |
574 | 575 | ||
575 | sb->s_flags |= MS_ACTIVE; | 576 | sb->s_flags |= MS_ACTIVE; |
576 | err = logfs_get_sb_final(sb, mnt); | 577 | err = logfs_get_sb_final(sb); |
577 | if (err) | 578 | if (err) { |
578 | deactivate_locked_super(sb); | 579 | deactivate_locked_super(sb); |
579 | return err; | 580 | return ERR_PTR(err); |
581 | } | ||
582 | return dget(sb->s_root); | ||
580 | 583 | ||
581 | err1: | 584 | err1: |
582 | /* no ->s_root, no ->put_super() */ | 585 | /* no ->s_root, no ->put_super() */ |
@@ -584,15 +587,11 @@ err1: | |||
584 | iput(super->s_segfile_inode); | 587 | iput(super->s_segfile_inode); |
585 | iput(super->s_mapping_inode); | 588 | iput(super->s_mapping_inode); |
586 | deactivate_locked_super(sb); | 589 | deactivate_locked_super(sb); |
587 | return err; | 590 | return ERR_PTR(err); |
588 | err0: | ||
589 | super->s_devops->put_device(super); | ||
590 | kfree(super); | ||
591 | return err; | ||
592 | } | 591 | } |
593 | 592 | ||
594 | static int logfs_get_sb(struct file_system_type *type, int flags, | 593 | static struct dentry *logfs_mount(struct file_system_type *type, int flags, |
595 | const char *devname, void *data, struct vfsmount *mnt) | 594 | const char *devname, void *data) |
596 | { | 595 | { |
597 | ulong mtdnr; | 596 | ulong mtdnr; |
598 | struct logfs_super *super; | 597 | struct logfs_super *super; |
@@ -600,7 +599,7 @@ static int logfs_get_sb(struct file_system_type *type, int flags, | |||
600 | 599 | ||
601 | super = kzalloc(sizeof(*super), GFP_KERNEL); | 600 | super = kzalloc(sizeof(*super), GFP_KERNEL); |
602 | if (!super) | 601 | if (!super) |
603 | return -ENOMEM; | 602 | return ERR_PTR(-ENOMEM); |
604 | 603 | ||
605 | if (!devname) | 604 | if (!devname) |
606 | err = logfs_get_sb_bdev(super, type, devname); | 605 | err = logfs_get_sb_bdev(super, type, devname); |
@@ -617,16 +616,16 @@ static int logfs_get_sb(struct file_system_type *type, int flags, | |||
617 | 616 | ||
618 | if (err) { | 617 | if (err) { |
619 | kfree(super); | 618 | kfree(super); |
620 | return err; | 619 | return ERR_PTR(err); |
621 | } | 620 | } |
622 | 621 | ||
623 | return logfs_get_sb_device(super, type, flags, mnt); | 622 | return logfs_get_sb_device(super, type, flags); |
624 | } | 623 | } |
625 | 624 | ||
626 | static struct file_system_type logfs_fs_type = { | 625 | static struct file_system_type logfs_fs_type = { |
627 | .owner = THIS_MODULE, | 626 | .owner = THIS_MODULE, |
628 | .name = "logfs", | 627 | .name = "logfs", |
629 | .get_sb = logfs_get_sb, | 628 | .mount = logfs_mount, |
630 | .kill_sb = logfs_kill_sb, | 629 | .kill_sb = logfs_kill_sb, |
631 | .fs_flags = FS_REQUIRES_DEV, | 630 | .fs_flags = FS_REQUIRES_DEV, |
632 | 631 | ||