Skip to content

Commit

Permalink
s390/dasd: Recognise data for ESE volumes
Browse files Browse the repository at this point in the history
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 <hoeppner@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
  • Loading branch information
Jan Höppner authored and Vasily Gorbik committed Jul 11, 2019
1 parent 461db0e commit c729696
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 4 deletions.
70 changes: 66 additions & 4 deletions drivers/s390/block/dasd_devmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,35 @@ static DEVICE_ATTR(path_interval, 0644, dasd_path_interval_show,
dasd_path_interval_store);


#define DASD_DEFINE_ATTR(_name, _func) \
static ssize_t dasd_##_name##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
struct ccw_device *cdev = to_ccwdev(dev); \
struct dasd_device *device = dasd_device_from_cdev(cdev); \
int val = 0; \
\
if (IS_ERR(device)) \
return -ENODEV; \
if (device->discipline && _func) \
val = _func(device); \
dasd_put_device(device); \
\
return snprintf(buf, PAGE_SIZE, "%d\n", val); \
} \
static DEVICE_ATTR(_name, 0444, dasd_##_name##_show, NULL); \

DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);

static struct attribute * dasd_attrs[] = {
&dev_attr_readonly.attr,
&dev_attr_discipline.attr,
Expand All @@ -1667,13 +1696,47 @@ static struct attribute * dasd_attrs[] = {
&dev_attr_path_interval.attr,
&dev_attr_path_reset.attr,
&dev_attr_hpf.attr,
&dev_attr_ese.attr,
NULL,
};

static const struct attribute_group dasd_attr_group = {
.attrs = dasd_attrs,
};

static struct attribute *capacity_attrs[] = {
&dev_attr_space_configured.attr,
&dev_attr_space_allocated.attr,
&dev_attr_logical_capacity.attr,
NULL,
};

static const struct attribute_group capacity_attr_group = {
.name = "capacity",
.attrs = capacity_attrs,
};

static struct attribute *ext_pool_attrs[] = {
&dev_attr_pool_id.attr,
&dev_attr_extent_size.attr,
&dev_attr_warn_threshold.attr,
&dev_attr_cap_at_warnlevel.attr,
&dev_attr_pool_oos.attr,
NULL,
};

static const struct attribute_group ext_pool_attr_group = {
.name = "extent_pool",
.attrs = ext_pool_attrs,
};

static const struct attribute_group *dasd_attr_groups[] = {
&dasd_attr_group,
&capacity_attr_group,
&ext_pool_attr_group,
NULL,
};

/*
* Return value of the specified feature.
*/
Expand Down Expand Up @@ -1715,16 +1778,15 @@ dasd_set_feature(struct ccw_device *cdev, int feature, int flag)
EXPORT_SYMBOL(dasd_set_feature);


int
dasd_add_sysfs_files(struct ccw_device *cdev)
int dasd_add_sysfs_files(struct ccw_device *cdev)
{
return sysfs_create_group(&cdev->dev.kobj, &dasd_attr_group);
return sysfs_create_groups(&cdev->dev.kobj, dasd_attr_groups);
}

void
dasd_remove_sysfs_files(struct ccw_device *cdev)
{
sysfs_remove_group(&cdev->dev.kobj, &dasd_attr_group);
sysfs_remove_groups(&cdev->dev.kobj, dasd_attr_groups);
}


Expand Down
Loading

0 comments on commit c729696

Please sign in to comment.