diff options
author | Hannes Reinecke <hare@suse.de> | 2013-01-30 04:26:12 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-07-01 11:31:17 -0400 |
commit | 1f1ee9ad6b298400c7a44f860231ac1d3cb7bfd6 (patch) | |
tree | 969a5275d669b6af5ae09d173e19e19256e74903 /drivers/s390 | |
parent | b99a946de6a988a38043180d42e6b7a2f07d4f57 (diff) |
s390/dasd: make number of retries configurable
Instead of having the number of retries hard-coded in the various
functions we should be using a default retry value, which can
be modified via sysfs.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 41 | ||||
-rw-r--r-- | drivers/s390/block/dasd_diag.c | 3 | ||||
-rw-r--r-- | drivers/s390/block/dasd_eckd.c | 11 | ||||
-rw-r--r-- | drivers/s390/block/dasd_fba.c | 5 | ||||
-rw-r--r-- | drivers/s390/block/dasd_int.h | 3 |
5 files changed, 57 insertions, 6 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index a71bb8aaca1d..bc3e7afac18b 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -1240,6 +1240,46 @@ dasd_expires_store(struct device *dev, struct device_attribute *attr, | |||
1240 | 1240 | ||
1241 | static DEVICE_ATTR(expires, 0644, dasd_expires_show, dasd_expires_store); | 1241 | static DEVICE_ATTR(expires, 0644, dasd_expires_show, dasd_expires_store); |
1242 | 1242 | ||
1243 | static ssize_t | ||
1244 | dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1245 | { | ||
1246 | struct dasd_device *device; | ||
1247 | int len; | ||
1248 | |||
1249 | device = dasd_device_from_cdev(to_ccwdev(dev)); | ||
1250 | if (IS_ERR(device)) | ||
1251 | return -ENODEV; | ||
1252 | len = snprintf(buf, PAGE_SIZE, "%lu\n", device->default_retries); | ||
1253 | dasd_put_device(device); | ||
1254 | return len; | ||
1255 | } | ||
1256 | |||
1257 | static ssize_t | ||
1258 | dasd_retries_store(struct device *dev, struct device_attribute *attr, | ||
1259 | const char *buf, size_t count) | ||
1260 | { | ||
1261 | struct dasd_device *device; | ||
1262 | unsigned long val; | ||
1263 | |||
1264 | device = dasd_device_from_cdev(to_ccwdev(dev)); | ||
1265 | if (IS_ERR(device)) | ||
1266 | return -ENODEV; | ||
1267 | |||
1268 | if ((strict_strtoul(buf, 10, &val) != 0) || | ||
1269 | (val > DASD_RETRIES_MAX)) { | ||
1270 | dasd_put_device(device); | ||
1271 | return -EINVAL; | ||
1272 | } | ||
1273 | |||
1274 | if (val) | ||
1275 | device->default_retries = val; | ||
1276 | |||
1277 | dasd_put_device(device); | ||
1278 | return count; | ||
1279 | } | ||
1280 | |||
1281 | static DEVICE_ATTR(retries, 0644, dasd_retries_show, dasd_retries_store); | ||
1282 | |||
1243 | static ssize_t dasd_reservation_policy_show(struct device *dev, | 1283 | static ssize_t dasd_reservation_policy_show(struct device *dev, |
1244 | struct device_attribute *attr, | 1284 | struct device_attribute *attr, |
1245 | char *buf) | 1285 | char *buf) |
@@ -1350,6 +1390,7 @@ static struct attribute * dasd_attrs[] = { | |||
1350 | &dev_attr_erplog.attr, | 1390 | &dev_attr_erplog.attr, |
1351 | &dev_attr_failfast.attr, | 1391 | &dev_attr_failfast.attr, |
1352 | &dev_attr_expires.attr, | 1392 | &dev_attr_expires.attr, |
1393 | &dev_attr_retries.attr, | ||
1353 | &dev_attr_reservation_policy.attr, | 1394 | &dev_attr_reservation_policy.attr, |
1354 | &dev_attr_last_known_reservation_state.attr, | 1395 | &dev_attr_last_known_reservation_state.attr, |
1355 | &dev_attr_safe_offline.attr, | 1396 | &dev_attr_safe_offline.attr, |
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index cc0603358522..154842242c3d 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -359,6 +359,7 @@ dasd_diag_check_device(struct dasd_device *device) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | device->default_expires = DIAG_TIMEOUT; | 361 | device->default_expires = DIAG_TIMEOUT; |
362 | device->default_retries = DIAG_MAX_RETRIES; | ||
362 | 363 | ||
363 | /* Figure out position of label block */ | 364 | /* Figure out position of label block */ |
364 | switch (private->rdc_data.vdev_class) { | 365 | switch (private->rdc_data.vdev_class) { |
@@ -555,7 +556,7 @@ static struct dasd_ccw_req *dasd_diag_build_cp(struct dasd_device *memdev, | |||
555 | recid++; | 556 | recid++; |
556 | } | 557 | } |
557 | } | 558 | } |
558 | cqr->retries = DIAG_MAX_RETRIES; | 559 | cqr->retries = memdev->default_retries; |
559 | cqr->buildclk = get_tod_clock(); | 560 | cqr->buildclk = get_tod_clock(); |
560 | if (blk_noretry_request(req) || | 561 | if (blk_noretry_request(req) || |
561 | block->base->features & DASD_FEATURE_FAILFAST) | 562 | block->base->features & DASD_FEATURE_FAILFAST) |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 696735962938..05f5694c9c49 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1682,6 +1682,9 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1682 | 1682 | ||
1683 | /* set default timeout */ | 1683 | /* set default timeout */ |
1684 | device->default_expires = DASD_EXPIRES; | 1684 | device->default_expires = DASD_EXPIRES; |
1685 | /* set default retry count */ | ||
1686 | device->default_retries = DASD_RETRIES; | ||
1687 | |||
1685 | if (private->gneq) { | 1688 | if (private->gneq) { |
1686 | value = 1; | 1689 | value = 1; |
1687 | for (i = 0; i < private->gneq->timeout.value; i++) | 1690 | for (i = 0; i < private->gneq->timeout.value; i++) |
@@ -2659,7 +2662,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single( | |||
2659 | cqr->block = block; | 2662 | cqr->block = block; |
2660 | cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ | 2663 | cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ |
2661 | cqr->lpm = startdev->path_data.ppm; | 2664 | cqr->lpm = startdev->path_data.ppm; |
2662 | cqr->retries = 256; | 2665 | cqr->retries = startdev->default_retries; |
2663 | cqr->buildclk = get_tod_clock(); | 2666 | cqr->buildclk = get_tod_clock(); |
2664 | cqr->status = DASD_CQR_FILLED; | 2667 | cqr->status = DASD_CQR_FILLED; |
2665 | return cqr; | 2668 | return cqr; |
@@ -2834,7 +2837,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_track( | |||
2834 | cqr->block = block; | 2837 | cqr->block = block; |
2835 | cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ | 2838 | cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ |
2836 | cqr->lpm = startdev->path_data.ppm; | 2839 | cqr->lpm = startdev->path_data.ppm; |
2837 | cqr->retries = 256; | 2840 | cqr->retries = startdev->default_retries; |
2838 | cqr->buildclk = get_tod_clock(); | 2841 | cqr->buildclk = get_tod_clock(); |
2839 | cqr->status = DASD_CQR_FILLED; | 2842 | cqr->status = DASD_CQR_FILLED; |
2840 | return cqr; | 2843 | return cqr; |
@@ -3127,7 +3130,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
3127 | cqr->block = block; | 3130 | cqr->block = block; |
3128 | cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ | 3131 | cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ |
3129 | cqr->lpm = startdev->path_data.ppm; | 3132 | cqr->lpm = startdev->path_data.ppm; |
3130 | cqr->retries = 256; | 3133 | cqr->retries = startdev->default_retries; |
3131 | cqr->buildclk = get_tod_clock(); | 3134 | cqr->buildclk = get_tod_clock(); |
3132 | cqr->status = DASD_CQR_FILLED; | 3135 | cqr->status = DASD_CQR_FILLED; |
3133 | return cqr; | 3136 | return cqr; |
@@ -3330,7 +3333,7 @@ static struct dasd_ccw_req *dasd_raw_build_cp(struct dasd_device *startdev, | |||
3330 | cqr->block = block; | 3333 | cqr->block = block; |
3331 | cqr->expires = startdev->default_expires * HZ; | 3334 | cqr->expires = startdev->default_expires * HZ; |
3332 | cqr->lpm = startdev->path_data.ppm; | 3335 | cqr->lpm = startdev->path_data.ppm; |
3333 | cqr->retries = 256; | 3336 | cqr->retries = startdev->default_retries; |
3334 | cqr->buildclk = get_tod_clock(); | 3337 | cqr->buildclk = get_tod_clock(); |
3335 | cqr->status = DASD_CQR_FILLED; | 3338 | cqr->status = DASD_CQR_FILLED; |
3336 | 3339 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 4dd0e2f6047e..d232c83ea95a 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #endif /* PRINTK_HEADER */ | 29 | #endif /* PRINTK_HEADER */ |
30 | #define PRINTK_HEADER "dasd(fba):" | 30 | #define PRINTK_HEADER "dasd(fba):" |
31 | 31 | ||
32 | #define FBA_DEFAULT_RETRIES 32 | ||
33 | |||
32 | #define DASD_FBA_CCW_WRITE 0x41 | 34 | #define DASD_FBA_CCW_WRITE 0x41 |
33 | #define DASD_FBA_CCW_READ 0x42 | 35 | #define DASD_FBA_CCW_READ 0x42 |
34 | #define DASD_FBA_CCW_LOCATE 0x43 | 36 | #define DASD_FBA_CCW_LOCATE 0x43 |
@@ -167,6 +169,7 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
167 | } | 169 | } |
168 | 170 | ||
169 | device->default_expires = DASD_EXPIRES; | 171 | device->default_expires = DASD_EXPIRES; |
172 | device->default_retries = FBA_DEFAULT_RETRIES; | ||
170 | device->path_data.opm = LPM_ANYPATH; | 173 | device->path_data.opm = LPM_ANYPATH; |
171 | 174 | ||
172 | readonly = dasd_device_is_ro(device); | 175 | readonly = dasd_device_is_ro(device); |
@@ -369,7 +372,7 @@ static struct dasd_ccw_req *dasd_fba_build_cp(struct dasd_device * memdev, | |||
369 | cqr->memdev = memdev; | 372 | cqr->memdev = memdev; |
370 | cqr->block = block; | 373 | cqr->block = block; |
371 | cqr->expires = memdev->default_expires * HZ; /* default 5 minutes */ | 374 | cqr->expires = memdev->default_expires * HZ; /* default 5 minutes */ |
372 | cqr->retries = 32; | 375 | cqr->retries = memdev->default_retries; |
373 | cqr->buildclk = get_tod_clock(); | 376 | cqr->buildclk = get_tod_clock(); |
374 | cqr->status = DASD_CQR_FILLED; | 377 | cqr->status = DASD_CQR_FILLED; |
375 | return cqr; | 378 | return cqr; |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 0785bd9bd5b6..ad42075868c7 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -224,6 +224,8 @@ struct dasd_ccw_req { | |||
224 | /* default expiration time*/ | 224 | /* default expiration time*/ |
225 | #define DASD_EXPIRES 300 | 225 | #define DASD_EXPIRES 300 |
226 | #define DASD_EXPIRES_MAX 40000000 | 226 | #define DASD_EXPIRES_MAX 40000000 |
227 | #define DASD_RETRIES 256 | ||
228 | #define DASD_RETRIES_MAX 32768 | ||
227 | 229 | ||
228 | /* per dasd_ccw_req flags */ | 230 | /* per dasd_ccw_req flags */ |
229 | #define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */ | 231 | #define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */ |
@@ -466,6 +468,7 @@ struct dasd_device { | |||
466 | 468 | ||
467 | /* default expiration time in s */ | 469 | /* default expiration time in s */ |
468 | unsigned long default_expires; | 470 | unsigned long default_expires; |
471 | unsigned long default_retries; | ||
469 | 472 | ||
470 | struct dentry *debugfs_dentry; | 473 | struct dentry *debugfs_dentry; |
471 | struct dasd_profile profile; | 474 | struct dasd_profile profile; |