[01/16] init: remove the bstat helper
diff mbox series

Message ID 20200615125323.930983-2-hch@lst.de
State New
Headers show
Series
  • [01/16] init: remove the bstat helper
Related show

Commit Message

Christoph Hellwig June 15, 2020, 12:53 p.m. UTC
The only caller of the bstat function becomes cleaner and simpler when
open coding the function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 init/do_mounts.h    | 10 ----------
 init/do_mounts_md.c |  8 ++++----
 2 files changed, 4 insertions(+), 14 deletions(-)

Comments

Song Liu July 2, 2020, 11:25 p.m. UTC | #1
Hi Christoph,

On Mon, Jun 15, 2020 at 5:53 AM Christoph Hellwig <hch@lst.de> wrote:
>
> The only caller of the bstat function becomes cleaner and simpler when
> open coding the function.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Thanks for the set. md parts of the set look good to me.

How should we route this set, as it touches multiple subsystems?

Thanks,
Song
Christoph Hellwig July 7, 2020, 10:34 a.m. UTC | #2
On Thu, Jul 02, 2020 at 04:25:41PM -0700, Song Liu wrote:
> Hi Christoph,
> 
> On Mon, Jun 15, 2020 at 5:53 AM Christoph Hellwig <hch@lst.de> wrote:
> >
> > The only caller of the bstat function becomes cleaner and simpler when
> > open coding the function.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Thanks for the set. md parts of the set look good to me.
> 
> How should we route this set, as it touches multiple subsystems?

Good question as there is no really applicable tree.  One option
would the vfs tree as it toucheѕ some VFS stuff, and the follow on
series that depends on it is all about VFS bits.  Alternatively I
could set up a tree just for these bits.  The important bit is that
it doesn't go into the -mm tree as the usual catchall, as I have
more stuff that depends on it and requires a git tree.
Song Liu July 7, 2020, 4:54 p.m. UTC | #3
On Tue, Jul 7, 2020 at 3:34 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Thu, Jul 02, 2020 at 04:25:41PM -0700, Song Liu wrote:
> > Hi Christoph,
> >
> > On Mon, Jun 15, 2020 at 5:53 AM Christoph Hellwig <hch@lst.de> wrote:
> > >
> > > The only caller of the bstat function becomes cleaner and simpler when
> > > open coding the function.
> > >
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> >
> > Thanks for the set. md parts of the set look good to me.
> >
> > How should we route this set, as it touches multiple subsystems?
>
> Good question as there is no really applicable tree.  One option
> would the vfs tree as it toucheѕ some VFS stuff, and the follow on
> series that depends on it is all about VFS bits.  Alternatively I
> could set up a tree just for these bits.  The important bit is that
> it doesn't go into the -mm tree as the usual catchall, as I have
> more stuff that depends on it and requires a git tree.

Would this official mm tree work?

T:      git git://github.com/hnaz/linux-mm.git

If not, I am OK with either vfs tree or a dedicated tree.

Thanks,
Song
Christoph Hellwig July 8, 2020, 6:38 a.m. UTC | #4
On Tue, Jul 07, 2020 at 09:54:30AM -0700, Song Liu wrote:
> Would this official mm tree work?
> 
> T:      git git://github.com/hnaz/linux-mm.git
> 
> If not, I am OK with either vfs tree or a dedicated tree.

That is a constantly rebased tree, so I don't think it helps.

Patch
diff mbox series

diff --git a/init/do_mounts.h b/init/do_mounts.h
index 0bb0806de4ce2c..7513d1c14d13fe 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -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);
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index b84031528dd446..359363e85ccd0b 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -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;