diff options
-rw-r--r-- | fs/fuse/inode.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 437d61c65268..12450d2b320e 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -535,8 +535,10 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
535 | return -EINVAL; | 535 | return -EINVAL; |
536 | 536 | ||
537 | if (is_bdev) { | 537 | if (is_bdev) { |
538 | #ifdef CONFIG_BLOCK | ||
538 | if (!sb_set_blocksize(sb, d.blksize)) | 539 | if (!sb_set_blocksize(sb, d.blksize)) |
539 | return -EINVAL; | 540 | return -EINVAL; |
541 | #endif | ||
540 | } else { | 542 | } else { |
541 | sb->s_blocksize = PAGE_CACHE_SIZE; | 543 | sb->s_blocksize = PAGE_CACHE_SIZE; |
542 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; | 544 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
@@ -629,6 +631,14 @@ static int fuse_get_sb(struct file_system_type *fs_type, | |||
629 | return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); | 631 | return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); |
630 | } | 632 | } |
631 | 633 | ||
634 | static struct file_system_type fuse_fs_type = { | ||
635 | .owner = THIS_MODULE, | ||
636 | .name = "fuse", | ||
637 | .get_sb = fuse_get_sb, | ||
638 | .kill_sb = kill_anon_super, | ||
639 | }; | ||
640 | |||
641 | #ifdef CONFIG_BLOCK | ||
632 | static int fuse_get_sb_blk(struct file_system_type *fs_type, | 642 | static int fuse_get_sb_blk(struct file_system_type *fs_type, |
633 | int flags, const char *dev_name, | 643 | int flags, const char *dev_name, |
634 | void *raw_data, struct vfsmount *mnt) | 644 | void *raw_data, struct vfsmount *mnt) |
@@ -637,13 +647,6 @@ static int fuse_get_sb_blk(struct file_system_type *fs_type, | |||
637 | mnt); | 647 | mnt); |
638 | } | 648 | } |
639 | 649 | ||
640 | static struct file_system_type fuse_fs_type = { | ||
641 | .owner = THIS_MODULE, | ||
642 | .name = "fuse", | ||
643 | .get_sb = fuse_get_sb, | ||
644 | .kill_sb = kill_anon_super, | ||
645 | }; | ||
646 | |||
647 | static struct file_system_type fuseblk_fs_type = { | 650 | static struct file_system_type fuseblk_fs_type = { |
648 | .owner = THIS_MODULE, | 651 | .owner = THIS_MODULE, |
649 | .name = "fuseblk", | 652 | .name = "fuseblk", |
@@ -652,6 +655,26 @@ static struct file_system_type fuseblk_fs_type = { | |||
652 | .fs_flags = FS_REQUIRES_DEV, | 655 | .fs_flags = FS_REQUIRES_DEV, |
653 | }; | 656 | }; |
654 | 657 | ||
658 | static inline int register_fuseblk(void) | ||
659 | { | ||
660 | return register_filesystem(&fuseblk_fs_type); | ||
661 | } | ||
662 | |||
663 | static inline void unregister_fuseblk(void) | ||
664 | { | ||
665 | unregister_filesystem(&fuseblk_fs_type); | ||
666 | } | ||
667 | #else | ||
668 | static inline int register_fuseblk(void) | ||
669 | { | ||
670 | return 0; | ||
671 | } | ||
672 | |||
673 | static inline void unregister_fuseblk(void) | ||
674 | { | ||
675 | } | ||
676 | #endif | ||
677 | |||
655 | static decl_subsys(fuse, NULL, NULL); | 678 | static decl_subsys(fuse, NULL, NULL); |
656 | static decl_subsys(connections, NULL, NULL); | 679 | static decl_subsys(connections, NULL, NULL); |
657 | 680 | ||
@@ -673,7 +696,7 @@ static int __init fuse_fs_init(void) | |||
673 | if (err) | 696 | if (err) |
674 | goto out; | 697 | goto out; |
675 | 698 | ||
676 | err = register_filesystem(&fuseblk_fs_type); | 699 | err = register_fuseblk(); |
677 | if (err) | 700 | if (err) |
678 | goto out_unreg; | 701 | goto out_unreg; |
679 | 702 | ||
@@ -688,7 +711,7 @@ static int __init fuse_fs_init(void) | |||
688 | return 0; | 711 | return 0; |
689 | 712 | ||
690 | out_unreg2: | 713 | out_unreg2: |
691 | unregister_filesystem(&fuseblk_fs_type); | 714 | unregister_fuseblk(); |
692 | out_unreg: | 715 | out_unreg: |
693 | unregister_filesystem(&fuse_fs_type); | 716 | unregister_filesystem(&fuse_fs_type); |
694 | out: | 717 | out: |
@@ -698,7 +721,7 @@ static int __init fuse_fs_init(void) | |||
698 | static void fuse_fs_cleanup(void) | 721 | static void fuse_fs_cleanup(void) |
699 | { | 722 | { |
700 | unregister_filesystem(&fuse_fs_type); | 723 | unregister_filesystem(&fuse_fs_type); |
701 | unregister_filesystem(&fuseblk_fs_type); | 724 | unregister_fuseblk(); |
702 | kmem_cache_destroy(fuse_inode_cachep); | 725 | kmem_cache_destroy(fuse_inode_cachep); |
703 | } | 726 | } |
704 | 727 | ||