libnvdimm: Export max available extent
The 'available_size' attribute showing the combined total of all unallocated space isn't always useful to know how large of a namespace a user may be able to allocate if the region is fragmented. This patch will export the largest extent of unallocated space that may be allocated to create a new namespace. Signed-off-by: Keith Busch <keith.busch@intel.com> Reviewed-by: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
Родитель
12e3129e29
Коммит
1e687220ef
|
@ -434,6 +434,21 @@ static ssize_t available_size_show(struct device *dev,
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(available_size);
|
static DEVICE_ATTR_RO(available_size);
|
||||||
|
|
||||||
|
static ssize_t max_available_extent_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct nd_region *nd_region = to_nd_region(dev);
|
||||||
|
unsigned long long available = 0;
|
||||||
|
|
||||||
|
nvdimm_bus_lock(dev);
|
||||||
|
wait_nvdimm_bus_probe_idle(dev);
|
||||||
|
available = nd_region_allocatable_dpa(nd_region);
|
||||||
|
nvdimm_bus_unlock(dev);
|
||||||
|
|
||||||
|
return sprintf(buf, "%llu\n", available);
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RO(max_available_extent);
|
||||||
|
|
||||||
static ssize_t init_namespaces_show(struct device *dev,
|
static ssize_t init_namespaces_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
|
@ -585,6 +600,7 @@ static struct attribute *nd_region_attributes[] = {
|
||||||
&dev_attr_read_only.attr,
|
&dev_attr_read_only.attr,
|
||||||
&dev_attr_set_cookie.attr,
|
&dev_attr_set_cookie.attr,
|
||||||
&dev_attr_available_size.attr,
|
&dev_attr_available_size.attr,
|
||||||
|
&dev_attr_max_available_extent.attr,
|
||||||
&dev_attr_namespace_seed.attr,
|
&dev_attr_namespace_seed.attr,
|
||||||
&dev_attr_init_namespaces.attr,
|
&dev_attr_init_namespaces.attr,
|
||||||
&dev_attr_badblocks.attr,
|
&dev_attr_badblocks.attr,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче