Skip to content

Commit c729696

Browse files
hoeppnerjVasily Gorbik
authored andcommitted
s390/dasd: Recognise data for ESE volumes
In order to work with Extent Space Efficient (ESE) volumes, certain viable information about those volumes and the corresponding extent pool (such as extent size, configured space, allocated space, etc.) can be provided. Use the CCW commands Volume Storage Query and Logical Configuration Query to receive detailed information about ESE volumes and the extent pool respectively. These information are made accessible via internal functions for subsequent users, and via sysfs attributes for userpsace usage. The new sysfs attributes reside in separate directories called capacity and extent_pool. attributes: ese: 0/1 depending on whether the volume is an ESE volume Capacity related attributes: space_allocated: Space currently allocated by the volume (in cyl) space_configured: Remaining space in the extent pool (in cyl) logical_capacity: The entire addressable space for this volume (in cyl) Extent Pool related attributes: pool_id: ID of the extent pool the volume in question resides in pool_oos: Extent pool is out-of-space extent_size: Size of a single extent in this pool cap_at_warnlevel Extent pool capacity at warn level warn_threshold: Threshold at which percentage of remaining extent pool space a warning message is issued Signed-off-by: Jan Höppner <[email protected]> Reviewed-by: Stefan Haberland <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 461db0e commit c729696

File tree

4 files changed

+430
-4
lines changed

4 files changed

+430
-4
lines changed

drivers/s390/block/dasd_devmap.c

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,35 @@ static DEVICE_ATTR(path_interval, 0644, dasd_path_interval_show,
16421642
dasd_path_interval_store);
16431643

16441644

1645+
#define DASD_DEFINE_ATTR(_name, _func) \
1646+
static ssize_t dasd_##_name##_show(struct device *dev, \
1647+
struct device_attribute *attr, \
1648+
char *buf) \
1649+
{ \
1650+
struct ccw_device *cdev = to_ccwdev(dev); \
1651+
struct dasd_device *device = dasd_device_from_cdev(cdev); \
1652+
int val = 0; \
1653+
\
1654+
if (IS_ERR(device)) \
1655+
return -ENODEV; \
1656+
if (device->discipline && _func) \
1657+
val = _func(device); \
1658+
dasd_put_device(device); \
1659+
\
1660+
return snprintf(buf, PAGE_SIZE, "%d\n", val); \
1661+
} \
1662+
static DEVICE_ATTR(_name, 0444, dasd_##_name##_show, NULL); \
1663+
1664+
DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
1665+
DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
1666+
DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
1667+
DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
1668+
DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
1669+
DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
1670+
DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
1671+
DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
1672+
DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
1673+
16451674
static struct attribute * dasd_attrs[] = {
16461675
&dev_attr_readonly.attr,
16471676
&dev_attr_discipline.attr,
@@ -1667,13 +1696,47 @@ static struct attribute * dasd_attrs[] = {
16671696
&dev_attr_path_interval.attr,
16681697
&dev_attr_path_reset.attr,
16691698
&dev_attr_hpf.attr,
1699+
&dev_attr_ese.attr,
16701700
NULL,
16711701
};
16721702

16731703
static const struct attribute_group dasd_attr_group = {
16741704
.attrs = dasd_attrs,
16751705
};
16761706

1707+
static struct attribute *capacity_attrs[] = {
1708+
&dev_attr_space_configured.attr,
1709+
&dev_attr_space_allocated.attr,
1710+
&dev_attr_logical_capacity.attr,
1711+
NULL,
1712+
};
1713+
1714+
static const struct attribute_group capacity_attr_group = {
1715+
.name = "capacity",
1716+
.attrs = capacity_attrs,
1717+
};
1718+
1719+
static struct attribute *ext_pool_attrs[] = {
1720+
&dev_attr_pool_id.attr,
1721+
&dev_attr_extent_size.attr,
1722+
&dev_attr_warn_threshold.attr,
1723+
&dev_attr_cap_at_warnlevel.attr,
1724+
&dev_attr_pool_oos.attr,
1725+
NULL,
1726+
};
1727+
1728+
static const struct attribute_group ext_pool_attr_group = {
1729+
.name = "extent_pool",
1730+
.attrs = ext_pool_attrs,
1731+
};
1732+
1733+
static const struct attribute_group *dasd_attr_groups[] = {
1734+
&dasd_attr_group,
1735+
&capacity_attr_group,
1736+
&ext_pool_attr_group,
1737+
NULL,
1738+
};
1739+
16771740
/*
16781741
* Return value of the specified feature.
16791742
*/
@@ -1715,16 +1778,15 @@ dasd_set_feature(struct ccw_device *cdev, int feature, int flag)
17151778
EXPORT_SYMBOL(dasd_set_feature);
17161779

17171780

1718-
int
1719-
dasd_add_sysfs_files(struct ccw_device *cdev)
1781+
int dasd_add_sysfs_files(struct ccw_device *cdev)
17201782
{
1721-
return sysfs_create_group(&cdev->dev.kobj, &dasd_attr_group);
1783+
return sysfs_create_groups(&cdev->dev.kobj, dasd_attr_groups);
17221784
}
17231785

17241786
void
17251787
dasd_remove_sysfs_files(struct ccw_device *cdev)
17261788
{
1727-
sysfs_remove_group(&cdev->dev.kobj, &dasd_attr_group);
1789+
sysfs_remove_groups(&cdev->dev.kobj, dasd_attr_groups);
17281790
}
17291791

17301792

0 commit comments

Comments
 (0)