diff options
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/fs/super.c b/fs/super.c index 00a2c9662b55..40989e9a2606 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -762,10 +762,9 @@ static int test_bdev_super(struct super_block *s, void *data) | |||
762 | return (void *)s->s_bdev == data; | 762 | return (void *)s->s_bdev == data; |
763 | } | 763 | } |
764 | 764 | ||
765 | int get_sb_bdev(struct file_system_type *fs_type, | 765 | struct dentry *mount_bdev(struct file_system_type *fs_type, |
766 | int flags, const char *dev_name, void *data, | 766 | int flags, const char *dev_name, void *data, |
767 | int (*fill_super)(struct super_block *, void *, int), | 767 | int (*fill_super)(struct super_block *, void *, int)) |
768 | struct vfsmount *mnt) | ||
769 | { | 768 | { |
770 | struct block_device *bdev; | 769 | struct block_device *bdev; |
771 | struct super_block *s; | 770 | struct super_block *s; |
@@ -777,7 +776,7 @@ int get_sb_bdev(struct file_system_type *fs_type, | |||
777 | 776 | ||
778 | bdev = open_bdev_exclusive(dev_name, mode, fs_type); | 777 | bdev = open_bdev_exclusive(dev_name, mode, fs_type); |
779 | if (IS_ERR(bdev)) | 778 | if (IS_ERR(bdev)) |
780 | return PTR_ERR(bdev); | 779 | return ERR_CAST(bdev); |
781 | 780 | ||
782 | /* | 781 | /* |
783 | * once the super is inserted into the list by sget, s_umount | 782 | * once the super is inserted into the list by sget, s_umount |
@@ -829,15 +828,30 @@ int get_sb_bdev(struct file_system_type *fs_type, | |||
829 | bdev->bd_super = s; | 828 | bdev->bd_super = s; |
830 | } | 829 | } |
831 | 830 | ||
832 | simple_set_mnt(mnt, s); | 831 | return dget(s->s_root); |
833 | return 0; | ||
834 | 832 | ||
835 | error_s: | 833 | error_s: |
836 | error = PTR_ERR(s); | 834 | error = PTR_ERR(s); |
837 | error_bdev: | 835 | error_bdev: |
838 | close_bdev_exclusive(bdev, mode); | 836 | close_bdev_exclusive(bdev, mode); |
839 | error: | 837 | error: |
840 | return error; | 838 | return ERR_PTR(error); |
839 | } | ||
840 | EXPORT_SYMBOL(mount_bdev); | ||
841 | |||
842 | int get_sb_bdev(struct file_system_type *fs_type, | ||
843 | int flags, const char *dev_name, void *data, | ||
844 | int (*fill_super)(struct super_block *, void *, int), | ||
845 | struct vfsmount *mnt) | ||
846 | { | ||
847 | struct dentry *root; | ||
848 | |||
849 | root = mount_bdev(fs_type, flags, dev_name, data, fill_super); | ||
850 | if (IS_ERR(root)) | ||
851 | return PTR_ERR(root); | ||
852 | mnt->mnt_root = root; | ||
853 | mnt->mnt_sb = root->d_sb; | ||
854 | return 0; | ||
841 | } | 855 | } |
842 | 856 | ||
843 | EXPORT_SYMBOL(get_sb_bdev); | 857 | EXPORT_SYMBOL(get_sb_bdev); |