Skip to content

Commit b729493

Browse files
hoeppnerjaxboe
authored andcommitted
s390/dasd: Prepare for additional path event handling
As more path events need to be handled for ECKD the current path verification infrastructure can be reused. Rename all path verifcation code to fit the more broadly based task of path event handling and put the path verification in a new separate function. Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 19508b2 commit b729493

File tree

3 files changed

+47
-36
lines changed

3 files changed

+47
-36
lines changed

drivers/s390/block/dasd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,8 +2115,8 @@ static void __dasd_device_check_path_events(struct dasd_device *device)
21152115
if (device->stopped &
21162116
~(DASD_STOPPED_DC_WAIT | DASD_UNRESUMED_PM))
21172117
return;
2118-
rc = device->discipline->verify_path(device,
2119-
dasd_path_get_tbvpm(device));
2118+
rc = device->discipline->pe_handler(device,
2119+
dasd_path_get_tbvpm(device));
21202120
if (rc)
21212121
dasd_device_set_timer(device, 50);
21222122
else

drivers/s390/block/dasd_eckd.c

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct ext_pool_exhaust_work_data {
103103
};
104104

105105
/* definitions for the path verification worker */
106-
struct path_verification_work_data {
106+
struct pe_handler_work_data {
107107
struct work_struct worker;
108108
struct dasd_device *device;
109109
struct dasd_ccw_req cqr;
@@ -112,8 +112,8 @@ struct path_verification_work_data {
112112
int isglobal;
113113
__u8 tbvpm;
114114
};
115-
static struct path_verification_work_data *path_verification_worker;
116-
static DEFINE_MUTEX(dasd_path_verification_mutex);
115+
static struct pe_handler_work_data *pe_handler_worker;
116+
static DEFINE_MUTEX(dasd_pe_handler_mutex);
117117

118118
struct check_attention_work_data {
119119
struct work_struct worker;
@@ -1249,7 +1249,7 @@ static int verify_fcx_max_data(struct dasd_device *device, __u8 lpm)
12491249
}
12501250

12511251
static int rebuild_device_uid(struct dasd_device *device,
1252-
struct path_verification_work_data *data)
1252+
struct pe_handler_work_data *data)
12531253
{
12541254
struct dasd_eckd_private *private = device->private;
12551255
__u8 lpm, opm = dasd_path_get_opm(device);
@@ -1287,10 +1287,9 @@ static int rebuild_device_uid(struct dasd_device *device,
12871287
return rc;
12881288
}
12891289

1290-
static void do_path_verification_work(struct work_struct *work)
1290+
static void dasd_eckd_path_available_action(struct dasd_device *device,
1291+
struct pe_handler_work_data *data)
12911292
{
1292-
struct path_verification_work_data *data;
1293-
struct dasd_device *device;
12941293
struct dasd_eckd_private path_private;
12951294
struct dasd_uid *uid;
12961295
__u8 path_rcd_buf[DASD_ECKD_RCD_DATA_SIZE];
@@ -1300,19 +1299,6 @@ static void do_path_verification_work(struct work_struct *work)
13001299
char print_uid[60];
13011300
int rc, pos;
13021301

1303-
data = container_of(work, struct path_verification_work_data, worker);
1304-
device = data->device;
1305-
1306-
/* delay path verification until device was resumed */
1307-
if (test_bit(DASD_FLAG_SUSPENDED, &device->flags)) {
1308-
schedule_work(work);
1309-
return;
1310-
}
1311-
/* check if path verification already running and delay if so */
1312-
if (test_and_set_bit(DASD_FLAG_PATH_VERIFY, &device->flags)) {
1313-
schedule_work(work);
1314-
return;
1315-
}
13161302
opm = 0;
13171303
npm = 0;
13181304
ppm = 0;
@@ -1459,30 +1445,54 @@ static void do_path_verification_work(struct work_struct *work)
14591445

14601446
dasd_path_create_kobj(device, pos);
14611447
}
1448+
}
1449+
1450+
static void do_pe_handler_work(struct work_struct *work)
1451+
{
1452+
struct pe_handler_work_data *data;
1453+
struct dasd_device *device;
1454+
1455+
data = container_of(work, struct pe_handler_work_data, worker);
1456+
device = data->device;
1457+
1458+
/* delay path verification until device was resumed */
1459+
if (test_bit(DASD_FLAG_SUSPENDED, &device->flags)) {
1460+
schedule_work(work);
1461+
return;
1462+
}
1463+
/* check if path verification already running and delay if so */
1464+
if (test_and_set_bit(DASD_FLAG_PATH_VERIFY, &device->flags)) {
1465+
schedule_work(work);
1466+
return;
1467+
}
1468+
1469+
dasd_eckd_path_available_action(device, data);
1470+
14621471
clear_bit(DASD_FLAG_PATH_VERIFY, &device->flags);
14631472
dasd_put_device(device);
14641473
if (data->isglobal)
1465-
mutex_unlock(&dasd_path_verification_mutex);
1474+
mutex_unlock(&dasd_pe_handler_mutex);
14661475
else
14671476
kfree(data);
14681477
}
14691478

1470-
static int dasd_eckd_verify_path(struct dasd_device *device, __u8 lpm)
1479+
static int dasd_eckd_pe_handler(struct dasd_device *device, __u8 lpm)
14711480
{
1472-
struct path_verification_work_data *data;
1481+
struct pe_handler_work_data *data;
14731482

14741483
data = kmalloc(sizeof(*data), GFP_ATOMIC | GFP_DMA);
14751484
if (!data) {
1476-
if (mutex_trylock(&dasd_path_verification_mutex)) {
1477-
data = path_verification_worker;
1485+
if (mutex_trylock(&dasd_pe_handler_mutex)) {
1486+
data = pe_handler_worker;
14781487
data->isglobal = 1;
1479-
} else
1488+
} else {
14801489
return -ENOMEM;
1490+
}
14811491
} else {
14821492
memset(data, 0, sizeof(*data));
14831493
data->isglobal = 0;
14841494
}
1485-
INIT_WORK(&data->worker, do_path_verification_work);
1495+
INIT_WORK(&data->worker, do_pe_handler_work);
14861496
dasd_get_device(device);
14871497
data->device = device;
14881498
data->tbvpm = lpm;
@@ -6725,7 +6735,7 @@ static struct dasd_discipline dasd_eckd_discipline = {
67256735
.check_device = dasd_eckd_check_characteristics,
67266736
.uncheck_device = dasd_eckd_uncheck_device,
67276737
.do_analysis = dasd_eckd_do_analysis,
6728-
.verify_path = dasd_eckd_verify_path,
6738+
.pe_handler = dasd_eckd_pe_handler,
67296739
.basic_to_ready = dasd_eckd_basic_to_ready,
67306740
.online_to_ready = dasd_eckd_online_to_ready,
67316741
.basic_to_known = dasd_eckd_basic_to_known,
@@ -6786,16 +6796,16 @@ dasd_eckd_init(void)
67866796
GFP_KERNEL | GFP_DMA);
67876797
if (!dasd_vol_info_req)
67886798
return -ENOMEM;
6789-
path_verification_worker = kmalloc(sizeof(*path_verification_worker),
6790-
GFP_KERNEL | GFP_DMA);
6791-
if (!path_verification_worker) {
6799+
pe_handler_worker = kmalloc(sizeof(*pe_handler_worker),
6800+
GFP_KERNEL | GFP_DMA);
6801+
if (!pe_handler_worker) {
67926802
kfree(dasd_reserve_req);
67936803
kfree(dasd_vol_info_req);
67946804
return -ENOMEM;
67956805
}
67966806
rawpadpage = (void *)__get_free_page(GFP_KERNEL);
67976807
if (!rawpadpage) {
6798-
kfree(path_verification_worker);
6808+
kfree(pe_handler_worker);
67996809
kfree(dasd_reserve_req);
68006810
kfree(dasd_vol_info_req);
68016811
return -ENOMEM;
@@ -6804,7 +6814,7 @@ dasd_eckd_init(void)
68046814
if (!ret)
68056815
wait_for_device_probe();
68066816
else {
6807-
kfree(path_verification_worker);
6817+
kfree(pe_handler_worker);
68086818
kfree(dasd_reserve_req);
68096819
kfree(dasd_vol_info_req);
68106820
free_page((unsigned long)rawpadpage);
@@ -6816,7 +6826,7 @@ static void __exit
68166826
dasd_eckd_cleanup(void)
68176827
{
68186828
ccw_driver_unregister(&dasd_eckd_driver);
6819-
kfree(path_verification_worker);
6829+
kfree(pe_handler_worker);
68206830
kfree(dasd_reserve_req);
68216831
free_page((unsigned long)rawpadpage);
68226832
}

drivers/s390/block/dasd_int.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ struct dasd_discipline {
298298
* configuration.
299299
*/
300300
int (*verify_path)(struct dasd_device *, __u8);
301+
int (*pe_handler)(struct dasd_device *, __u8);
301302

302303
/*
303304
* Last things to do when a device is set online, and first things

0 commit comments

Comments
 (0)