On Fri, 2018-07-20 at 15:48 -0600, Keith Busch wrote: > On Fri, Jul 20, 2018 at 01:46:06PM -0700, Verma, Vishal L wrote: > > $ cat /sys/bus/nd/devices/region1/max_available_extent > > 17045651456 > > > > $ ndctl list -BNR --region=region1 > > [ > > { > > "provider":"ACPI.NFIT", > > "dev":"ndbus1", > > "regions":[ > > { > > "dev":"region1", > > "size":17045651456, > > "available_size":0, > > "type":"pmem", > > "numa_node":0, > > "persistence_domain":"unknown", > > "namespaces":[ > > { > > "dev":"namespace1.0", > > "mode":"raw", > > "size":17045651456, > > "sector_size":512, > > "blockdev":"pmem1", > > "numa_node":0 > > } > > ... > > > > As we saw, getting the "available_size" directly from the the > region's > sysfs entry also returned the same as max extent: > > $ cat /sys/bus/nd/devices/region1/available_size > 17045651456 > > The reason ndctl shows available_size as '0' is because the nstype is > neither of type PMEM nor BLK. > > So I think max_available_extent is doing the right thing. Yep, I agree. I did however see another potential breakage (the blk- exhaust unit test fails due to this) ndctl create-namespace --bus=nfit_test.0 creates a namespace on say region 3. That makes available_size for region3 zero (as reported by ndctl-list as well as directly from sysfs), but max_available_extent still shows the full size available. $ sudo ndctl create-namespace --bus=nfit_test.0 { "dev":"namespace3.0", "mode":"fsdax", "map":"dev", "size":"28.50 MiB (29.89 MB)", "uuid":"592071ed-0928-4be8-96fb-4be944e4c6f4", "raw_uuid":"c4ac44fa-d3bd-43ea-9a1a-3a083d9fed1d", "sector_size":512, "blockdev":"pmem3" } $ cat /sys/bus/nd/devices/region3/max_available_extent 33554432 $ cat /sys/bus/nd/devices/region3/available_size 0 And then a subsequent ndctl create-namespace --bus=nfit_test.0 sees the max_available extent on region 3 (with the corresponding ndctl patches for this applied), tries to create a namespace again there, and obviously fails. As a side note, I think it may be useful to include in the related ndctl patch, a json entry for the max_available_extent for region listings.