aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.c
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2010-12-02 09:16:16 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:24:46 -0500
commitea4a3a6ac40e2a585654808d4aefb39a6d57dca0 (patch)
treec0da0843fc8d4087448ffc4e1b7992dab6aa62f5 /drivers/s390/scsi/zfcp_dbf.c
parent250a1352b95e1db3216e5c5d4f4365bea5122f4a (diff)
[SCSI] zfcp: Redesign of the debug tracing final cleanup.
This patch is the final cleanup of the redesign from the zfcp tracing. Structures and elements which were used by multiple areas of the former debug tracing are now changed to the new scheme. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index f9bd094c6e63..96d1462e0bf5 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -377,26 +377,37 @@ void zfcp_dbf_scsi(char *tag, struct scsi_cmnd *sc, struct zfcp_fsf_req *fsf)
377 } 377 }
378 } 378 }
379 379
380 debug_event(adapter->dbf->scsi, 1, rec, sizeof(*rec)); 380 debug_event(dbf->scsi, 1, rec, sizeof(*rec));
381 spin_unlock_irqrestore(&dbf->scsi_lock, flags); 381 spin_unlock_irqrestore(&dbf->scsi_lock, flags);
382} 382}
383 383
384static debug_info_t *zfcp_dbf_reg(const char *name, int level, 384static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size)
385 struct debug_view *view, int size)
386{ 385{
387 struct debug_info *d; 386 struct debug_info *d;
388 387
389 d = debug_register(name, dbfsize, level, size); 388 d = debug_register(name, size, 1, rec_size);
390 if (!d) 389 if (!d)
391 return NULL; 390 return NULL;
392 391
393 debug_register_view(d, &debug_hex_ascii_view); 392 debug_register_view(d, &debug_hex_ascii_view);
394 debug_register_view(d, view); 393 debug_set_level(d, 3);
395 debug_set_level(d, level);
396 394
397 return d; 395 return d;
398} 396}
399 397
398static void zfcp_dbf_unregister(struct zfcp_dbf *dbf)
399{
400 if (!dbf)
401 return;
402
403 debug_unregister(dbf->scsi);
404 debug_unregister(dbf->san);
405 debug_unregister(dbf->hba);
406 debug_unregister(dbf->pay);
407 debug_unregister(dbf->rec);
408 kfree(dbf);
409}
410
400/** 411/**
401 * zfcp_adapter_debug_register - registers debug feature for an adapter 412 * zfcp_adapter_debug_register - registers debug feature for an adapter
402 * @adapter: pointer to adapter for which debug features should be registered 413 * @adapter: pointer to adapter for which debug features should be registered
@@ -404,15 +415,13 @@ static debug_info_t *zfcp_dbf_reg(const char *name, int level,
404 */ 415 */
405int zfcp_dbf_adapter_register(struct zfcp_adapter *adapter) 416int zfcp_dbf_adapter_register(struct zfcp_adapter *adapter)
406{ 417{
407 char dbf_name[DEBUG_MAX_NAME_LEN]; 418 char name[DEBUG_MAX_NAME_LEN];
408 struct zfcp_dbf *dbf; 419 struct zfcp_dbf *dbf;
409 420
410 dbf = kzalloc(sizeof(struct zfcp_dbf), GFP_KERNEL); 421 dbf = kzalloc(sizeof(struct zfcp_dbf), GFP_KERNEL);
411 if (!dbf) 422 if (!dbf)
412 return -ENOMEM; 423 return -ENOMEM;
413 424
414 dbf->adapter = adapter;
415
416 spin_lock_init(&dbf->pay_lock); 425 spin_lock_init(&dbf->pay_lock);
417 spin_lock_init(&dbf->hba_lock); 426 spin_lock_init(&dbf->hba_lock);
418 spin_lock_init(&dbf->san_lock); 427 spin_lock_init(&dbf->san_lock);
@@ -420,59 +429,52 @@ int zfcp_dbf_adapter_register(struct zfcp_adapter *adapter)
420 spin_lock_init(&dbf->rec_lock); 429 spin_lock_init(&dbf->rec_lock);
421 430
422 /* debug feature area which records recovery activity */ 431 /* debug feature area which records recovery activity */
423 sprintf(dbf_name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev)); 432 sprintf(name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev));
424 dbf->rec = zfcp_dbf_reg(dbf_name, 3, NULL, sizeof(struct zfcp_dbf_rec)); 433 dbf->rec = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_rec));
425 if (!dbf->rec) 434 if (!dbf->rec)
426 goto err_out; 435 goto err_out;
427 436
428 /* debug feature area which records HBA (FSF and QDIO) conditions */ 437 /* debug feature area which records HBA (FSF and QDIO) conditions */
429 sprintf(dbf_name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev)); 438 sprintf(name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev));
430 dbf->hba = zfcp_dbf_reg(dbf_name, 3, NULL, sizeof(struct zfcp_dbf_hba)); 439 dbf->hba = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_hba));
431 if (!dbf->hba) 440 if (!dbf->hba)
432 goto err_out; 441 goto err_out;
433 442
434 /* debug feature area which records payload info */ 443 /* debug feature area which records payload info */
435 sprintf(dbf_name, "zfcp_%s_pay", dev_name(&adapter->ccw_device->dev)); 444 sprintf(name, "zfcp_%s_pay", dev_name(&adapter->ccw_device->dev));
436 dbf->pay = zfcp_dbf_reg(dbf_name, 3, NULL, 445 dbf->pay = zfcp_dbf_reg(name, dbfsize * 2, sizeof(struct zfcp_dbf_pay));
437 sizeof(struct zfcp_dbf_pay));
438 if (!dbf->pay) 446 if (!dbf->pay)
439 goto err_out; 447 goto err_out;
440 448
441 /* debug feature area which records SAN command failures and recovery */ 449 /* debug feature area which records SAN command failures and recovery */
442 sprintf(dbf_name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev)); 450 sprintf(name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev));
443 dbf->san = zfcp_dbf_reg(dbf_name, 3, NULL, sizeof(struct zfcp_dbf_san)); 451 dbf->san = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_san));
444 if (!dbf->san) 452 if (!dbf->san)
445 goto err_out; 453 goto err_out;
446 454
447 /* debug feature area which records SCSI command failures and recovery */ 455 /* debug feature area which records SCSI command failures and recovery */
448 sprintf(dbf_name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev)); 456 sprintf(name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev));
449 dbf->scsi = zfcp_dbf_reg(dbf_name, 3, NULL, 457 dbf->scsi = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_scsi));
450 sizeof(struct zfcp_dbf_scsi));
451 if (!dbf->scsi) 458 if (!dbf->scsi)
452 goto err_out; 459 goto err_out;
453 460
454 adapter->dbf = dbf; 461 adapter->dbf = dbf;
455 return 0;
456 462
463 return 0;
457err_out: 464err_out:
458 zfcp_dbf_adapter_unregister(dbf); 465 zfcp_dbf_unregister(dbf);
459 return -ENOMEM; 466 return -ENOMEM;
460} 467}
461 468
462/** 469/**
463 * zfcp_adapter_debug_unregister - unregisters debug feature for an adapter 470 * zfcp_adapter_debug_unregister - unregisters debug feature for an adapter
464 * @dbf: pointer to dbf for which debug features should be unregistered 471 * @adapter: pointer to adapter for which debug features should be unregistered
465 */ 472 */
466void zfcp_dbf_adapter_unregister(struct zfcp_dbf *dbf) 473void zfcp_dbf_adapter_unregister(struct zfcp_adapter *adapter)
467{ 474{
468 if (!dbf) 475 struct zfcp_dbf *dbf = adapter->dbf;
469 return; 476
470 debug_unregister(dbf->scsi); 477 adapter->dbf = NULL;
471 debug_unregister(dbf->san); 478 zfcp_dbf_unregister(dbf);
472 debug_unregister(dbf->hba);
473 debug_unregister(dbf->pay);
474 debug_unregister(dbf->rec);
475 dbf->adapter->dbf = NULL;
476 kfree(dbf);
477} 479}
478 480