tired of mangled xpt_print output?
Matthew Jacob
mjacob at freebsd.org
Tue Aug 14 19:03:33 UTC 2012
I sure am.
ctlfe_onoffline: SIM isp1 (path id 1) target disable succeeded
(ctl2:isp0:0:0:0): disabling lun 0
(ctl2:isp0:0:0:0): lun now disabled for target mode
(ctl2:isp0:0:0:0): LUN removed, 1024 ATIOs outstanding, 1024 INOTs
outstanding, 1 refs
(ctl3:isp1:0:0:0): (ctl2:disabling lun 0
isp0:0:0:(ctl3:0): isp1:0:now releasing locked
0:(ctl2:0): isp0:0:lun now disabled for target mode
0:(ctl3:0): isp1:0:ctlfecleanup: Called
0:0): LUN removed, 1024 ATIOs outstanding, 1024 INOTs outstanding, 1 refs
(ctl3:isp1:0:0:0): now releasing locked
(ctl3:isp1:0:0:0): ctlfecleanup: Called
The attached patch mitigates this and produces instead:
ctlfe_onoffline: SIM isp1 (path id 1) target disable succeeded
(ctl2:isp0:0:0:0): disabling lun 0
(ctl2:isp0:0:0:0): lun now disabled for target mode
(ctl2:isp0:0:0:0): LUN being removed, 1024 ATIOs still outstanding, 1024
INOTs still outstanding, 1 refs
(ctl3:isp1:0:0:0): disabling lun 0
(ctl2:isp0:0:0:0): All ATIOs and INOTs now returned
(ctl3:isp1:0:0:0): lun now disabled for target mode
(ctl2:isp0:0:0:0): ctlfecleanup: Called
(ctl3:isp1:0:0:0): LUN being removed, 1024 ATIOs still outstanding, 1024
INOTs still outstanding, 1 refs
(ctl3:isp1:0:0:0): All ATIOs and INOTs now returned
(ctl3:isp1:0:0:0): ctlfecleanup: Called
This won't play into PRINTF_BUFR_SIZE stuff, but at least will be more
readable.
An alternative would be sprintf, but then we'd have to do dork around
with sbuf stuff or more stack,.....
Comments about putting it in?
-------------- next part --------------
Index: cam/cam_xpt.c
===================================================================
--- cam/cam_xpt.c (revision 239240)
+++ cam/cam_xpt.c (working copy)
@@ -158,6 +158,8 @@
static cam_simq_t cam_simq;
static struct mtx cam_simq_lock;
+static struct mtx xpt_print_lock;
+
/* Pointers to software interrupt handlers */
static void *cambio_ih;
@@ -900,6 +902,7 @@
xsoftc.num_highpower = CAM_MAX_HIGHPOWER;
mtx_init(&cam_simq_lock, "CAM SIMQ lock", NULL, MTX_DEF);
+ mtx_init(&xpt_print_lock, "XPT print lock", NULL, MTX_DEF);
mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF);
mtx_init(&xsoftc.xpt_topo_lock, "XPT topology lock", NULL, MTX_DEF);
@@ -3650,10 +3653,12 @@
xpt_print(struct cam_path *path, const char *fmt, ...)
{
va_list ap;
+ mtx_lock(&xpt_print_lock);
xpt_print_path(path);
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
+ mtx_unlock(&xpt_print_lock);
}
int
More information about the freebsd-scsi
mailing list