[SCSI] zfcp: Rename sysfs_device attribute to dev in zfcp_unit and zfcp_port
[linux-2.6.git] / drivers / s390 / scsi / zfcp_sysfs.c
1 /*
2  * zfcp device driver
3  *
4  * sysfs attributes.
5  *
6  * Copyright IBM Corporation 2008, 2010
7  */
8
9 #define KMSG_COMPONENT "zfcp"
10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
11
12 #include "zfcp_ext.h"
13
14 #define ZFCP_DEV_ATTR(_feat, _name, _mode, _show, _store) \
15 struct device_attribute dev_attr_##_feat##_##_name = __ATTR(_name, _mode,\
16                                                             _show, _store)
17 #define ZFCP_DEFINE_ATTR(_feat_def, _feat, _name, _format, _value)             \
18 static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev,         \
19                                                    struct device_attribute *at,\
20                                                    char *buf)                  \
21 {                                                                              \
22         struct _feat_def *_feat = container_of(dev, struct _feat_def, dev);    \
23                                                                                \
24         return sprintf(buf, _format, _value);                                  \
25 }                                                                              \
26 static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO,                                    \
27                      zfcp_sysfs_##_feat##_##_name##_show, NULL);
28
29 #define ZFCP_DEFINE_A_ATTR(_name, _format, _value)                           \
30 static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev,         \
31                                                  struct device_attribute *at,\
32                                                  char *buf)                  \
33 {                                                                            \
34         struct ccw_device *cdev = to_ccwdev(dev);                            \
35         struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);       \
36         int i;                                                               \
37                                                                              \
38         if (!adapter)                                                        \
39                 return -ENODEV;                                              \
40                                                                              \
41         i = sprintf(buf, _format, _value);                                   \
42         zfcp_ccw_adapter_put(adapter);                                       \
43         return i;                                                            \
44 }                                                                            \
45 static ZFCP_DEV_ATTR(adapter, _name, S_IRUGO,                                \
46                      zfcp_sysfs_adapter_##_name##_show, NULL);
47
48 ZFCP_DEFINE_A_ATTR(status, "0x%08x\n", atomic_read(&adapter->status));
49 ZFCP_DEFINE_A_ATTR(peer_wwnn, "0x%016llx\n",
50                    (unsigned long long) adapter->peer_wwnn);
51 ZFCP_DEFINE_A_ATTR(peer_wwpn, "0x%016llx\n",
52                    (unsigned long long) adapter->peer_wwpn);
53 ZFCP_DEFINE_A_ATTR(peer_d_id, "0x%06x\n", adapter->peer_d_id);
54 ZFCP_DEFINE_A_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
55 ZFCP_DEFINE_A_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
56 ZFCP_DEFINE_A_ATTR(hardware_version, "0x%08x\n", adapter->hardware_version);
57 ZFCP_DEFINE_A_ATTR(in_recovery, "%d\n", (atomic_read(&adapter->status) &
58                                          ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
59
60 ZFCP_DEFINE_ATTR(zfcp_port, port, status, "0x%08x\n",
61                  atomic_read(&port->status));
62 ZFCP_DEFINE_ATTR(zfcp_port, port, in_recovery, "%d\n",
63                  (atomic_read(&port->status) &
64                   ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
65 ZFCP_DEFINE_ATTR(zfcp_port, port, access_denied, "%d\n",
66                  (atomic_read(&port->status) &
67                   ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
68
69 ZFCP_DEFINE_ATTR(zfcp_unit, unit, status, "0x%08x\n",
70                  atomic_read(&unit->status));
71 ZFCP_DEFINE_ATTR(zfcp_unit, unit, in_recovery, "%d\n",
72                  (atomic_read(&unit->status) &
73                   ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
74 ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_denied, "%d\n",
75                  (atomic_read(&unit->status) &
76                   ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
77 ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_shared, "%d\n",
78                  (atomic_read(&unit->status) &
79                   ZFCP_STATUS_UNIT_SHARED) != 0);
80 ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_readonly, "%d\n",
81                  (atomic_read(&unit->status) &
82                   ZFCP_STATUS_UNIT_READONLY) != 0);
83
84 #define ZFCP_SYSFS_FAILED(_feat_def, _feat, _adapter, _mod_id, _reopen_id)     \
85 static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev,            \
86                                                 struct device_attribute *attr, \
87                                                 char *buf)                     \
88 {                                                                              \
89         struct _feat_def *_feat = container_of(dev, struct _feat_def, dev);    \
90                                                                                \
91         if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED)       \
92                 return sprintf(buf, "1\n");                                    \
93         else                                                                   \
94                 return sprintf(buf, "0\n");                                    \
95 }                                                                              \
96 static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev,           \
97                                                  struct device_attribute *attr,\
98                                                  const char *buf, size_t count)\
99 {                                                                              \
100         struct _feat_def *_feat = container_of(dev, struct _feat_def, dev);    \
101         unsigned long val;                                                     \
102         int retval = 0;                                                        \
103                                                                                \
104         if (!(_feat && get_device(&_feat->dev)))                               \
105                 return -EBUSY;                                                 \
106                                                                                \
107         if (strict_strtoul(buf, 0, &val) || val != 0) {                        \
108                 retval = -EINVAL;                                              \
109                 goto out;                                                      \
110         }                                                                      \
111                                                                                \
112         zfcp_erp_modify_##_feat##_status(_feat, _mod_id, NULL,                 \
113                                          ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);\
114         zfcp_erp_##_feat##_reopen(_feat, ZFCP_STATUS_COMMON_ERP_FAILED,        \
115                                   _reopen_id, NULL);                           \
116         zfcp_erp_wait(_adapter);                                               \
117 out:                                                                           \
118         put_device(&_feat->dev);                                               \
119         return retval ? retval : (ssize_t) count;                              \
120 }                                                                              \
121 static ZFCP_DEV_ATTR(_feat, failed, S_IWUSR | S_IRUGO,                         \
122                      zfcp_sysfs_##_feat##_failed_show,                         \
123                      zfcp_sysfs_##_feat##_failed_store);
124
125 ZFCP_SYSFS_FAILED(zfcp_port, port, port->adapter, "sypfai1", "sypfai2");
126 ZFCP_SYSFS_FAILED(zfcp_unit, unit, unit->port->adapter, "syufai1", "syufai2");
127
128 static ssize_t zfcp_sysfs_adapter_failed_show(struct device *dev,
129                                               struct device_attribute *attr,
130                                               char *buf)
131 {
132         struct ccw_device *cdev = to_ccwdev(dev);
133         struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
134         int i;
135
136         if (!adapter)
137                 return -ENODEV;
138
139         if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
140                 i = sprintf(buf, "1\n");
141         else
142                 i = sprintf(buf, "0\n");
143
144         zfcp_ccw_adapter_put(adapter);
145         return i;
146 }
147
148 static ssize_t zfcp_sysfs_adapter_failed_store(struct device *dev,
149                                                struct device_attribute *attr,
150                                                const char *buf, size_t count)
151 {
152         struct ccw_device *cdev = to_ccwdev(dev);
153         struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
154         unsigned long val;
155         int retval = 0;
156
157         if (!adapter)
158                 return -ENODEV;
159
160         if (strict_strtoul(buf, 0, &val) || val != 0) {
161                 retval = -EINVAL;
162                 goto out;
163         }
164
165         zfcp_erp_modify_adapter_status(adapter, "syafai1", NULL,
166                                        ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
167         zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
168                                 "syafai2", NULL);
169         zfcp_erp_wait(adapter);
170 out:
171         zfcp_ccw_adapter_put(adapter);
172         return retval ? retval : (ssize_t) count;
173 }
174 static ZFCP_DEV_ATTR(adapter, failed, S_IWUSR | S_IRUGO,
175                      zfcp_sysfs_adapter_failed_show,
176                      zfcp_sysfs_adapter_failed_store);
177
178 static ssize_t zfcp_sysfs_port_rescan_store(struct device *dev,
179                                             struct device_attribute *attr,
180                                             const char *buf, size_t count)
181 {
182         struct ccw_device *cdev = to_ccwdev(dev);
183         struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
184
185         if (!adapter)
186                 return -ENODEV;
187
188         /* sync the user-space- with the kernel-invocation of scan_work */
189         queue_work(adapter->work_queue, &adapter->scan_work);
190         flush_work(&adapter->scan_work);
191         zfcp_ccw_adapter_put(adapter);
192
193         return (ssize_t) count;
194 }
195 static ZFCP_DEV_ATTR(adapter, port_rescan, S_IWUSR, NULL,
196                      zfcp_sysfs_port_rescan_store);
197
198 static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
199                                             struct device_attribute *attr,
200                                             const char *buf, size_t count)
201 {
202         struct ccw_device *cdev = to_ccwdev(dev);
203         struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
204         struct zfcp_port *port;
205         u64 wwpn;
206         int retval = -EINVAL;
207
208         if (!adapter)
209                 return -ENODEV;
210
211         if (strict_strtoull(buf, 0, (unsigned long long *) &wwpn))
212                 goto out;
213
214         port = zfcp_get_port_by_wwpn(adapter, wwpn);
215         if (!port)
216                 goto out;
217         else
218                 retval = 0;
219
220         write_lock_irq(&adapter->port_list_lock);
221         list_del(&port->list);
222         write_unlock_irq(&adapter->port_list_lock);
223
224         put_device(&port->dev);
225
226         zfcp_erp_port_shutdown(port, 0, "syprs_1", NULL);
227         zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
228  out:
229         zfcp_ccw_adapter_put(adapter);
230         return retval ? retval : (ssize_t) count;
231 }
232 static ZFCP_DEV_ATTR(adapter, port_remove, S_IWUSR, NULL,
233                      zfcp_sysfs_port_remove_store);
234
235 static struct attribute *zfcp_adapter_attrs[] = {
236         &dev_attr_adapter_failed.attr,
237         &dev_attr_adapter_in_recovery.attr,
238         &dev_attr_adapter_port_remove.attr,
239         &dev_attr_adapter_port_rescan.attr,
240         &dev_attr_adapter_peer_wwnn.attr,
241         &dev_attr_adapter_peer_wwpn.attr,
242         &dev_attr_adapter_peer_d_id.attr,
243         &dev_attr_adapter_card_version.attr,
244         &dev_attr_adapter_lic_version.attr,
245         &dev_attr_adapter_status.attr,
246         &dev_attr_adapter_hardware_version.attr,
247         NULL
248 };
249
250 struct attribute_group zfcp_sysfs_adapter_attrs = {
251         .attrs = zfcp_adapter_attrs,
252 };
253
254 static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
255                                          struct device_attribute *attr,
256                                          const char *buf, size_t count)
257 {
258         struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
259         struct zfcp_unit *unit;
260         u64 fcp_lun;
261         int retval = -EINVAL;
262
263         if (!(port && get_device(&port->dev)))
264                 return -EBUSY;
265
266         if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
267                 goto out;
268
269         unit = zfcp_unit_enqueue(port, fcp_lun);
270         if (IS_ERR(unit))
271                 goto out;
272         else
273                 retval = 0;
274
275         zfcp_erp_unit_reopen(unit, 0, "syuas_1", NULL);
276         zfcp_erp_wait(unit->port->adapter);
277         flush_work(&unit->scsi_work);
278 out:
279         put_device(&port->dev);
280         return retval ? retval : (ssize_t) count;
281 }
282 static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store);
283
284 static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
285                                             struct device_attribute *attr,
286                                             const char *buf, size_t count)
287 {
288         struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
289         struct zfcp_unit *unit;
290         u64 fcp_lun;
291         int retval = -EINVAL;
292
293         if (!(port && get_device(&port->dev)))
294                 return -EBUSY;
295
296         if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
297                 goto out;
298
299         unit = zfcp_get_unit_by_lun(port, fcp_lun);
300         if (!unit)
301                 goto out;
302         else
303                 retval = 0;
304
305         /* wait for possible timeout during SCSI probe */
306         flush_work(&unit->scsi_work);
307
308         write_lock_irq(&port->unit_list_lock);
309         list_del(&unit->list);
310         write_unlock_irq(&port->unit_list_lock);
311
312         put_device(&unit->dev);
313
314         zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL);
315         zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
316 out:
317         put_device(&port->dev);
318         return retval ? retval : (ssize_t) count;
319 }
320 static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store);
321
322 static struct attribute *zfcp_port_attrs[] = {
323         &dev_attr_unit_add.attr,
324         &dev_attr_unit_remove.attr,
325         &dev_attr_port_failed.attr,
326         &dev_attr_port_in_recovery.attr,
327         &dev_attr_port_status.attr,
328         &dev_attr_port_access_denied.attr,
329         NULL
330 };
331
332 /**
333  * zfcp_sysfs_port_attrs - sysfs attributes for all other ports
334  */
335 struct attribute_group zfcp_sysfs_port_attrs = {
336         .attrs = zfcp_port_attrs,
337 };
338
339 static struct attribute *zfcp_unit_attrs[] = {
340         &dev_attr_unit_failed.attr,
341         &dev_attr_unit_in_recovery.attr,
342         &dev_attr_unit_status.attr,
343         &dev_attr_unit_access_denied.attr,
344         &dev_attr_unit_access_shared.attr,
345         &dev_attr_unit_access_readonly.attr,
346         NULL
347 };
348
349 struct attribute_group zfcp_sysfs_unit_attrs = {
350         .attrs = zfcp_unit_attrs,
351 };
352
353 #define ZFCP_DEFINE_LATENCY_ATTR(_name)                                 \
354 static ssize_t                                                          \
355 zfcp_sysfs_unit_##_name##_latency_show(struct device *dev,              \
356                                        struct device_attribute *attr,   \
357                                        char *buf) {                     \
358         struct scsi_device *sdev = to_scsi_device(dev);                 \
359         struct zfcp_unit *unit = sdev->hostdata;                        \
360         struct zfcp_latencies *lat = &unit->latencies;                  \
361         struct zfcp_adapter *adapter = unit->port->adapter;             \
362         unsigned long long fsum, fmin, fmax, csum, cmin, cmax, cc;      \
363                                                                         \
364         spin_lock_bh(&lat->lock);                                       \
365         fsum = lat->_name.fabric.sum * adapter->timer_ticks;            \
366         fmin = lat->_name.fabric.min * adapter->timer_ticks;            \
367         fmax = lat->_name.fabric.max * adapter->timer_ticks;            \
368         csum = lat->_name.channel.sum * adapter->timer_ticks;           \
369         cmin = lat->_name.channel.min * adapter->timer_ticks;           \
370         cmax = lat->_name.channel.max * adapter->timer_ticks;           \
371         cc  = lat->_name.counter;                                       \
372         spin_unlock_bh(&lat->lock);                                     \
373                                                                         \
374         do_div(fsum, 1000);                                             \
375         do_div(fmin, 1000);                                             \
376         do_div(fmax, 1000);                                             \
377         do_div(csum, 1000);                                             \
378         do_div(cmin, 1000);                                             \
379         do_div(cmax, 1000);                                             \
380                                                                         \
381         return sprintf(buf, "%llu %llu %llu %llu %llu %llu %llu\n",     \
382                        fmin, fmax, fsum, cmin, cmax, csum, cc);         \
383 }                                                                       \
384 static ssize_t                                                          \
385 zfcp_sysfs_unit_##_name##_latency_store(struct device *dev,             \
386                                         struct device_attribute *attr,  \
387                                         const char *buf, size_t count)  \
388 {                                                                       \
389         struct scsi_device *sdev = to_scsi_device(dev);                 \
390         struct zfcp_unit *unit = sdev->hostdata;                        \
391         struct zfcp_latencies *lat = &unit->latencies;                  \
392         unsigned long flags;                                            \
393                                                                         \
394         spin_lock_irqsave(&lat->lock, flags);                           \
395         lat->_name.fabric.sum = 0;                                      \
396         lat->_name.fabric.min = 0xFFFFFFFF;                             \
397         lat->_name.fabric.max = 0;                                      \
398         lat->_name.channel.sum = 0;                                     \
399         lat->_name.channel.min = 0xFFFFFFFF;                            \
400         lat->_name.channel.max = 0;                                     \
401         lat->_name.counter = 0;                                         \
402         spin_unlock_irqrestore(&lat->lock, flags);                      \
403                                                                         \
404         return (ssize_t) count;                                         \
405 }                                                                       \
406 static DEVICE_ATTR(_name##_latency, S_IWUSR | S_IRUGO,                  \
407                    zfcp_sysfs_unit_##_name##_latency_show,              \
408                    zfcp_sysfs_unit_##_name##_latency_store);
409
410 ZFCP_DEFINE_LATENCY_ATTR(read);
411 ZFCP_DEFINE_LATENCY_ATTR(write);
412 ZFCP_DEFINE_LATENCY_ATTR(cmd);
413
414 #define ZFCP_DEFINE_SCSI_ATTR(_name, _format, _value)                   \
415 static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev,       \
416                                               struct device_attribute *attr,\
417                                               char *buf)                 \
418 {                                                                        \
419         struct scsi_device *sdev  = to_scsi_device(dev);                 \
420         struct zfcp_unit *unit = sdev->hostdata;                         \
421                                                                          \
422         return sprintf(buf, _format, _value);                            \
423 }                                                                        \
424 static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL);
425
426 ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n",
427                       dev_name(&unit->port->adapter->ccw_device->dev));
428 ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n",
429                       (unsigned long long) unit->port->wwpn);
430 ZFCP_DEFINE_SCSI_ATTR(fcp_lun, "0x%016llx\n",
431                       (unsigned long long) unit->fcp_lun);
432
433 struct device_attribute *zfcp_sysfs_sdev_attrs[] = {
434         &dev_attr_fcp_lun,
435         &dev_attr_wwpn,
436         &dev_attr_hba_id,
437         &dev_attr_read_latency,
438         &dev_attr_write_latency,
439         &dev_attr_cmd_latency,
440         NULL
441 };
442
443 static ssize_t zfcp_sysfs_adapter_util_show(struct device *dev,
444                                             struct device_attribute *attr,
445                                             char *buf)
446 {
447         struct Scsi_Host *scsi_host = dev_to_shost(dev);
448         struct fsf_qtcb_bottom_port *qtcb_port;
449         struct zfcp_adapter *adapter;
450         int retval;
451
452         adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
453         if (!(adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA))
454                 return -EOPNOTSUPP;
455
456         qtcb_port = kzalloc(sizeof(struct fsf_qtcb_bottom_port), GFP_KERNEL);
457         if (!qtcb_port)
458                 return -ENOMEM;
459
460         retval = zfcp_fsf_exchange_port_data_sync(adapter->qdio, qtcb_port);
461         if (!retval)
462                 retval = sprintf(buf, "%u %u %u\n", qtcb_port->cp_util,
463                                  qtcb_port->cb_util, qtcb_port->a_util);
464         kfree(qtcb_port);
465         return retval;
466 }
467 static DEVICE_ATTR(utilization, S_IRUGO, zfcp_sysfs_adapter_util_show, NULL);
468
469 static int zfcp_sysfs_adapter_ex_config(struct device *dev,
470                                         struct fsf_statistics_info *stat_inf)
471 {
472         struct Scsi_Host *scsi_host = dev_to_shost(dev);
473         struct fsf_qtcb_bottom_config *qtcb_config;
474         struct zfcp_adapter *adapter;
475         int retval;
476
477         adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
478         if (!(adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA))
479                 return -EOPNOTSUPP;
480
481         qtcb_config = kzalloc(sizeof(struct fsf_qtcb_bottom_config),
482                               GFP_KERNEL);
483         if (!qtcb_config)
484                 return -ENOMEM;
485
486         retval = zfcp_fsf_exchange_config_data_sync(adapter->qdio, qtcb_config);
487         if (!retval)
488                 *stat_inf = qtcb_config->stat_info;
489
490         kfree(qtcb_config);
491         return retval;
492 }
493
494 #define ZFCP_SHOST_ATTR(_name, _format, _arg...)                        \
495 static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev,    \
496                                                  struct device_attribute *attr,\
497                                                  char *buf)             \
498 {                                                                       \
499         struct fsf_statistics_info stat_info;                           \
500         int retval;                                                     \
501                                                                         \
502         retval = zfcp_sysfs_adapter_ex_config(dev, &stat_info);         \
503         if (retval)                                                     \
504                 return retval;                                          \
505                                                                         \
506         return sprintf(buf, _format, ## _arg);                          \
507 }                                                                       \
508 static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_adapter_##_name##_show, NULL);
509
510 ZFCP_SHOST_ATTR(requests, "%llu %llu %llu\n",
511                 (unsigned long long) stat_info.input_req,
512                 (unsigned long long) stat_info.output_req,
513                 (unsigned long long) stat_info.control_req);
514
515 ZFCP_SHOST_ATTR(megabytes, "%llu %llu\n",
516                 (unsigned long long) stat_info.input_mb,
517                 (unsigned long long) stat_info.output_mb);
518
519 ZFCP_SHOST_ATTR(seconds_active, "%llu\n",
520                 (unsigned long long) stat_info.seconds_act);
521
522 static ssize_t zfcp_sysfs_adapter_q_full_show(struct device *dev,
523                                               struct device_attribute *attr,
524                                               char *buf)
525 {
526         struct Scsi_Host *scsi_host = class_to_shost(dev);
527         struct zfcp_qdio *qdio =
528                 ((struct zfcp_adapter *) scsi_host->hostdata[0])->qdio;
529         u64 util;
530
531         spin_lock_bh(&qdio->stat_lock);
532         util = qdio->req_q_util;
533         spin_unlock_bh(&qdio->stat_lock);
534
535         return sprintf(buf, "%d %llu\n", atomic_read(&qdio->req_q_full),
536                        (unsigned long long)util);
537 }
538 static DEVICE_ATTR(queue_full, S_IRUGO, zfcp_sysfs_adapter_q_full_show, NULL);
539
540 struct device_attribute *zfcp_sysfs_shost_attrs[] = {
541         &dev_attr_utilization,
542         &dev_attr_requests,
543         &dev_attr_megabytes,
544         &dev_attr_seconds_active,
545         &dev_attr_queue_full,
546         NULL
547 };