Skip to content

Commit

Permalink
init: remove the bstat helper
Browse files Browse the repository at this point in the history
The only caller of the bstat function becomes cleaner and simpler when
open coding the function.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: NeilBrown <[email protected]>
Acked-by: Song Liu <[email protected]>
Acked-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Hellwig committed Jul 16, 2020
1 parent 9e96c8c commit 881627f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
10 changes: 0 additions & 10 deletions init/do_mounts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions init/do_mounts_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 881627f

Please sign in to comment.