Make iSCSI frontend less chatty while waiting for tasks termination.

MFC after:	1 week
This commit is contained in:
Alexander Motin 2014-11-22 04:40:24 +00:00
parent 0beab155a6
commit 94ab1f3693

View File

@ -1058,7 +1058,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs)
{ {
struct cfiscsi_data_wait *cdw; struct cfiscsi_data_wait *cdw;
union ctl_io *io; union ctl_io *io;
int error, last; int error, last, wait;
if (cs->cs_target == NULL) if (cs->cs_target == NULL)
return; /* No target yet, so nothing to do. */ return; /* No target yet, so nothing to do. */
@ -1103,16 +1103,20 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs)
/* /*
* Wait for CTL to terminate all the tasks. * Wait for CTL to terminate all the tasks.
*/ */
wait = cs->cs_outstanding_ctl_pdus;
if (wait > 0)
CFISCSI_SESSION_WARN(cs,
"waiting for CTL to terminate %d tasks", wait);
for (;;) { for (;;) {
refcount_acquire(&cs->cs_outstanding_ctl_pdus); refcount_acquire(&cs->cs_outstanding_ctl_pdus);
last = refcount_release(&cs->cs_outstanding_ctl_pdus); last = refcount_release(&cs->cs_outstanding_ctl_pdus);
if (last != 0) if (last != 0)
break; break;
CFISCSI_SESSION_WARN(cs, "waiting for CTL to terminate tasks, "
"%d remaining", cs->cs_outstanding_ctl_pdus);
tsleep(__DEVOLATILE(void *, &cs->cs_outstanding_ctl_pdus), tsleep(__DEVOLATILE(void *, &cs->cs_outstanding_ctl_pdus),
0, "cfiscsi_terminate", hz / 100); 0, "cfiscsi_terminate", hz / 100);
} }
if (wait > 0)
CFISCSI_SESSION_WARN(cs, "tasks terminated");
} }
static void static void