[parted-devel] [PATCH] Add support for NVDIMM devices

Brian C. Lane bcl at redhat.com
Thu Nov 2 00:35:06 UTC 2017


On Wed, Nov 01, 2017 at 09:43:04AM -0400, Phil Susi wrote:
> On 10/24/2017 4:22 AM, Sebastian Parschauer wrote:
> > Recognize NVDIMM devices, so that "parted -s /dev/pmem7 p" now
> > prints "Model: NVDIMM Device (pmem)" instead of
> > "Model: Unknown (unknown)".
> > 
> > In order for a device to be recognized as NVDIMM, it has to
> > have a 'blkext' major number. But since this major can be
> > used also by other device types, we also check that the device
> > path contains 'pmem' as a substring.
> 
> That will break if someone runs parted on /dev/disk/by-id or some such.
> There must be a more reliable way to decide if it is an nvdimm device.
> What about something in the device's sysfs node?

My understanding is that this is the only way to tell what these new
devices are, and we're already doing the same thing for nvme. It's
limited by a couple of things:

 1. Only blkext major's will be considered.
 2. It's at the end of the if/else so SCSI, etc. have already been
    checked.
 3. The filename path is canonicalized by ped_device_get before calling
    new() so internally we're always using the /dev/pmem name no matter
    what the symlink says.

So I think this is pretty safe.

-- 
Brian C. Lane (PST8PDT)



More information about the parted-devel mailing list