[RESEND3 PATCH] libiscsi: avoid unnecessary multiple NULL assignments

2013-02-25 Thread Masatake YAMATO
In iscsi_free_task, NULL is assigned to task->sc twice: before and
after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
with session->lock, so multiple NULL assignments cause no trouble. But
people reading the source code may be confused.

The second NULL assignment comes from commit:

3e5c28ad0391389959ccae81c938c7533efb3490

It seems that the line after kfifo_in invocation was introduced
accidentally.

Signed-off-by: Masatake YAMATO 
Reviewed-by: Mike Christie 
---
 drivers/scsi/libiscsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..7aacf3a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -507,7 +507,6 @@ static void iscsi_free_task(struct iscsi_task *task)
kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
 
if (sc) {
-   task->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
/*
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND PATCH] libiscsi: avoid unnecessary multiple NULL assignments

2013-01-23 Thread Masatake YAMATO
In iscsi_free_task, NULL is assigned to task->sc twice: before and
after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
with session->lock, so multiple NULL assignments cause no trouble. But
people reading the source code may be confused.

The second NULL assignment comes from commit:

3e5c28ad0391389959ccae81c938c7533efb3490

It seems that the line after kfifo_in invocation was introduced
accidentally.

Signed-off-by: Masatake YAMATO 
Reviewed-by: Mike Christie 
---
 drivers/scsi/libiscsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..7aacf3a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -507,7 +507,6 @@ static void iscsi_free_task(struct iscsi_task *task)
kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
 
if (sc) {
-   task->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
/*
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND2 PATCH] libiscsi: avoid unnecessary multiple NULL assignments

2012-12-17 Thread Masatake YAMATO
In iscsi_free_task, NULL is assigned to task->sc twice: before and
after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
with session->lock, so multiple NULL assignments cause no trouble. But
people reading the source code may be confused.

The second NULL assignment comes from commit:

3e5c28ad0391389959ccae81c938c7533efb3490

It seems that the line after kfifo_in invocation was introduced
accidentally.

Signed-off-by: Masatake YAMATO 
Reviewed-by: Mike Christie 
---
 drivers/scsi/libiscsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..7aacf3a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -507,7 +507,6 @@ static void iscsi_free_task(struct iscsi_task *task)
kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
 
if (sc) {
-   task->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
/*
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND PATCH] libiscsi: avoid unnecessary multiple NULL assignments

2012-11-25 Thread Masatake YAMATO
In iscsi_free_task, NULL is assigned to task->sc twice: before and
after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
with session->lock, so multiple NULL assignments cause no trouble. But
people reading the source code may be confused.

The second NULL assignment comes from commit:

3e5c28ad0391389959ccae81c938c7533efb3490

It seems that the line after kfifo_in invocation was introduced
accidentally.

Signed-off-by: Masatake YAMATO 
Reviewed-by: Mike Christie 
---
 drivers/scsi/libiscsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..7aacf3a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -507,7 +507,6 @@ static void iscsi_free_task(struct iscsi_task *task)
kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
 
if (sc) {
-   task->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
/*
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] be2iscsi: cleanup format strings

2012-08-13 Thread Masatake YAMATO
In format strings for printk in be2iscsi, concatenations of
constant c strings are used widely. However, the log output is a bit
hard to read because whitespaces are missed in the constant c
strings like:

SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
"received/sent on CID 0x%x...\n",

You will see "CQ Error 0x resetreceived/sent on CID ..." and
wonder what is "resetreceived".

This patch does cleanup these log format strings:

* joining concatenated constant c strings into one,
* inserting a white space after punctuation, and
* inserting white spaces before/after hypen.

In v2 patch concatenated constant c strings are joined into one
as suggested by Joe Perches .

Signed-off-by: Masatake YAMATO 
---
 drivers/scsi/be2iscsi/be_cmds.c  |  12 ++-
 drivers/scsi/be2iscsi/be_iscsi.c |  48 +---
 drivers/scsi/be2iscsi/be_main.c  | 160 +++
 drivers/scsi/be2iscsi/be_mgmt.c  |  10 +--
 4 files changed, 90 insertions(+), 140 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index d2e9e93..f6510a2 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -93,8 +93,8 @@ int be_chk_reset_complete(struct beiscsi_hba *phba)
}
 
if ((status & 0x8000) || (!num_loop)) {
-   printk(KERN_ERR "Failed in be_chk_reset_complete"
-   "status = 0x%x\n", status);
+   printk(KERN_ERR "Failed in be_chk_reset_complete status = 
0x%x\n",
+  status);
return -EIO;
}
 
@@ -245,8 +245,7 @@ void beiscsi_async_link_state_process(struct beiscsi_hba 
*phba,
evt->physical_port);
break;
default:
-   SE_DEBUG(DBG_LVL_1, "Unexpected Async Notification %d on"
-   "Physical Port %d\n",
+   SE_DEBUG(DBG_LVL_1, "Unexpected Async Notification %d on 
Physical Port %d\n",
 evt->port_link_status,
 evt->physical_port);
}
@@ -279,9 +278,8 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
beiscsi_async_link_state_process(phba,
   (struct be_async_event_link_state *) compl);
else
-   SE_DEBUG(DBG_LVL_1,
-" Unsupported Async Event, flags"
-" = 0x%08x\n", compl->flags);
+   SE_DEBUG(DBG_LVL_1, " Unsupported Async Event, 
flags = 0x%08x\n",
+compl->flags);
 
} else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
status = be_mcc_compl_process(ctrl, compl);
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 43f3503..589212d 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -60,11 +60,11 @@ struct iscsi_cls_session *beiscsi_session_create(struct 
iscsi_endpoint *ep,
phba = beiscsi_ep->phba;
shost = phba->shost;
if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) {
-   shost_printk(KERN_ERR, shost, "Cannot handle %d cmds."
-"Max cmds per session supported is %d. Using %d. "
-"\n", cmds_max,
- beiscsi_ep->phba->params.wrbs_per_cxn,
- beiscsi_ep->phba->params.wrbs_per_cxn);
+   shost_printk(KERN_ERR, shost,
+"Cannot handle %d cmds. Max cmds per session 
supported is %d. Using %d.\n",
+cmds_max,
+beiscsi_ep->phba->params.wrbs_per_cxn,
+beiscsi_ep->phba->params.wrbs_per_cxn);
cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn;
}
 
@@ -123,8 +123,8 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, 
u32 cid)
struct iscsi_session *sess;
struct beiscsi_session *beiscsi_sess;
 
-   SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create ,cid"
-"from iscsi layer=%d\n", cid);
+   SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create, cid from iscsi layer=%d\n",
+cid);
shost = iscsi_session_to_shost(cls_session);
phba = iscsi_host_priv(shost);
 
@@ -219,8 +219,7 @@ static int beiscsi_create_ipv4_iface(struct beiscsi_hba 
*phba)
  ISCSI_IFACE_TYPE_IPV4,
   

[PATCH] libiscsi: avoid unnecessary multiple NULL assignments

2012-08-13 Thread Masatake YAMATO
In iscsi_free_task, NULL is assigned to task->sc twice: before and
after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
with session->lock, so multiple NULL assignments cause no trouble. But
people reading the source code may be confused.

The second NULL assignment comes from commit:

3e5c28ad0391389959ccae81c938c7533efb3490

It seems that the line after kfifo_in invocation was introduced
accidentally.

Signed-off-by: Masatake YAMATO 
Reviewed-by: Mike Christie 
---
 drivers/scsi/libiscsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..7aacf3a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -500,21 +500,20 @@ static void iscsi_free_task(struct iscsi_task *task)
task->sc = NULL;
/*
 * login task is preallocated so do not free
 */
if (conn->login_task == task)
return;
 
kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
 
if (sc) {
-   task->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
/*
 * queue command may call this to free the task, so
 * it will decide how to return sc to scsi-ml.
 */
if (oldstate != ISCSI_TASK_REQUEUE_SCSIQ)
sc->scsi_done(sc);
}
 }
