Re: [PATCH 11/18] block: parse partition table on block device registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23-06-01, Sascha Hauer wrote:
> On Wed, May 31, 2023 at 04:59:20PM +0200, Ahmad Fatoum wrote:
> > Every instance where we register a block device, it's followed by an
> > attempt to parse the partition table, most often with a warning when
> > it fails. Thus let's move partition table parsing into
> > blockdevice_register.
> > 
> > Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> > ---
> >  arch/sandbox/board/hostfile.c | 4 ----
> >  common/block.c                | 6 ++++++
> >  drivers/ata/disk_ata_drive.c  | 5 -----
> >  drivers/block/efi-block-io.c  | 9 +--------
> >  drivers/block/virtio_blk.c    | 8 +-------
> >  drivers/mci/mci-core.c        | 6 ------
> >  drivers/nvme/host/core.c      | 5 -----
> >  drivers/usb/storage/usb.c     | 5 -----
> >  8 files changed, 8 insertions(+), 40 deletions(-)
> > 
> > diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
> > index d0f400787d7a..a1ab06b87770 100644
> > --- a/arch/sandbox/board/hostfile.c
> > +++ b/arch/sandbox/board/hostfile.c
> > @@ -166,10 +166,6 @@ static int hf_probe(struct device *dev)
> >  		if (err)
> >  			return err;
> >  
> > -		err = parse_partition_table(&priv->blk);
> > -		if (err)
> > -			dev_warn(dev, "No partition table found\n");
> > -
> >  		dev_info(dev, "registered as block device\n");
> >  	} else {
> >  		cdev->name = np->name;
> > diff --git a/common/block.c b/common/block.c
> > index c39269d3a692..98adcfdf3dab 100644
> > --- a/common/block.c
> > +++ b/common/block.c
> > @@ -6,6 +6,7 @@
> >   */
> >  #include <common.h>
> >  #include <block.h>
> > +#include <disks.h>
> >  #include <malloc.h>
> >  #include <linux/err.h>
> >  #include <linux/list.h>
> > @@ -408,6 +409,11 @@ int blockdevice_register(struct block_device *blk)
> >  
> >  	cdev_create_default_automount(&blk->cdev);
> >  
> > +	/* Lack of partition table is unusual, but not a failure */
> > +	ret = parse_partition_table(blk);
> > +	if (ret)
> > +		dev_warn(blk->dev, "No partition table found\n");
> 
> This is not changed in this series, so it's ok like this, but should
> this really be a warning? Using a raw device without a partition table
> seems like a legitimate usecase.

Good point, maybe we should use dev_notice() as compromise?

Regards,
  Marco

> Sascha
> 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux