diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-07-26 03:25:05 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-29 04:16:41 -0400 |
commit | 71a1c0125f132b2a4656689ca585c5d8931e539c (patch) | |
tree | 5c33185d3b7b00d1e23e1725b70b5ef14795f5fc /fs/logfs/super.c | |
parent | d2d1ea93069bd7706206b9c124e438ab2795612c (diff) |
logfs get_sb massage, part 1
move allocation of logfs_super to logfs_get_sb, pass it to
logfs_get_sb_...().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/logfs/super.c')
-rw-r--r-- | fs/logfs/super.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/logfs/super.c b/fs/logfs/super.c index 5336155c5d81..5e43178add98 100644 --- a/fs/logfs/super.c +++ b/fs/logfs/super.c | |||
@@ -536,19 +536,16 @@ static void logfs_kill_sb(struct super_block *sb) | |||
536 | log_super("LogFS: Finished unmounting\n"); | 536 | log_super("LogFS: Finished unmounting\n"); |
537 | } | 537 | } |
538 | 538 | ||
539 | int logfs_get_sb_device(struct file_system_type *type, int flags, | 539 | int logfs_get_sb_device(struct logfs_super *super, |
540 | struct file_system_type *type, int flags, | ||
540 | struct mtd_info *mtd, struct block_device *bdev, | 541 | struct mtd_info *mtd, struct block_device *bdev, |
541 | const struct logfs_device_ops *devops, struct vfsmount *mnt) | 542 | const struct logfs_device_ops *devops, struct vfsmount *mnt) |
542 | { | 543 | { |
543 | struct logfs_super *super; | ||
544 | struct super_block *sb; | 544 | struct super_block *sb; |
545 | int err = -ENOMEM; | 545 | int err = -ENOMEM; |
546 | static int mount_count; | 546 | static int mount_count; |
547 | 547 | ||
548 | log_super("LogFS: Start mount %x\n", mount_count++); | 548 | log_super("LogFS: Start mount %x\n", mount_count++); |
549 | super = kzalloc(sizeof(*super), GFP_KERNEL); | ||
550 | if (!super) | ||
551 | goto err0; | ||
552 | 549 | ||
553 | super->s_mtd = mtd; | 550 | super->s_mtd = mtd; |
554 | super->s_bdev = bdev; | 551 | super->s_bdev = bdev; |
@@ -603,20 +600,27 @@ static int logfs_get_sb(struct file_system_type *type, int flags, | |||
603 | const char *devname, void *data, struct vfsmount *mnt) | 600 | const char *devname, void *data, struct vfsmount *mnt) |
604 | { | 601 | { |
605 | ulong mtdnr; | 602 | ulong mtdnr; |
603 | struct logfs_super *super; | ||
604 | |||
605 | super = kzalloc(sizeof(*super), GFP_KERNEL); | ||
606 | if (!super) | ||
607 | return -ENOMEM; | ||
606 | 608 | ||
607 | if (!devname) | 609 | if (!devname) |
608 | return logfs_get_sb_bdev(type, flags, devname, mnt); | 610 | return logfs_get_sb_bdev(super, type, flags, devname, mnt); |
609 | if (strncmp(devname, "mtd", 3)) | 611 | if (strncmp(devname, "mtd", 3)) |
610 | return logfs_get_sb_bdev(type, flags, devname, mnt); | 612 | return logfs_get_sb_bdev(super, type, flags, devname, mnt); |
611 | 613 | ||
612 | { | 614 | { |
613 | char *garbage; | 615 | char *garbage; |
614 | mtdnr = simple_strtoul(devname+3, &garbage, 0); | 616 | mtdnr = simple_strtoul(devname+3, &garbage, 0); |
615 | if (*garbage) | 617 | if (*garbage) { |
618 | kfree(super); | ||
616 | return -EINVAL; | 619 | return -EINVAL; |
620 | } | ||
617 | } | 621 | } |
618 | 622 | ||
619 | return logfs_get_sb_mtd(type, flags, mtdnr, mnt); | 623 | return logfs_get_sb_mtd(super, type, flags, mtdnr, mnt); |
620 | } | 624 | } |
621 | 625 | ||
622 | static struct file_system_type logfs_fs_type = { | 626 | static struct file_system_type logfs_fs_type = { |