Re: [RFC 01/22] part: call part_init() in blk_get_device_by_str() only for MMC

AKASHI Takahiro
2021-10-04T03:26:57Z

Hi Peter,

On Fri, Oct 01, 2021 at 12:48:24PM +0100, Peter Robinson wrote:
> On Fri, Oct 1, 2021 at 6:03 AM AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > In blk_get_device_by_str(), the comment says: "Updates the partition table
> > for the specified hw partition."
> > Since hw partition is supported only on MMC, it makes no sense to do so
> > for other devices.
>
> Is it not also supported on UFS, and I believe it may also be an
> option in the NVME spec too.

Yeah, maybe.
But under the current implementation, IIUC, neither UFS nor NVME supports
hw partitions as both drivers do not provide a "select_hwpart" function
in blk_ops.
(UFS is seen as an instance of SCSI.)

-Takahiro Akashi

> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> > disk/part.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/disk/part.c b/disk/part.c
> > index a6a8f7052bd3..b330103a5bc0 100644
> > --- a/disk/part.c
> > +++ b/disk/part.c
> > @@ -427,7 +427,8 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
> > * Always should be done, otherwise hw partition 0 will return stale
> > * data after displaying a non-zero hw partition.
> > */
> > - part_init(*dev_desc);
> > + if ((*dev_desc)->if_type == IF_TYPE_MMC)
> > + part_init(*dev_desc);
> > #endif
> >
> > cleanup:
> > --
> > 2.33.0
> >