-- 
1.7.11.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] be2iscsi: cleanup format strings using literal string concatenations

2012-08-12 Thread Masatake YAMATO
In format strings for printk in be2iscsi, literal c string
concatenations are used widely. However, the log output is a bit
difficult to read because whitespaces are missed in the literal c
strings like:

SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
"received/sent on CID 0x%x...\n",

You will see "CQ Error 0x resetreceived/sent on CID ..." and
wonder what is "resetreceived".

This patch cleanup these log messages:

- inserting a white space between c string concatenations,
- inserting a white space after punctuation, and
- inserting white spaces before/after hypen.

Signed-off-by: Masatake YAMATO 
---
 drivers/scsi/be2iscsi/be_cmds.c  |  4 +--
 drivers/scsi/be2iscsi/be_iscsi.c | 10 +++---
 drivers/scsi/be2iscsi/be_main.c  | 70 
 drivers/scsi/be2iscsi/be_mgmt.c  |  2 +-
 4 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index d2e9e93..d117e7a 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -93,7 +93,7 @@ int be_chk_reset_complete(struct beiscsi_hba *phba)
}
 
if ((status & 0x8000) || (!num_loop)) {
-   printk(KERN_ERR "Failed in be_chk_reset_complete"
+   printk(KERN_ERR "Failed in be_chk_reset_complete "
"status = 0x%x\n", status);
return -EIO;
}
@@ -245,7 +245,7 @@ void beiscsi_async_link_state_process(struct beiscsi_hba 
*phba,
evt->physical_port);
break;
default:
-   SE_DEBUG(DBG_LVL_1, "Unexpected Async Notification %d on"
+   SE_DEBUG(DBG_LVL_1, "Unexpected Async Notification %d on "
"Physical Port %d\n",
 evt->port_link_status,
 evt->physical_port);
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 43f3503..15270dd 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -60,8 +60,8 @@ struct iscsi_cls_session *beiscsi_session_create(struct 
iscsi_endpoint *ep,
phba = beiscsi_ep->phba;
shost = phba->shost;
if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) {
-   shost_printk(KERN_ERR, shost, "Cannot handle %d cmds."
-"Max cmds per session supported is %d. Using %d. "
+   shost_printk(KERN_ERR, shost, "Cannot handle %d cmds. "
+"Max cmds per session supported is %d. Using %d."
 "\n", cmds_max,
  beiscsi_ep->phba->params.wrbs_per_cxn,
  beiscsi_ep->phba->params.wrbs_per_cxn);
@@ -123,7 +123,7 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, 
u32 cid)
struct iscsi_session *sess;
struct beiscsi_session *beiscsi_sess;
 
-   SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create ,cid"
+   SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create, cid "
 "from iscsi layer=%d\n", cid);
shost = iscsi_session_to_shost(cls_session);
phba = iscsi_host_priv(shost);
@@ -404,7 +404,7 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
 * BE2ISCSI only supports 1 interface
 */
if (iface_param->iface_num) {
-   shost_printk(KERN_ERR, shost, "Invalid iface_num %d."
+   shost_printk(KERN_ERR, shost, "Invalid iface_num %d. "
 "Only iface_num 0 is supported.\n",
 iface_param->iface_num);
return -EINVAL;
@@ -833,7 +833,7 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
memset(¶ms, 0, sizeof(struct beiscsi_offload_params));
beiscsi_ep = beiscsi_conn->ep;
if (!beiscsi_ep)
-   SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start , no beiscsi_ep\n");
+   SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start, no beiscsi_ep\n");
 
beiscsi_conn->login_in_progress = 0;
beiscsi_set_params_for_offld(beiscsi_conn, ¶ms);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 0b1d99c..92e534b 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -113,7 +113,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
&nonemb_cmd.dma);
if (nonemb_cmd.va == NULL) {
SE_DEBUG(DBG_LVL_1,
-"Failed to alloc