init: remove the bstat helper
authorChristoph Hellwig <hch@lst.de>
Sat, 6 Jun 2020 08:49:35 +0000 (10:49 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 16 Jul 2020 13:34:42 +0000 (15:34 +0200)
The only caller of the bstat function becomes cleaner and simpler when
open coding the function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: NeilBrown <neilb@suse.de>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
init/do_mounts.h
init/do_mounts_md.c

index 0bb0806de4ce2cc1023c8a39eb4133a3f4b5ee8d..7513d1c14d13fe2f5c9072a8929b41d70f0c1f5c 100644 (file)
@@ -20,16 +20,6 @@ static inline int create_dev(char *name, dev_t dev)
        return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
 }
 
-static inline u32 bstat(char *name)
-{
-       struct kstat stat;
-       if (vfs_stat(name, &stat) != 0)
-               return 0;
-       if (!S_ISBLK(stat.mode))
-               return 0;
-       return stat.rdev;
-}
-
 #ifdef CONFIG_BLK_DEV_RAM
 
 int __init rd_load_disk(int n);
index b84031528dd4466541a4ac75890e39738fd4c589..359363e85ccd0b969c68cf88a22818c0af765c6f 100644 (file)
@@ -138,9 +138,9 @@ static void __init md_setup_drive(void)
                        dev = MKDEV(MD_MAJOR, minor);
                create_dev(name, dev);
                for (i = 0; i < MD_SB_DISKS && devname != NULL; i++) {
+                       struct kstat stat;
                        char *p;
                        char comp_name[64];
-                       u32 rdev;
 
                        p = strchr(devname, ',');
                        if (p)
@@ -150,9 +150,9 @@ static void __init md_setup_drive(void)
                        if (strncmp(devname, "/dev/", 5) == 0)
                                devname += 5;
                        snprintf(comp_name, 63, "/dev/%s", devname);
-                       rdev = bstat(comp_name);
-                       if (rdev)
-                               dev = new_decode_dev(rdev);
+                       if (vfs_stat(comp_name, &stat) == 0 &&
+                           S_ISBLK(stat.mode))
+                               dev = new_decode_dev(stat.rdev);
                        if (!dev) {
                                printk(KERN_WARNING "md: Unknown device name: %s\n", devname);
                                break;