aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi/iscsi_target.c
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2013-11-13 21:54:45 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2013-11-20 00:38:52 -0500
commit04f3b31bff720f01d684100c868c88f67ced8dc8 (patch)
treed9b5fac82a5e6c23b98f33c64901affa37bbfd67 /drivers/target/iscsi/iscsi_target.c
parentee480683d975973e3ff679850871e00e011c4a96 (diff)
iscsi-target: Convert iscsi_session statistics to atomic_long_t
This patch converts a handful of iscsi_session statistics to type atomic_long_t, instead of using iscsi_session->session_stats_lock when incrementing these values. More importantly, go ahead and drop the spinlock usage within iscsit_setup_scsi_cmd(), iscsit_check_dataout_hdr(), iscsit_send_datain(), and iscsit_build_rsp_pdu() fast-path code. (Squash in Roland's target: Remove write-only stats fields and lock from struct se_node_acl) Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target.c')
-rw-r--r--drivers/target/iscsi/iscsi_target.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index ba9787d24c12..bf76fc46fc52 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -800,14 +800,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
800 int iscsi_task_attr; 800 int iscsi_task_attr;
801 int sam_task_attr; 801 int sam_task_attr;
802 802
803 spin_lock_bh(&conn->sess->session_stats_lock); 803 atomic_long_inc(&conn->sess->cmd_pdus);
804 conn->sess->cmd_pdus++;
805 if (conn->sess->se_sess->se_node_acl) {
806 spin_lock(&conn->sess->se_sess->se_node_acl->stats_lock);
807 conn->sess->se_sess->se_node_acl->num_cmds++;
808 spin_unlock(&conn->sess->se_sess->se_node_acl->stats_lock);
809 }
810 spin_unlock_bh(&conn->sess->session_stats_lock);
811 804
812 hdr = (struct iscsi_scsi_req *) buf; 805 hdr = (struct iscsi_scsi_req *) buf;
813 payload_length = ntoh24(hdr->dlength); 806 payload_length = ntoh24(hdr->dlength);
@@ -1254,14 +1247,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
1254 } 1247 }
1255 1248
1256 /* iSCSI write */ 1249 /* iSCSI write */
1257 spin_lock_bh(&conn->sess->session_stats_lock); 1250 atomic_long_add(payload_length, &conn->sess->rx_data_octets);
1258 conn->sess->rx_data_octets += payload_length;
1259 if (conn->sess->se_sess->se_node_acl) {
1260 spin_lock(&conn->sess->se_sess->se_node_acl->stats_lock);
1261 conn->sess->se_sess->se_node_acl->write_bytes += payload_length;
1262 spin_unlock(&conn->sess->se_sess->se_node_acl->stats_lock);
1263 }
1264 spin_unlock_bh(&conn->sess->session_stats_lock);
1265 1251
1266 if (payload_length > conn->conn_ops->MaxXmitDataSegmentLength) { 1252 if (payload_length > conn->conn_ops->MaxXmitDataSegmentLength) {
1267 pr_err("DataSegmentLength: %u is greater than" 1253 pr_err("DataSegmentLength: %u is greater than"
@@ -2631,14 +2617,7 @@ static int iscsit_send_datain(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
2631 return -1; 2617 return -1;
2632 } 2618 }
2633 2619
2634 spin_lock_bh(&conn->sess->session_stats_lock); 2620 atomic_long_add(datain.length, &conn->sess->tx_data_octets);
2635 conn->sess->tx_data_octets += datain.length;
2636 if (conn->sess->se_sess->se_node_acl) {
2637 spin_lock(&conn->sess->se_sess->se_node_acl->stats_lock);
2638 conn->sess->se_sess->se_node_acl->read_bytes += datain.length;
2639 spin_unlock(&conn->sess->se_sess->se_node_acl->stats_lock);
2640 }
2641 spin_unlock_bh(&conn->sess->session_stats_lock);
2642 /* 2621 /*
2643 * Special case for successfully execution w/ both DATAIN 2622 * Special case for successfully execution w/ both DATAIN
2644 * and Sense Data. 2623 * and Sense Data.
@@ -3163,9 +3142,7 @@ void iscsit_build_rsp_pdu(struct iscsi_cmd *cmd, struct iscsi_conn *conn,
3163 if (inc_stat_sn) 3142 if (inc_stat_sn)
3164 cmd->stat_sn = conn->stat_sn++; 3143 cmd->stat_sn = conn->stat_sn++;
3165 3144
3166 spin_lock_bh(&conn->sess->session_stats_lock); 3145 atomic_long_inc(&conn->sess->rsp_pdus);
3167 conn->sess->rsp_pdus++;
3168 spin_unlock_bh(&conn->sess->session_stats_lock);
3169 3146
3170 memset(hdr, 0, ISCSI_HDR_LEN); 3147 memset(hdr, 0, ISCSI_HDR_LEN);
3171 hdr->opcode = ISCSI_OP_SCSI_CMD_RSP; 3148 hdr->opcode = ISCSI_OP_SCSI_CMD_RSP;
@@ -4114,9 +4091,7 @@ restart:
4114 * hit default in the switch below. 4091 * hit default in the switch below.
4115 */ 4092 */
4116 memset(buffer, 0xff, ISCSI_HDR_LEN); 4093 memset(buffer, 0xff, ISCSI_HDR_LEN);
4117 spin_lock_bh(&conn->sess->session_stats_lock); 4094 atomic_long_inc(&conn->sess->conn_digest_errors);
4118 conn->sess->conn_digest_errors++;
4119 spin_unlock_bh(&conn->sess->session_stats_lock);
4120 } else { 4095 } else {
4121 pr_debug("Got HeaderDigest CRC32C" 4096 pr_debug("Got HeaderDigest CRC32C"
4122 " 0x%08x\n", checksum); 4097 " 0x%08x\n", checksum);