10 #define KMSG_COMPONENT "dasd"
11 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
16 #include <linux/ctype.h>
18 #include <linux/slab.h>
33 #define PRINTK_HEADER "dasd:"
39 #define DASD_CHANQ_MAX_SIZE 4
41 #define DASD_SLEEPON_START_TAG (void *) 1
42 #define DASD_SLEEPON_END_TAG (void *) 2
48 static struct dentry *dasd_debugfs_root_entry;
54 " Copyright IBM Corp. 2000");
61 static int dasd_alloc_queue(
struct dasd_block *);
62 static void dasd_setup_queue(
struct dasd_block *);
63 static void dasd_free_queue(
struct dasd_block *);
64 static void dasd_flush_request_queue(
struct dasd_block *);
65 static int dasd_flush_block_queue(
struct dasd_block *);
66 static void dasd_device_tasklet(
struct dasd_device *);
67 static void dasd_block_tasklet(
struct dasd_block *);
69 static void do_restore_device(
struct work_struct *);
71 static void dasd_return_cqr_cb(
struct dasd_ccw_req *,
void *);
72 static void dasd_device_timeout(
unsigned long);
73 static void dasd_block_timeout(
unsigned long);
116 (
void (*)(
unsigned long)) dasd_device_tasklet,
117 (
unsigned long) device);
118 INIT_LIST_HEAD(&device->ccw_queue);
120 device->timer.function = dasd_device_timeout;
121 device->timer.data = (
unsigned long) device;
122 INIT_WORK(&device->kick_work, do_kick_device);
123 INIT_WORK(&device->restore_device, do_restore_device);
124 INIT_WORK(&device->reload_device, do_reload_device);
159 (
void (*)(
unsigned long)) dasd_block_tasklet,
160 (
unsigned long) block);
161 INIT_LIST_HEAD(&block->ccw_queue);
164 block->timer.function = dasd_block_timeout;
165 block->timer.data = (
unsigned long) block;
190 dasd_get_device(device);
193 rc = dasd_alloc_queue(device->
block);
195 dasd_put_device(device);
206 static int dasd_state_known_to_new(
struct dasd_device *device)
223 dasd_free_queue(device->
block);
226 dasd_put_device(device);
230 static struct dentry *dasd_debugfs_setup(
const char *
name,
231 struct dentry *base_dentry)
238 if (!pde || IS_ERR(pde))
246 static int dasd_state_known_to_basic(
struct dasd_device *device)
257 dasd_debugfs_setup(block->
gdp->disk_name,
258 dasd_debugfs_root_entry);
264 dasd_debugfs_setup(dev_name(&device->
cdev->dev),
265 dasd_debugfs_root_entry);
282 static int dasd_state_basic_to_known(
struct dasd_device *device)
286 dasd_profile_exit(&device->
block->profile);
287 if (device->
block->debugfs_dentry)
296 dasd_profile_exit(&device->
profile);
323 static int dasd_state_basic_to_ready(
struct dasd_device *device)
329 block = device->
block;
332 if (block->
base->discipline->do_analysis !=
NULL)
333 rc = block->
base->discipline->do_analysis(block);
339 dasd_setup_queue(block);
340 set_capacity(block->
gdp,
357 static int dasd_state_ready_to_basic(
struct dasd_device *device)
364 rc = dasd_flush_block_queue(block);
369 dasd_flush_request_queue(block);
381 static int dasd_state_unfmt_to_basic(
struct dasd_device *device)
393 dasd_state_ready_to_online(
struct dasd_device * device)
396 struct gendisk *disk;
397 struct disk_part_iter piter;
398 struct hd_struct *
part;
401 rc = device->
discipline->ready_to_online(device);
409 disk = device->
block->gdp;
413 disk = device->
block->bdev->bd_disk;
425 static int dasd_state_online_to_ready(
struct dasd_device *device)
428 struct gendisk *disk;
429 struct disk_part_iter piter;
430 struct hd_struct *
part;
433 rc = device->
discipline->online_to_ready(device);
439 disk = device->
block->bdev->bd_disk;
451 static int dasd_increase_state(
struct dasd_device *device)
458 rc = dasd_state_new_to_known(device);
463 rc = dasd_state_known_to_basic(device);
468 rc = dasd_state_basic_to_ready(device);
478 rc = dasd_state_ready_to_online(device);
486 static int dasd_decrease_state(
struct dasd_device *device)
493 rc = dasd_state_online_to_ready(device);
498 rc = dasd_state_ready_to_basic(device);
503 rc = dasd_state_unfmt_to_basic(device);
508 rc = dasd_state_basic_to_known(device);
513 rc = dasd_state_known_to_new(device);
521 static void dasd_change_state(
struct dasd_device *device)
529 rc = dasd_increase_state(device);
531 rc = dasd_decrease_state(device);
554 dasd_change_state(device);
557 dasd_put_device(device);
562 dasd_get_device(device);
576 dasd_put_device(device);
581 dasd_get_device(device);
591 static void do_restore_device(
struct work_struct *work)
595 device->
cdev->drv->restore(device->
cdev);
596 dasd_put_device(device);
601 dasd_get_device(device);
611 dasd_get_device(device);
616 if (device->
target != target) {
617 if (device->
state == target)
622 dasd_change_state(device);
624 dasd_put_device(device);
630 static inline int _wait_for_device(
struct dasd_device *device)
642 wait_event(dasd_init_waitq, _wait_for_device(device));
655 #ifdef CONFIG_DASD_PROFILE
657 static struct dentry *dasd_global_profile_dentry;
658 static struct dentry *dasd_debugfs_global_entry;
673 if (dasd_global_profile_level || block->
profile.data)
678 if (dasd_global_profile_level) {
680 if (rq_data_dir(req) ==
READ)
684 spin_lock(&block->
profile.lock);
687 if (rq_data_dir(req) ==
READ)
689 spin_unlock(&block->
profile.lock);
703 spin_lock(&device->
profile.lock);
706 if (rq_data_dir(req) ==
READ)
709 spin_unlock(&device->
profile.lock);
716 #define dasd_profile_counter(value, index) \
718 for (index = 0; index < 31 && value >> (2+index); index++) \
737 memset(data, 0,
sizeof(*data));
774 long strtime, irqtime, endtime, tottime;
777 int sectors_ind, tottime_ind, tottimeps_ind, strtime_ind;
778 int irqtime_ind, irqtimeps_ind, endtime_ind;
781 if (!(dasd_global_profile_level ||
786 sectors = blk_rq_sectors(req);
798 dasd_profile_counter(sectors, sectors_ind);
799 dasd_profile_counter(tottime, tottime_ind);
800 dasd_profile_counter(tottimeps, tottimeps_ind);
801 dasd_profile_counter(strtime, strtime_ind);
802 dasd_profile_counter(irqtime, irqtime_ind);
803 dasd_profile_counter(irqtime / sectors, irqtimeps_ind);
804 dasd_profile_counter(endtime, endtime_ind);
806 if (dasd_global_profile_level) {
807 dasd_profile_end_add_data(&dasd_global_profile_data,
810 rq_data_dir(req) ==
READ,
811 sectors, sectors_ind, tottime_ind,
812 tottimeps_ind, strtime_ind,
813 irqtime_ind, irqtimeps_ind,
817 spin_lock(&block->
profile.lock);
819 dasd_profile_end_add_data(block->
profile.data,
822 rq_data_dir(req) ==
READ,
823 sectors, sectors_ind, tottime_ind,
824 tottimeps_ind, strtime_ind,
825 irqtime_ind, irqtimeps_ind,
827 spin_unlock(&block->
profile.lock);
829 spin_lock(&device->
profile.lock);
831 dasd_profile_end_add_data(device->
profile.data,
834 rq_data_dir(req) ==
READ,
835 sectors, sectors_ind, tottime_ind,
836 tottimeps_ind, strtime_ind,
837 irqtime_ind, irqtimeps_ind,
839 spin_unlock(&device->
profile.lock);
846 spin_lock_bh(&profile->
lock);
847 data = profile->
data;
849 spin_unlock_bh(&profile->
lock);
852 memset(data, 0,
sizeof(*data));
854 spin_unlock_bh(&profile->
lock);
859 memset(&dasd_global_profile_data, 0,
sizeof(dasd_global_profile_data));
870 spin_lock_bh(&profile->
lock);
872 spin_unlock_bh(&profile->
lock);
878 spin_unlock_bh(&profile->
lock);
884 spin_lock_bh(&profile->
lock);
887 spin_unlock_bh(&profile->
lock);
894 buffer =
vmalloc(user_len + 1);
902 if (buffer[user_len - 1] ==
'\n')
903 buffer[user_len - 1] = 0;
905 buffer[user_len] = 0;
910 const char __user *user_buf,
911 size_t user_len, loff_t *
pos)
918 if (user_len > 65536)
922 return PTR_ERR(buffer);
926 if (
strncmp(str,
"reset", 5) == 0) {
928 }
else if (
strncmp(str,
"on", 2) == 0) {
932 }
else if (
strncmp(str,
"off", 3) == 0) {
940 static void dasd_stats_array(
struct seq_file *m,
unsigned int *array)
944 for (i = 0; i < 32; i++)
949 static void dasd_stats_seq_print(
struct seq_file *m,
962 seq_printf(m,
"histogram_io_times_weighted ");
964 seq_printf(m,
"histogram_time_build_to_ssch ");
968 seq_printf(m,
"histogram_time_ssch_to_irq_weighted ");
982 seq_printf(m,
"histogram_read_time_build_to_ssch ");
984 seq_printf(m,
"histogram_read_time_ssch_to_irq ");
986 seq_printf(m,
"histogram_read_time_irq_to_end ");
988 seq_printf(m,
"histogram_read_ccw_queue_length ");
992 static int dasd_stats_show(
struct seq_file *m,
void *
v)
998 spin_lock_bh(&profile->
lock);
999 data = profile->
data;
1001 spin_unlock_bh(&profile->
lock);
1005 dasd_stats_seq_print(m, data);
1006 spin_unlock_bh(&profile->
lock);
1010 static int dasd_stats_open(
struct inode *
inode,
struct file *file)
1013 return single_open(file, dasd_stats_show, profile);
1018 .open = dasd_stats_open,
1022 .write = dasd_stats_write,
1025 static ssize_t dasd_stats_global_write(
struct file *file,
1026 const char __user *user_buf,
1027 size_t user_len, loff_t *pos)
1032 if (user_len > 65536)
1036 return PTR_ERR(buffer);
1039 if (
strncmp(str,
"reset", 5) == 0) {
1041 }
else if (
strncmp(str,
"on", 2) == 0) {
1044 }
else if (
strncmp(str,
"off", 3) == 0) {
1052 static int dasd_stats_global_show(
struct seq_file *m,
void *v)
1054 if (!dasd_global_profile_level) {
1058 dasd_stats_seq_print(m, &dasd_global_profile_data);
1062 static int dasd_stats_global_open(
struct inode *
inode,
struct file *file)
1069 .open = dasd_stats_global_open,
1073 .write = dasd_stats_global_write,
1076 static void dasd_profile_init(
struct dasd_profile *profile,
1077 struct dentry *base_dentry)
1088 profile, &dasd_stats_raw_fops);
1089 if (pde && !IS_ERR(pde))
1094 static void dasd_profile_exit(
struct dasd_profile *profile)
1103 static void dasd_statistics_removeroot(
void)
1106 if (dasd_global_profile_dentry) {
1108 dasd_global_profile_dentry =
NULL;
1110 if (dasd_debugfs_global_entry)
1112 if (dasd_debugfs_root_entry)
1116 static void dasd_statistics_createroot(
void)
1121 dasd_debugfs_root_entry =
NULL;
1122 dasd_debugfs_global_entry =
NULL;
1123 dasd_global_profile_dentry =
NULL;
1125 if (!pde || IS_ERR(pde))
1127 dasd_debugfs_root_entry = pde;
1129 if (!pde || IS_ERR(pde))
1131 dasd_debugfs_global_entry = pde;
1135 NULL, &dasd_stats_global_fops);
1136 if (!pde || IS_ERR(pde))
1138 dasd_global_profile_dentry = pde;
1143 "Creation of the dasd debugfs interface failed");
1144 dasd_statistics_removeroot();
1149 #define dasd_profile_start(block, cqr, req) do {} while (0)
1150 #define dasd_profile_end(block, cqr, req) do {} while (0)
1152 static void dasd_statistics_createroot(
void)
1157 static void dasd_statistics_removeroot(
void)
1164 seq_printf(m,
"Statistics are not activated in this kernel\n");
1168 static void dasd_profile_init(
struct dasd_profile *profile,
1169 struct dentry *base_dentry)
1174 static void dasd_profile_exit(
struct dasd_profile *profile)
1208 cqr->
cpaddr = kcalloc(cplength,
sizeof(
struct ccw1),
1226 dasd_get_device(device);
1234 unsigned long flags;
1241 size += cplength *
sizeof(
struct ccw1);
1247 spin_unlock_irqrestore(&device->
mem_lock, flags);
1251 data = (
char *) cqr + ((
sizeof(
struct dasd_ccw_req) + 7L) & -8L);
1255 data += cplength*
sizeof(
struct ccw1);
1265 dasd_get_device(device);
1282 clear_normalized_cda(ccw);
1288 dasd_put_device(device);
1293 unsigned long flags;
1297 spin_unlock_irqrestore(&device->
mem_lock, flags);
1298 dasd_put_device(device);
1304 static inline int dasd_check_cqr(
struct dasd_ccw_req *cqr)
1313 " dasd_ccw_req 0x%08x magic doesn't match"
1314 " discipline 0x%08x",
1335 rc = dasd_check_cqr(cqr);
1348 "terminate cqr %p successful",
1353 "device gone, retry");
1357 "I/O error, retry");
1362 "device busy, retry later");
1367 dev_err(&device->
cdev->dev,
"An error occurred in the "
1368 "DASD device driver, reason=%s\n", errorstring);
1389 rc = dasd_check_cqr(cqr);
1400 "because of stolen lock", cqr);
1407 sprintf(errorstring,
"14 %p", cqr);
1408 dev_err(&device->
cdev->dev,
"An error occurred in the DASD "
1409 "device driver, reason=%s\n", errorstring);
1423 (
long) cqr, cqr->
lpm);
1426 (
long) cqr, cqr->
lpm, 0);
1434 "start_IO: device busy, retry later");
1438 "start_IO: request timeout, retry later");
1450 "start_IO: selected paths gone (%x)",
1455 "start_IO: selected paths gone,"
1456 " retry on all paths");
1459 "start_IO: all paths in opm gone,"
1460 " do path verification");
1471 "start_IO: -ENODEV device gone, retry");
1475 "start_IO: -EIO device gone, retry");
1480 "start_IO: -EINVAL device currently "
1487 "An error occurred in the DASD device driver, "
1488 "reason=%s\n", errorstring);
1504 static void dasd_device_timeout(
unsigned long ptr)
1506 unsigned long flags;
1547 "invalid status in handle_killed_request: "
1553 if (IS_ERR(device)) {
1555 "unable to get device from cdev");
1562 (
char *) &cqr->
magic, 4)) {
1564 "invalid device in request");
1565 dasd_put_device(device);
1574 dasd_put_device(device);
1596 unsigned long long now;
1600 switch (PTR_ERR(irb)) {
1605 "request timed out\n", __func__);
1609 "unknown error %ld\n", __func__,
1612 dasd_handle_killed_request(cdev, intparm);
1621 scsw_cstat(&irb->
scsw) == 0)) {
1628 if (device->
discipline == dasd_diag_discipline_pointer) {
1629 dasd_put_device(device);
1632 device->
discipline->dump_sense_dbf(device, irb,
"int");
1634 device->
discipline->dump_sense(device, cqr, irb);
1635 device->
discipline->check_for_device_change(device, cqr, irb);
1636 dasd_put_device(device);
1645 "invalid device in request");
1662 "status %02x", dev_name(&cdev->
dev), cqr->
status);
1669 scsw_cstat(&irb->
scsw) == 0) {
1687 "default ERP in fastpath "
1688 "(%i retries left)",
1719 !device->
discipline->check_for_device_change){
1720 dasd_put_device(device);
1724 device->
discipline->dump_sense_dbf(device, irb,
"uc");
1726 dasd_put_device(device);
1736 static void __dasd_device_recovery(
struct dasd_device *device,
1745 if (!ref_cqr->
block)
1761 static void __dasd_device_process_ccw_queue(
struct dasd_device *device,
1777 __dasd_device_recovery(device, cqr);
1780 list_move_tail(&cqr->
devlist, final_queue);
1788 static void __dasd_device_process_final_queue(
struct dasd_device *device,
1820 "An error occurred in the DASD device driver, "
1821 "reason=%s\n", errorstring);
1835 static void __dasd_device_check_expire(
struct dasd_device *device)
1847 "cqr %p timed out (%lus) but cannot be "
1848 "ended, retrying in 5 s\n",
1854 "cqr %p timed out (%lus), %i retries "
1865 static void __dasd_device_start_head(
struct dasd_device *device)
1891 else if (rc == -
EACCES) {
1898 static void __dasd_device_check_path_events(
struct dasd_device *device)
1931 INIT_LIST_HEAD(&flush_queue);
1942 "Flushing the DASD request queue "
1943 "failed for request %p\n", cqr);
1955 list_move_tail(&cqr->
devlist, &flush_queue);
1971 __dasd_device_process_final_queue(device, &flush_queue);
1978 static void dasd_device_tasklet(
struct dasd_device *device)
1983 INIT_LIST_HEAD(&final_queue);
1986 __dasd_device_check_expire(device);
1988 __dasd_device_process_ccw_queue(device, &final_queue);
1989 __dasd_device_check_path_events(device);
1992 __dasd_device_process_final_queue(device, &final_queue);
1995 __dasd_device_start_head(device);
1997 if (waitqueue_active(&shutdown_waitq))
1999 dasd_put_device(device);
2010 dasd_get_device(device);
2011 tasklet_hi_schedule(&device->
tasklet);
2035 unsigned long flags;
2053 unsigned long flags;
2076 static inline int _wait_for_wakeup(
struct dasd_ccw_req *cqr)
2091 static int __dasd_sleep_on_erp(
struct dasd_ccw_req *cqr)
2101 device->
discipline->handle_terminated_request(cqr);
2105 erp_fn = device->
discipline->erp_action(cqr);
2112 __dasd_process_erp(device, cqr);
2119 static int __dasd_sleep_on_loop_condition(
struct dasd_ccw_req *cqr)
2130 static int _dasd_sleep_on(
struct dasd_ccw_req *maincqr,
int interruptible)
2137 INIT_LIST_HEAD(&ccw_queue);
2140 list_add(&maincqr->
blocklist, &ccw_queue);
2141 for (cqr = maincqr; __dasd_sleep_on_loop_condition(cqr);
2145 if (__dasd_sleep_on_erp(cqr))
2164 if (interruptible) {
2166 generic_waitq, !(device->
stopped));
2180 if (interruptible) {
2182 generic_waitq, _wait_for_wakeup(cqr));
2187 _wait_for_wakeup(cqr));
2193 wait_event(generic_waitq, _wait_for_wakeup(cqr));
2202 else if (maincqr->
intrc)
2203 rc = maincqr->
intrc;
2215 return _dasd_sleep_on(cqr, 0);
2224 return _dasd_sleep_on(cqr, 1);
2233 static inline int _dasd_term_running_cqr(
struct dasd_device *device)
2265 rc = _dasd_term_running_cqr(device);
2284 wait_event(generic_waitq, _wait_for_wakeup(cqr));
2288 else if (cqr->
intrc)
2308 unsigned long flags;
2323 "Cancelling request %p failed with rc=%d\n",
2347 static void dasd_block_timeout(
unsigned long ptr)
2349 unsigned long flags;
2382 static void __dasd_process_erp(
struct dasd_device *device,
2390 dev_err(&device->
cdev->dev,
"ERP failed for the DASD\n");
2391 erp_fn = device->
discipline->erp_postaction(cqr);
2398 static void __dasd_process_request_queue(
struct dasd_block *block)
2404 unsigned long flags;
2406 basedev = block->
base;
2426 rq_data_dir(req) ==
WRITE) {
2428 "Rejecting write request %p",
2434 cqr = basedev->
discipline->build_cp(basedev, block, req);
2436 if (PTR_ERR(cqr) == -
EBUSY)
2438 if (PTR_ERR(cqr) == -
ENOMEM)
2440 if (PTR_ERR(cqr) == -
EAGAIN) {
2453 spin_unlock_irqrestore(
2459 "CCW creation failed (rc=%ld) "
2478 static void __dasd_cleanup_cqr(
struct dasd_ccw_req *cqr)
2486 status = cqr->
block->base->discipline->free_cp(cqr, req);
2488 error = status ? status : -
EIO;
2495 static void __dasd_process_block_ccw_queue(
struct dasd_block *block,
2501 unsigned long flags;
2515 base->
discipline->handle_terminated_request(cqr);
2522 if (IS_ERR(erp_fn(cqr)))
2549 __dasd_process_erp(base, cqr);
2555 list_move_tail(&cqr->
blocklist, final_queue);
2559 static void dasd_return_cqr_cb(
struct dasd_ccw_req *cqr,
void *data)
2564 static void __dasd_block_start_head(
struct dasd_block *block)
2593 if (block->
base->stopped)
2601 cqr->
callback = dasd_return_cqr_cb;
2612 static void dasd_block_tasklet(
struct dasd_block *block)
2619 INIT_LIST_HEAD(&final_queue);
2622 __dasd_process_block_ccw_queue(block, &final_queue);
2629 __dasd_cleanup_cqr(cqr);
2633 __dasd_process_request_queue(block);
2635 __dasd_block_start_head(block);
2638 if (waitqueue_active(&shutdown_waitq))
2640 dasd_put_device(block->
base);
2643 static void _dasd_wake_block_flush_cb(
struct dasd_ccw_req *cqr,
void *data)
2653 static int dasd_flush_block_queue(
struct dasd_block *block)
2674 cqr->
callback = _dasd_wake_block_flush_cb;
2675 for (i = 0; cqr !=
NULL; cqr = cqr->
refers, i++)
2689 __dasd_process_erp(block->
base, cqr);
2699 __dasd_cleanup_cqr(cqr);
2714 dasd_get_device(block->
base);
2715 tasklet_hi_schedule(&block->
tasklet);
2731 block = queue->queuedata;
2734 __dasd_process_request_queue(block);
2736 __dasd_block_start_head(block);
2743 static int dasd_alloc_queue(
struct dasd_block *block)
2767 static void dasd_setup_queue(
struct dasd_block *block)
2781 max = block->
base->discipline->max_blocks << block->
s2b_shift;
2797 static void dasd_free_queue(
struct dasd_block *block)
2808 static void dasd_flush_request_queue(
struct dasd_block *block)
2836 if (!try_module_get(base->
discipline->owner)) {
2843 "Accessing the DASD failed because it is in "
2844 "probeonly mode\n");
2851 " Cannot open unrecognized device");
2863 dasd_put_device(base);
2870 dasd_put_device(base);
2874 static int dasd_release(
struct gendisk *disk,
fmode_t mode)
2884 dasd_put_device(base);
2901 dasd_put_device(base);
2905 geo->
start = get_start_sect(bdev) >> base->
block->s2b_shift;
2906 dasd_put_device(base);
2910 const struct block_device_operations
2914 .release = dasd_release,
2917 .getgeo = dasd_getgeo,
2927 #ifdef CONFIG_PROC_FS
2937 if (dasd_debug_area !=
NULL) {
2939 dasd_debug_area =
NULL;
2941 dasd_statistics_removeroot();
2962 memset(&diag_data, 0,
sizeof(diag_data));
2964 diag_data.
vrdclen =
sizeof(diag_data);
2966 if (rc == 0 || rc == 2) {
2983 pr_warning(
"%s: Setting the DASD online failed with rc=%d\n",
2984 dev_name(&cdev->
dev), ret);
2999 "dasd_generic_probe: could not add "
3033 dasd_put_device(device);
3043 block = device->
block;
3069 return PTR_ERR(device);
3073 if (!dasd_diag_discipline_pointer) {
3074 pr_warning(
"%s Setting the DASD online failed because "
3075 "of missing DIAG discipline\n",
3076 dev_name(&cdev->
dev));
3082 if (!try_module_get(base_discipline->
owner)) {
3086 if (!try_module_get(discipline->
owner)) {
3087 module_put(base_discipline->
owner);
3097 pr_warning(
"%s Setting the DASD online with discipline %s "
3098 "failed with rc=%i\n",
3099 dev_name(&cdev->
dev), discipline->
name, rc);
3100 module_put(discipline->
owner);
3101 module_put(base_discipline->
owner);
3108 pr_warning(
"%s Setting the DASD online failed because of a "
3109 "missing discipline\n", dev_name(&cdev->
dev));
3116 pr_debug(
"dasd_generic device %s found\n",
3117 dev_name(&cdev->
dev));
3119 wait_event(dasd_init_waitq, _wait_for_device(device));
3121 dasd_put_device(device);
3133 return PTR_ERR(device);
3136 dasd_put_device(device);
3145 if (device->
block) {
3146 max_count = device->
block->bdev ? 0 : -1;
3148 if (open_count > max_count) {
3150 pr_warning(
"%s: The DASD cannot be set offline "
3151 "with open count %i\n",
3152 dev_name(&cdev->
dev), open_count);
3154 pr_warning(
"%s: The DASD cannot be set offline "
3155 "while it is in use\n",
3156 dev_name(&cdev->
dev));
3158 dasd_put_device(device);
3164 block = device->
block;
3179 dev_warn(&device->
cdev->dev,
"No operational channel path is left "
3180 "for the device\n");
3203 dev_info(&device->
cdev->dev,
"A channel path to the device has become "
3243 dasd_put_device(device);
3250 __u8 oldopm, eventlpm;
3256 for (chp = 0; chp < 8; chp++) {
3257 eventlpm = 0x80 >> chp;
3274 if (!(device->
path_data.opm & eventlpm) &&
3275 !(device->
path_data.tbvpm & eventlpm)) {
3285 "Pathgroup re-established\n");
3290 dasd_put_device(device);
3314 return PTR_ERR(device);
3325 INIT_LIST_HEAD(&freeze_queue);
3335 "Unable to terminate request %p "
3336 "on suspend\n", cqr);
3338 dasd_put_device(device);
3342 list_move_tail(&cqr->
devlist, &freeze_queue);
3355 list_splice_tail(&freeze_queue, &device->
ccw_queue);
3358 dasd_put_device(device);
3369 return PTR_ERR(device);
3394 dasd_put_device(device);
3401 int rdc_buffer_size,
3406 unsigned long *idaw;
3413 "An error occurred in the DASD device driver, "
3414 "reason=%s\n",
"13");
3420 if (idal_is_needed(rdc_buffer, rdc_buffer_size)) {
3421 idaw = (
unsigned long *) (cqr->
data);
3424 idaw = idal_create_words(idaw, rdc_buffer, rdc_buffer_size);
3430 ccw->
count = rdc_buffer_size;
3442 void *rdc_buffer,
int rdc_buffer_size)
3447 cqr = dasd_generic_build_rdc(device, rdc_buffer, rdc_buffer_size,
3450 return PTR_ERR(cqr);
3469 if (scsw_is_tm(&irb->
scsw) && (irb->
scsw.
tm.fcxs == 0x01)) {
3474 switch (tsb->
flags & 0x07) {
3476 sense = tsb->tsa.
iostat.sense;
3479 sense = tsb->tsa.
ddpc.sense;
3485 }
else if (irb->
esw.
esw0.erw.cons) {
3492 static inline int _wait_for_empty_queues(
struct dasd_device *device)
3495 return list_empty(&device->
ccw_queue) &&
3496 list_empty(&device->
block->ccw_queue);
3514 wait_event(shutdown_waitq, _wait_for_empty_queues(device));
3518 static int __init dasd_init(
void)
3528 dasd_debug_area =
debug_register(
"dasd", 1, 1, 8 *
sizeof(
long));
3529 if (dasd_debug_area ==
NULL) {
3538 dasd_diag_discipline_pointer =
NULL;
3540 dasd_statistics_createroot();
3554 #ifdef CONFIG_PROC_FS
3562 pr_info(
"The DASD device driver could not be initialized\n");