Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31128
b: refs/heads/master
c: 4054557
h: refs/heads/master
v: v3
  • Loading branch information
Horst Hummel authored and Martin Schwidefsky committed Jun 29, 2006
1 parent 0ba6814 commit 6d516b0
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 91 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8f27766a883149926e7c1f69d9f1d8f68efcd65f
refs/heads/master: 405455734e1cdec09c37233216f9240cb1a058e5
51 changes: 23 additions & 28 deletions trunk/drivers/s390/block/dasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1855,15 +1855,34 @@ dasd_generic_probe (struct ccw_device *cdev,
{
int ret;

ret = ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP);
if (ret) {
printk(KERN_WARNING
"dasd_generic_probe: could not set ccw-device options "
"for %s\n", cdev->dev.bus_id);
return ret;
}
ret = dasd_add_sysfs_files(cdev);
if (ret) {
printk(KERN_WARNING
"dasd_generic_probe: could not add sysfs entries "
"for %s\n", cdev->dev.bus_id);
} else {
cdev->handler = &dasd_int_handler;
return ret;
}
cdev->handler = &dasd_int_handler;

/*
* Automatically online either all dasd devices (dasd_autodetect)
* or all devices specified with dasd= parameters during
* initial probe.
*/
if ((dasd_get_feature(cdev, DASD_FEATURE_INITIAL_ONLINE) > 0 ) ||
(dasd_autodetect && dasd_busid_known(cdev->dev.bus_id) != 0))
ret = ccw_device_set_online(cdev);
if (ret)
printk(KERN_WARNING
"dasd_generic_probe: could not initially online "
"ccw-device %s\n", cdev->dev.bus_id);
return ret;
}

Expand Down Expand Up @@ -1911,6 +1930,8 @@ dasd_generic_set_online (struct ccw_device *cdev,
struct dasd_device *device;
int rc;

/* first online clears initial online feature flag */
dasd_set_feature(cdev, DASD_FEATURE_INITIAL_ONLINE, 0);
device = dasd_create_device(cdev);
if (IS_ERR(device))
return PTR_ERR(device);
Expand Down Expand Up @@ -2065,31 +2086,6 @@ dasd_generic_notify(struct ccw_device *cdev, int event)
return ret;
}

/*
* Automatically online either all dasd devices (dasd_autodetect) or
* all devices specified with dasd= parameters.
*/
static int
__dasd_auto_online(struct device *dev, void *data)
{
struct ccw_device *cdev;

cdev = to_ccwdev(dev);
if (dasd_autodetect || dasd_busid_known(cdev->dev.bus_id) == 0)
ccw_device_set_online(cdev);
return 0;
}

void
dasd_generic_auto_online (struct ccw_driver *dasd_discipline_driver)
{
struct device_driver *drv;

drv = get_driver(&dasd_discipline_driver->driver);
driver_for_each_device(drv, NULL, NULL, __dasd_auto_online);
put_driver(drv);
}


static int __init
dasd_init(void)
Expand Down Expand Up @@ -2170,5 +2166,4 @@ EXPORT_SYMBOL_GPL(dasd_generic_remove);
EXPORT_SYMBOL_GPL(dasd_generic_notify);
EXPORT_SYMBOL_GPL(dasd_generic_set_online);
EXPORT_SYMBOL_GPL(dasd_generic_set_offline);
EXPORT_SYMBOL_GPL(dasd_generic_auto_online);

80 changes: 71 additions & 9 deletions trunk/drivers/s390/block/dasd_devmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "dasd_int.h"

kmem_cache_t *dasd_page_cache;
EXPORT_SYMBOL(dasd_page_cache);
EXPORT_SYMBOL_GPL(dasd_page_cache);

/*
* dasd_devmap_t is used to store the features and the relation
Expand All @@ -48,6 +48,20 @@ struct dasd_devmap {
struct dasd_uid uid;
};

/*
* dasd_servermap is used to store the server_id of all storage servers
* accessed by DASD device driver.
*/
struct dasd_servermap {
struct list_head list;
struct server_id {
char vendor[4];
char serial[15];
} sid;
};

static struct list_head dasd_serverlist;

/*
* Parameter parsing functions for dasd= parameter. The syntax is:
* <devno> : (0x)?[0-9a-fA-F]+
Expand All @@ -64,6 +78,8 @@ struct dasd_devmap {

int dasd_probeonly = 0; /* is true, when probeonly mode is active */
int dasd_autodetect = 0; /* is true, when autodetection is active */
int dasd_nopav = 0; /* is true, when PAV is disabled */
EXPORT_SYMBOL_GPL(dasd_nopav);

