Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

init: remove the bstat helper

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>

+4 -14
-10
init/do_mounts.h
··· 20 20 return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); 21 21 } 22 22 23 - static inline u32 bstat(char *name) 24 - { 25 - struct kstat stat; 26 - if (vfs_stat(name, &stat) != 0) 27 - return 0; 28 - if (!S_ISBLK(stat.mode)) 29 - return 0; 30 - return stat.rdev; 31 - } 32 - 33 23 #ifdef CONFIG_BLK_DEV_RAM 34 24 35 25 int __init rd_load_disk(int n);
+4 -4
init/do_mounts_md.c
··· 138 138 dev = MKDEV(MD_MAJOR, minor); 139 139 create_dev(name, dev); 140 140 for (i = 0; i < MD_SB_DISKS && devname != NULL; i++) { 141 + struct kstat stat; 141 142 char *p; 142 143 char comp_name[64]; 143 - u32 rdev; 144 144 145 145 p = strchr(devname, ','); 146 146 if (p) ··· 150 150 if (strncmp(devname, "/dev/", 5) == 0) 151 151 devname += 5; 152 152 snprintf(comp_name, 63, "/dev/%s", devname); 153 - rdev = bstat(comp_name); 154 - if (rdev) 155 - dev = new_decode_dev(rdev); 153 + if (vfs_stat(comp_name, &stat) == 0 && 154 + S_ISBLK(stat.mode)) 155 + dev = new_decode_dev(stat.rdev); 156 156 if (!dev) { 157 157 printk(KERN_WARNING "md: Unknown device name: %s\n", devname); 158 158 break;