/*
* char *dasd[] is intended to hold the ranges supplied by the dasd= statement
Expand Down Expand Up @@ -228,19 +244,24 @@ dasd_parse_keyword( char *parsestring ) {
length = strlen(parsestring);
residual_str = parsestring + length;
}
if (strncmp ("autodetect", parsestring, length) == 0) {
if (strncmp("autodetect", parsestring, length) == 0) {
dasd_autodetect = 1;
MESSAGE (KERN_INFO, "%s",
"turning to autodetection mode");
return residual_str;
}
if (strncmp ("probeonly", parsestring, length) == 0) {
if (strncmp("probeonly", parsestring, length) == 0) {
dasd_probeonly = 1;
MESSAGE(KERN_INFO, "%s",
"turning to probeonly mode");
return residual_str;
}
if (strncmp ("fixedbuffers", parsestring, length) == 0) {
if (strncmp("nopav", parsestring, length) == 0) {
dasd_nopav = 1;
MESSAGE(KERN_INFO, "%s", "disable PAV mode");
return residual_str;
}
if (strncmp("fixedbuffers", parsestring, length) == 0) {
if (dasd_page_cache)
return residual_str;
dasd_page_cache =
Expand Down Expand Up @@ -294,6 +315,8 @@ dasd_parse_range( char *parsestring ) {
features = dasd_feature_list(str, &str);
if (features < 0)
return ERR_PTR(-EINVAL);
/* each device in dasd= parameter should be set initially online */
features |= DASD_FEATURE_INITIAL_ONLINE;
while (from <= to) {
sprintf(bus_id, "%01x.%01x.%04x",
from_id0, from_id1, from++);
Expand Down Expand Up @@ -836,6 +859,38 @@ static struct attribute_group dasd_attr_group = {
.attrs = dasd_attrs,
};

/*
* Check if the related storage server is already contained in the
* dasd_serverlist. If server is not contained, create new entry.
* Return 0 if server was already in serverlist,
* 1 if the server was added successfully
* <0 in case of error.
*/
static int
dasd_add_server(struct dasd_uid *uid)
{
struct dasd_servermap *new, *tmp;

/* check if server is already contained */
list_for_each_entry(tmp, &dasd_serverlist, list)
// normale cmp?
if (strncmp(tmp->sid.vendor, uid->vendor,
sizeof(tmp->sid.vendor)) == 0
&& strncmp(tmp->sid.serial, uid->serial,
sizeof(tmp->sid.serial)) == 0)
return 0;

new = (struct dasd_servermap *)
kzalloc(sizeof(struct dasd_servermap), GFP_KERNEL);
if (!new)
return -ENOMEM;

strncpy(new->sid.vendor, uid->vendor, sizeof(new->sid.vendor));
strncpy(new->sid.serial, uid->serial, sizeof(new->sid.serial));
list_add(&new->list, &dasd_serverlist);
return 1;
}


/*
* Return copy of the device unique identifier.
Expand All @@ -856,21 +911,26 @@ dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid)

/*
* Register the given device unique identifier into devmap struct.
* Return 0 if server was already in serverlist,
* 1 if the server was added successful
* <0 in case of error.
*/
int
dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid)
{
struct dasd_devmap *devmap;
int rc;

devmap = dasd_find_busid(cdev->dev.bus_id);
if (IS_ERR(devmap))
return PTR_ERR(devmap);
spin_lock(&dasd_devmap_lock);
devmap->uid = *uid;
rc = dasd_add_server(uid);
spin_unlock(&dasd_devmap_lock);
return 0;
return rc;
}
EXPORT_SYMBOL(dasd_set_uid);
EXPORT_SYMBOL_GPL(dasd_set_uid);

/*
* Return value of the specified feature.
Expand All @@ -882,7 +942,7 @@ dasd_get_feature(struct ccw_device *cdev, int feature)

devmap = dasd_find_busid(cdev->dev.bus_id);
if (IS_ERR(devmap))
return (int) PTR_ERR(devmap);
return PTR_ERR(devmap);

return ((devmap->features & feature) != 0);
}
Expand All @@ -898,7 +958,7 @@ dasd_set_feature(struct ccw_device *cdev, int feature, int flag)

devmap = dasd_find_busid(cdev->dev.bus_id);
if (IS_ERR(devmap))
return (int) PTR_ERR(devmap);
return PTR_ERR(devmap);

spin_lock(&dasd_devmap_lock);
if (flag)
Expand Down Expand Up @@ -934,8 +994,10 @@ dasd_devmap_init(void)
dasd_max_devindex = 0;
for (i = 0; i < 256; i++)
INIT_LIST_HEAD(&dasd_hashlists[i]);
return 0;

/* Initialize servermap structure. */
INIT_LIST_HEAD(&dasd_serverlist);
return 0;
}

void
Expand Down
Loading

0 comments on commit 6d516b0

Please sign in to comment.