From: <vl...@us...> - 2007-11-01 17:07:11
|
Revision: 214 http://scst.svn.sourceforge.net/scst/?rev=214&view=rev Author: vlnb Date: 2007-11-01 10:07:07 -0700 (Thu, 01 Nov 2007) Log Message: ----------- Cleanups, debug imporvements and minor fixes Modified Paths: -------------- trunk/iscsi-scst/kernel/config.c trunk/iscsi-scst/kernel/conn.c trunk/iscsi-scst/kernel/digest.c trunk/iscsi-scst/kernel/event.c trunk/iscsi-scst/kernel/iscsi.c trunk/iscsi-scst/kernel/iscsi_dbg.h trunk/iscsi-scst/kernel/nthread.c trunk/iscsi-scst/kernel/param.c trunk/iscsi-scst/kernel/session.c trunk/iscsi-scst/kernel/target.c trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/qla2x00t-full_perf.patch trunk/qla2x00t-release.patch trunk/scst/include/scst_debug.h trunk/scst/src/dev_handlers/scst_cdrom.c trunk/scst/src/dev_handlers/scst_changer.c trunk/scst/src/dev_handlers/scst_dev_handler.h trunk/scst/src/dev_handlers/scst_disk.c trunk/scst/src/dev_handlers/scst_modisk.c trunk/scst/src/dev_handlers/scst_processor.c trunk/scst/src/dev_handlers/scst_raid.c trunk/scst/src/dev_handlers/scst_tape.c trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_debug.c trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c trunk/scst/src/scst_priv.h trunk/scst/src/scst_proc.c trunk/scst/src/scst_targ.c trunk/usr/fileio/common.c trunk/usr/fileio/debug.c trunk/usr/fileio/debug.h trunk/usr/fileio/fileio.c Modified: trunk/iscsi-scst/kernel/config.c =================================================================== --- trunk/iscsi-scst/kernel/config.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/config.c 2007-11-01 17:07:07 UTC (rev 214) @@ -32,6 +32,7 @@ { TRACE_CONN_OC, "conn" }, { TRACE_D_IOV, "iov" }, { TRACE_D_DUMP_PDU, "pdu" }, + { TRACE_NET_PG, "net_page" }, { 0, NULL } }; @@ -113,7 +114,7 @@ p = scst_create_proc_entry(root, ISCSI_PROC_VERSION_NAME, &iscsi_version_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register " + PRINT_ERROR("Not enough memory to register " "target driver %s entry %s in /proc", templ->name, ISCSI_PROC_VERSION_NAME); res = -ENOMEM; @@ -126,7 +127,7 @@ p = scst_create_proc_entry(root, ISCSI_PROC_LOG_ENTRY_NAME, &iscsi_log_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register " + PRINT_ERROR("Not enough memory to register " "target driver %s entry %s in /proc", templ->name, ISCSI_PROC_LOG_ENTRY_NAME); res = -ENOMEM; @@ -390,7 +391,7 @@ if (cmd == ADD_TARGET) if (target) { err = -EEXIST; - PRINT_ERROR_PR("Target %u already exist!", id); + PRINT_ERROR("Target %u already exist!", id); goto out_unlock; } @@ -401,7 +402,7 @@ } if (!target) { - PRINT_ERROR_PR("can't find the target %u", id); + PRINT_ERROR("can't find the target %u", id); err = -EINVAL; goto out_unlock; } @@ -442,7 +443,7 @@ break; default: - PRINT_ERROR_PR("invalid ioctl cmd %x", cmd); + PRINT_ERROR("invalid ioctl cmd %x", cmd); err = -EINVAL; } @@ -457,6 +458,7 @@ static int release(struct inode *inode, struct file *filp) { + TRACE(TRACE_MGMT, "%s", "Releasing allocated resources"); target_del_all(); return 0; } Modified: trunk/iscsi-scst/kernel/conn.c =================================================================== --- trunk/iscsi-scst/kernel/conn.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/conn.c 2007-11-01 17:07:07 UTC (rev 214) @@ -175,7 +175,7 @@ if (sk->sk_state != TCP_ESTABLISHED) { if (!conn->closing) { - PRINT_ERROR_PR("Connection with initiator %s (%p) " + PRINT_ERROR("Connection with initiator %s (%p) " "unexpectedly closed!", conn->session->initiator_name, conn); mark_conn_closed(conn); @@ -238,7 +238,7 @@ conn->sock = SOCKET_I(conn->file->f_dentry->d_inode); if (conn->sock->ops->sendpage == NULL) { - PRINT_ERROR_PR("Socket for sid %llu doesn't support sendpage()", + PRINT_ERROR("Socket for sid %llu doesn't support sendpage()", session->sid); res = -EINVAL; goto out; @@ -385,7 +385,7 @@ if (!conn) return err; - PRINT_INFO_PR("Deleting connection with initiator %s (%p)", + PRINT_INFO("Deleting connection with initiator %s (%p)", conn->session->initiator_name, conn); mark_conn_closed(conn); Modified: trunk/iscsi-scst/kernel/digest.c =================================================================== --- trunk/iscsi-scst/kernel/digest.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/digest.c 2007-11-01 17:07:07 UTC (rev 214) @@ -31,7 +31,7 @@ #endif if ((*val & DIGEST_CRC32C) && !crc32c) { - PRINT_ERROR_PR("%s", "CRC32C digest algorithm not available " + PRINT_ERROR("%s", "CRC32C digest algorithm not available " "in kernel"); *val |= ~DIGEST_CRC32C; } @@ -70,7 +70,7 @@ #ifdef DEBUG_DIGEST_FAILURES if (((scst_random() % 100000) == 752)) { - PRINT_INFO_PR("%s", "Simulating digest failure"); + PRINT_INFO("%s", "Simulating digest failure"); return 0; } #endif @@ -143,7 +143,7 @@ crc = digest_header(&cmnd->pdu); if (crc != cmnd->hdigest) { - PRINT_ERROR_PR("%s", "RX header digest failed"); + PRINT_ERROR("%s", "RX header digest failed"); return -EIO; } else TRACE_DBG("RX header digest OK for cmd %p", cmnd); @@ -184,7 +184,7 @@ crc = digest_data(req, cmnd->pdu.datasize, offset); if (crc != cmnd->ddigest) { - PRINT_ERROR_PR("%s", "RX data digest failed"); + PRINT_ERROR("%s", "RX data digest failed"); res = -EIO; } else TRACE_DBG("RX data digest OK for cmd %p", cmnd); Modified: trunk/iscsi-scst/kernel/event.c =================================================================== --- trunk/iscsi-scst/kernel/event.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/event.c 2007-11-01 17:07:07 UTC (rev 214) @@ -113,7 +113,7 @@ THIS_MODULE); #endif if (!nl) { - PRINT_ERROR_PR("%s", "netlink_kernel_create() failed"); + PRINT_ERROR("%s", "netlink_kernel_create() failed"); return -ENOMEM; } else return 0; Modified: trunk/iscsi-scst/kernel/iscsi.c =================================================================== --- trunk/iscsi-scst/kernel/iscsi.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/iscsi.c 2007-11-01 17:07:07 UTC (rev 214) @@ -145,7 +145,7 @@ if (unlikely(cmnd->on_write_list)) { struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd); - PRINT_ERROR_PR("cmnd %p still on some list?, %x, %x, %x, %x, %x, %x, %x", + PRINT_ERROR("cmnd %p still on some list?, %x, %x, %x, %x, %x, %x, %x", cmnd, req->opcode, req->scb[0], req->flags, req->itt, be32_to_cpu(req->data_length), req->cmd_sn, be32_to_cpu(cmnd->pdu.datasize)); @@ -153,7 +153,7 @@ if (cmnd->parent_req) { struct iscsi_scsi_cmd_hdr *req = cmnd_hdr(cmnd->parent_req); - PRINT_ERROR_PR("%p %x %u", req, req->opcode, req->scb[0]); + PRINT_ERROR("%p %x %u", req, req->opcode, req->scb[0]); } sBUG(); } @@ -199,7 +199,7 @@ scst_tgt_cmd_done(cmnd->scst_cmd); break; default: - PRINT_ERROR_PR("Unexpected cmnd scst state %d", + PRINT_ERROR("Unexpected cmnd scst state %d", cmnd->scst_state); sBUG(); break; @@ -445,7 +445,7 @@ LIST_HEAD(head); if (unlikely(rsp->on_write_list)) { - PRINT_ERROR_PR("cmd already on write list (%x %x %x %x %u %u " + PRINT_ERROR("cmd already on write list (%x %x %x %x %u %u " "%u %u %u %u %u %d %d", cmnd_itt(rsp), cmnd_ttt(rsp), cmnd_opcode(rsp), cmnd_scsicode(rsp), rsp->r2t_sn, @@ -680,7 +680,7 @@ TRACE_DBG("%d(%d)", cmd_sn, session->exp_cmd_sn); if ((s32)(cmd_sn - session->exp_cmd_sn) >= 0) return 0; - PRINT_ERROR_PR("sequence error (%x,%x)", cmd_sn, session->exp_cmd_sn); + PRINT_ERROR("sequence error (%x,%x)", cmd_sn, session->exp_cmd_sn); return -ISCSI_REASON_PROTOCOL_ERROR; } @@ -778,7 +778,7 @@ list_del(&cmnd->hash_list_entry); cmnd->hashed = 0; } else { - PRINT_ERROR_PR("%p:%x not found", cmnd, cmnd_itt(cmnd)); + PRINT_ERROR("%p:%x not found", cmnd, cmnd_itt(cmnd)); } spin_unlock(&session->cmnd_hash_lock); @@ -838,7 +838,7 @@ rsp = get_rsp_cmnd(req); rsp_hdr = (struct iscsi_scsi_rsp_hdr *)&rsp->pdu.bhs; if (cmnd_opcode(rsp) != ISCSI_OP_SCSI_RSP) { - PRINT_ERROR_PR("unexpected response command %u", cmnd_opcode(rsp)); + PRINT_ERROR("unexpected response command %u", cmnd_opcode(rsp)); return; } @@ -878,7 +878,7 @@ if ((offset >= bufflen) || (offset + size > bufflen)) { - PRINT_ERROR_PR("Wrong ltn (%u %u %u)", offset, size, bufflen); + PRINT_ERROR("Wrong ltn (%u %u %u)", offset, size, bufflen); mark_conn_closed(conn); res = -EIO; goto out; @@ -910,7 +910,7 @@ size -= conn->read_iov[i].iov_len; offset = 0; if (++i >= ISCSI_CONN_IOV_MAX) { - PRINT_ERROR_PR("Initiator %s violated negotiated " + PRINT_ERROR("Initiator %s violated negotiated " "parameters by sending too much data (size " "left %d)", conn->session->initiator_name, size); mark_conn_closed(conn); @@ -1046,14 +1046,14 @@ * We don't request a NOP-Out by sending a NOP-In. * See 10.18.2 in the draft 20. */ - PRINT_ERROR_PR("initiator bug %x", cmnd_itt(cmnd)); + PRINT_ERROR("initiator bug %x", cmnd_itt(cmnd)); err = -ISCSI_REASON_PROTOCOL_ERROR; goto out; } if (cmnd_itt(cmnd) == cpu_to_be32(ISCSI_RESERVED_TAG)) { if (!(cmnd->pdu.bhs.opcode & ISCSI_OP_IMMEDIATE)) - PRINT_ERROR_PR("%s","initiator bug!"); + PRINT_ERROR("%s","initiator bug!"); spin_lock(&conn->session->sn_lock); __update_stat_sn(cmnd); err = check_cmd_sn(cmnd); @@ -1061,7 +1061,7 @@ if (err) goto out; } else if ((err = cmnd_insert_hash(cmnd)) < 0) { - PRINT_ERROR_PR("Can't insert in hash: ignore this request %x", + PRINT_ERROR("Can't insert in hash: ignore this request %x", cmnd_itt(cmnd)); goto out; } @@ -1183,7 +1183,7 @@ scst_cmd->queue_type = SCST_CMD_QUEUE_UNTAGGED; break; default: - PRINT_ERROR_PR("Unknown task code %x, use ORDERED instead", + PRINT_ERROR("Unknown task code %x, use ORDERED instead", req_hdr->flags & ISCSI_CMD_ATTR_MASK); scst_cmd->queue_type = SCST_CMD_QUEUE_ORDERED; break; @@ -1218,7 +1218,7 @@ dir = scst_cmd_get_data_direction(scst_cmd); if (dir != SCST_DATA_WRITE) { if (!(req_hdr->flags & ISCSI_CMD_FINAL) || req->pdu.datasize) { - PRINT_ERROR_PR("Unexpected unsolicited data (ITT %x " + PRINT_ERROR("Unexpected unsolicited data (ITT %x " "CDB %x", cmnd_itt(req), req_hdr->scb[0]); create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc); cmnd_prepare_skip_pdu_set_resid(req); @@ -1234,7 +1234,7 @@ req->sg = scst_cmd_get_sg(scst_cmd); req->bufflen = scst_cmd_get_bufflen(scst_cmd); if (req->r2t_length > req->bufflen) { - PRINT_ERROR_PR("req->r2t_length %d > req->bufflen %d", + PRINT_ERROR("req->r2t_length %d > req->bufflen %d", req->r2t_length, req->bufflen); req->r2t_length = req->bufflen; } @@ -1245,7 +1245,7 @@ if (!session->sess_param.immediate_data && req->pdu.datasize) { - PRINT_ERROR_PR("Initiator %s violated negotiated paremeters: " + PRINT_ERROR("Initiator %s violated negotiated paremeters: " "forbidden immediate data sent (ITT %x, op %x)", session->initiator_name, cmnd_itt(req), req_hdr->scb[0]); res = -EINVAL; @@ -1254,7 +1254,7 @@ if (session->sess_param.initial_r2t && !(req_hdr->flags & ISCSI_CMD_FINAL)) { - PRINT_ERROR_PR("Initiator %s violated negotiated paremeters: " + PRINT_ERROR("Initiator %s violated negotiated paremeters: " "initial R2T is required (ITT %x, op %x)", session->initiator_name, cmnd_itt(req), req_hdr->scb[0]); res = -EINVAL; @@ -1263,7 +1263,7 @@ if (req->pdu.datasize) { if (dir != SCST_DATA_WRITE) { - PRINT_ERROR_PR("pdu.datasize(%d) >0, but dir(%x) isn't WRITE", + PRINT_ERROR("pdu.datasize(%d) >0, but dir(%x) isn't WRITE", req->pdu.datasize, dir); create_sense_rsp(req, ABORTED_COMMAND, 0xc, 0xc); cmnd_prepare_skip_pdu_set_resid(req); @@ -1296,13 +1296,13 @@ cmnd->cmd_req = req = cmnd_find_hash(conn->session, req_hdr->itt, req_hdr->ttt); if (!req) { - PRINT_ERROR_PR("unable to find scsi task %x %x", + PRINT_ERROR("unable to find scsi task %x %x", cmnd_itt(cmnd), cmnd_ttt(cmnd)); goto skip_pdu; } if (req->r2t_length < cmnd->pdu.datasize) { - PRINT_ERROR_PR("Invalid data len %x %u %u", cmnd_itt(req), + PRINT_ERROR("Invalid data len %x %u %u", cmnd_itt(req), cmnd->pdu.datasize, req->r2t_length); mark_conn_closed(conn); res = -EINVAL; @@ -1310,7 +1310,7 @@ } if (req->r2t_length + offset != cmnd_write_size(req)) { - PRINT_ERROR_PR("Wrong cmd lengths (%x %u %u %u)", + PRINT_ERROR("Wrong cmd lengths (%x %u %u %u)", cmnd_itt(req), req->r2t_length, offset, cmnd_write_size(req)); mark_conn_closed(conn); @@ -1323,7 +1323,7 @@ /* Check unsolicited burst data */ if ((req_hdr->ttt == cpu_to_be32(ISCSI_RESERVED_TAG)) && (req->pdu.bhs.flags & ISCSI_FLG_FINAL)) { - PRINT_ERROR_PR("unexpected data from %x %x", + PRINT_ERROR("unexpected data from %x %x", cmnd_itt(cmnd), cmnd_ttt(cmnd)); mark_conn_closed(conn); res = -EINVAL; @@ -1380,7 +1380,7 @@ req->outstanding_r2t, req->r2t_length); /* ToDo : proper error handling */ if (!(req_hdr->flags & ISCSI_FLG_FINAL) && (req->r2t_length == 0)) - PRINT_ERROR_PR("initiator error %x", cmnd_itt(req)); + PRINT_ERROR("initiator error %x", cmnd_itt(req)); if (!(req_hdr->flags & ISCSI_FLG_FINAL)) goto out; @@ -1409,13 +1409,14 @@ if (cmnd->tmfabort) goto out; - TRACE(TRACE_MGMT, "Aborting cmd %p, scst_cmd %p (scst state %x, " - "itt %x, op %x, r2t_len %x, CDB op %x, size to write %u, " - "is_unsolicited_data %u, outstanding_r2t %u)", - cmnd, cmnd->scst_cmd, cmnd->scst_state, cmnd_itt(cmnd), - cmnd_opcode(cmnd), cmnd->r2t_length, cmnd_scsicode(cmnd), - cmnd_write_size(cmnd), cmnd->is_unsolicited_data, - cmnd->outstanding_r2t); + TRACE_MGMT_DBG("Aborting cmd %p, scst_cmd %p (scst state %x, " + "ref_cnt %d, net_ref_cnt %d, itt %x, op %x, r2t_len %x, " + "CDB op %x, size to write %u, is_unsolicited_data %u, " + "outstanding_r2t %u)", cmnd, cmnd->scst_cmd, cmnd->scst_state, + atomic_read(&cmnd->ref_cnt), atomic_read(&cmnd->net_ref_cnt), + cmnd_itt(cmnd), cmnd_opcode(cmnd), cmnd->r2t_length, + cmnd_scsicode(cmnd), cmnd_write_size(cmnd), + cmnd->is_unsolicited_data, cmnd->outstanding_r2t); iscsi_extracheck_is_rd_thread(cmnd->conn); @@ -1452,7 +1453,7 @@ struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd); if (req_hdr->lun != hdr->lun) { - PRINT_ERROR_PR("ABORT TASK: LUN mismatch: req LUN " + PRINT_ERROR("ABORT TASK: LUN mismatch: req LUN " "%Lx, cmd LUN %Lx, rtt %u", req_hdr->lun, hdr->lun, req_hdr->rtt); err = ISCSI_RESPONSE_FUNCTION_REJECTED; @@ -1461,7 +1462,7 @@ if (before(req_hdr->cmd_sn, hdr->cmd_sn) || (req_hdr->cmd_sn == hdr->cmd_sn)) { - PRINT_ERROR_PR("ABORT TASK: SN mismatch: req SN %x, " + PRINT_ERROR("ABORT TASK: SN mismatch: req SN %x, " "cmd SN %x, rtt %u", req_hdr->cmd_sn, hdr->cmd_sn, req_hdr->rtt); err = ISCSI_RESPONSE_FUNCTION_REJECTED; @@ -1587,7 +1588,7 @@ if ((function != ISCSI_FUNCTION_ABORT_TASK) && (req_hdr->rtt != ISCSI_RESERVED_TAG)) { - PRINT_ERROR_PR("Invalid RTT %x (TM fn %x)", req_hdr->rtt, + PRINT_ERROR("Invalid RTT %x (TM fn %x)", req_hdr->rtt, function); err = -1; goto reject; @@ -1717,7 +1718,7 @@ struct iscsi_cmnd *rsp; struct iscsi_logout_rsp_hdr *rsp_hdr; - PRINT_INFO_PR("Logout received from initiator %s", + PRINT_INFO("Logout received from initiator %s", req->conn->session->initiator_name); TRACE_DBG("%p", req); @@ -1765,7 +1766,7 @@ req_cmnd_release(cmnd); break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); req_cmnd_release(cmnd); break; } @@ -1866,7 +1867,7 @@ cmnd_send_pdu(conn, cmnd); break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); break; } @@ -1894,13 +1895,13 @@ case ISCSI_OP_LOGOUT_RSP: break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); sBUG(); break; } if (cmnd->should_close_conn) { - PRINT_INFO_PR("Closing connection at initiator %s request", + PRINT_INFO("Closing connection at initiator %s request", conn->session->initiator_name); mark_conn_closed(conn); } @@ -1953,12 +1954,12 @@ } else { cmnd->pending = 1; if (before(cmd_sn, session->exp_cmd_sn)) { /* close the conn */ - PRINT_ERROR_PR("unexpected cmd_sn (%u,%u)", cmd_sn, + PRINT_ERROR("unexpected cmd_sn (%u,%u)", cmd_sn, session->exp_cmd_sn); } if (after(cmd_sn, session->exp_cmd_sn + session->max_queued_cmnds)) { - PRINT_ERROR_PR("too large cmd_sn (%u,%u)", cmd_sn, + PRINT_ERROR("too large cmd_sn (%u,%u)", cmd_sn, session->exp_cmd_sn); } @@ -1983,7 +1984,7 @@ struct iscsi_session *session = conn->session; if (cmnd->pdu.datasize > session->sess_param.max_recv_data_length) { - PRINT_ERROR_PR("Initiator %s violated negotiated parameters: " + PRINT_ERROR("Initiator %s violated negotiated parameters: " "data too long (ITT %x, datasize %u, " "max_recv_data_length %u", session->initiator_name, cmnd_itt(cmnd), cmnd->pdu.datasize, @@ -2040,7 +2041,7 @@ if (unlikely(rc < 0)) { struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd); - PRINT_ERROR_PR("Error %d (iSCSI opcode %x, ITT %x, op %x)", rc, + PRINT_ERROR("Error %d (iSCSI opcode %x, ITT %x, op %x)", rc, cmnd_opcode(cmnd), cmnd_itt(cmnd), (cmnd_opcode(cmnd) == ISCSI_OP_SCSI_CMD ? hdr->scb[0] : -1)); @@ -2082,7 +2083,7 @@ req_cmnd_release(cmnd); break; default: - PRINT_ERROR_PR("unexpected cmnd op %x", cmnd_opcode(cmnd)); + PRINT_ERROR("unexpected cmnd op %x", cmnd_opcode(cmnd)); req_cmnd_release(cmnd); break; } @@ -2240,7 +2241,7 @@ resp_flags, req->bufflen, req->sg); if ((req->bufflen != 0) && !(resp_flags & SCST_TSC_FLAG_STATUS)) { - PRINT_ERROR_PR("%s", "Sending DATA without STATUS is unsupported"); + PRINT_ERROR("%s", "Sending DATA without STATUS is unsupported"); scst_set_cmd_error(scst_cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); resp_flags = scst_cmd_get_tgt_resp_flags(scst_cmd); @@ -2313,7 +2314,7 @@ (struct iscsi_task_mgt_hdr *)&req->pdu.bhs; struct iscsi_task_rsp_hdr *rsp_hdr; - TRACE(TRACE_MGMT, "req %p, status %d", req, status); + TRACE(TRACE_MGMT, "TM req %p finished, status %d", req, status); rsp = iscsi_cmnd_create_rsp_cmnd(req); rsp_hdr = (struct iscsi_task_rsp_hdr *)&rsp->pdu.bhs; @@ -2360,7 +2361,7 @@ scst_mgmt_cmd_get_tgt_priv(scst_mcmd); int status = iscsi_get_mgmt_response(scst_mgmt_cmd_get_status(scst_mcmd)); - TRACE(TRACE_MGMT, "scst_mcmd %p, status %d", scst_mcmd, + TRACE_MGMT_DBG("req %p, scst_mcmd %p, scst status %d", req, scst_mcmd, scst_mgmt_cmd_get_status(scst_mcmd)); iscsi_send_task_mgmt_resp(req, status); @@ -2408,13 +2409,13 @@ thr = kmalloc(sizeof(*thr), GFP_KERNEL); if (!thr) { res = -ENOMEM; - PRINT_ERROR_PR("Failed to allocate thr %d", res); + PRINT_ERROR("Failed to allocate thr %d", res); goto out; } thr->thr = kthread_run(fn, NULL, "%s%d", name, i); if (IS_ERR(thr->thr)) { res = PTR_ERR(thr->thr); - PRINT_ERROR_PR("kthread_create() failed: %d", res); + PRINT_ERROR("kthread_create() failed: %d", res); kfree(thr); goto out; } @@ -2445,17 +2446,17 @@ int err; int num; - PRINT_INFO_PR("iSCSI SCST Target - version %s", ISCSI_VERSION_STRING); + PRINT_INFO("iSCSI SCST Target - version %s", ISCSI_VERSION_STRING); #ifdef NET_PAGE_CALLBACKS_DEFINED err = net_set_get_put_page_callbacks(iscsi_get_page_callback, iscsi_put_page_callback); if (err != 0) { - PRINT_INFO_PR("Unable to set page callbackes: %d", err); + PRINT_INFO("Unable to set page callbackes: %d", err); goto out; } #else - PRINT_INFO_PR("%s", "Patch put_page_callback-<kernel-version>.patch " + PRINT_INFO("%s", "Patch put_page_callback-<kernel-version>.patch " "not applied on your kernel. Running in the performance " "degraded mode. Refer README file for details"); #endif @@ -2463,7 +2464,7 @@ BUILD_BUG_ON(MAX_DATA_SEG_LEN != (ISCSI_CONN_IOV_MAX<<PAGE_SHIFT)); if ((ctr_major = register_chrdev(0, ctr_name, &ctr_fops)) < 0) { - PRINT_ERROR_PR("failed to register the control device %d", ctr_major); + PRINT_ERROR("failed to register the control device %d", ctr_major); err = ctr_major; goto out_callb; } Modified: trunk/iscsi-scst/kernel/iscsi_dbg.h =================================================================== --- trunk/iscsi-scst/kernel/iscsi_dbg.h 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/iscsi_dbg.h 2007-11-01 17:07:07 UTC (rev 214) @@ -16,6 +16,8 @@ #ifndef ISCSI_DBG_H #define ISCSI_DBG_H +#define LOG_PREFIX "iscsi-scst" + #include <scst_debug.h> #define TRACE_D_READ 0x80000000 @@ -23,20 +25,18 @@ #define TRACE_CONN_OC 0x20000000 #define TRACE_D_IOV 0x10000000 #define TRACE_D_DUMP_PDU 0x08000000 +#define TRACE_NET_PG 0x04000000 #define TRACE_D_DATA (TRACE_D_READ | TRACE_D_WRITE) #define TRACE_ALL_NO_DATA (TRACE_ALL & ~TRACE_D_IOV & ~TRACE_D_DUMP_PDU & ~TRACE_D_DATA) -#define LOG_PREFIX "iscsi-scst" - #ifdef DEBUG #define ISCSI_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_LINE | TRACE_PID | \ TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_DEBUG | \ TRACE_MINOR | TRACE_SPECIAL | TRACE_CONN_OC) #else -#define ISCSI_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_PID | \ - TRACE_OUT_OF_MEM | TRACE_MGMT | \ +#define ISCSI_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ TRACE_MINOR | TRACE_SPECIAL) #endif @@ -59,7 +59,8 @@ if (trace_flag & TRACE_CONN_OC) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -67,8 +68,23 @@ } \ } while(0) +#define TRACE_NET_PAGE(format, args...) \ +do { \ + if (trace_flag & TRACE_NET_PG) \ + { \ + char *__tflag = LOG_FLAG; \ + if (debug_print_prefix(trace_flag, LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ + { \ + __tflag = NO_FLAG; \ + } \ + PRINT(NO_FLAG, "%s" format, __tflag, args); \ + } \ +} while(0) + #else /* defined(DEBUG) || defined(TRACING) */ #define TRACE_CONN_CLOSE(format, args...) {} +#define TRACE_NET_PAGE(format, args...) {} #endif #endif Modified: trunk/iscsi-scst/kernel/nthread.c =================================================================== --- trunk/iscsi-scst/kernel/nthread.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/nthread.c 2007-11-01 17:07:07 UTC (rev 214) @@ -62,7 +62,7 @@ TRACE_ENTRY(); - TRACE_CONN_CLOSE("conn %p, conn_ref_cnt=%d", conn, + TRACE_CONN_CLOSE("Closing connection %p (conn_ref_cnt=%d)", conn, atomic_read(&conn->conn_ref_cnt)); iscsi_extracheck_is_rd_thread(conn); @@ -86,8 +86,8 @@ struct list_head *pending_list = &session->pending_list; struct iscsi_cmnd *tmp; - TRACE_CONN_CLOSE("Disposing pending commands on conn " - "%p, conn_ref_cnt=%d", conn, + TRACE_CONN_CLOSE("Disposing pending commands on " + "connection %p (conn_ref_cnt=%d)", conn, atomic_read(&conn->conn_ref_cnt)); list_for_each_entry_safe(cmnd, tmp, pending_list, @@ -172,7 +172,7 @@ msleep(50); } - TRACE_CONN_CLOSE("Notifying user space about closing conn %p", conn); + TRACE_CONN_CLOSE("Notifying user space about closing connection %p", conn); event_send(target->tid, session->sid, conn->cid, E_CONN_CLOSE, 0); mutex_lock(&target->target_mutex); @@ -248,7 +248,7 @@ "conn %p", res, conn); break; default: - PRINT_ERROR_PR("sock_recvmsg() failed: %d", res); + PRINT_ERROR("sock_recvmsg() failed: %d", res); mark_conn_closed(conn); break; } @@ -283,7 +283,7 @@ int res = digest_rx_header(cmnd); if (unlikely(res != 0)) { - PRINT_ERROR_PR("rx header digest for initiator %s failed " + PRINT_ERROR("rx header digest for initiator %s failed " "(%d)", conn->session->initiator_name, res); mark_conn_closed(conn); } @@ -397,7 +397,7 @@ } break; default: - PRINT_ERROR_PR("%d %x", conn->read_state, cmnd_opcode(cmnd)); + PRINT_ERROR("%d %x", conn->read_state, cmnd_opcode(cmnd)); sBUG(); } @@ -408,7 +408,7 @@ goto out; if (conn->read_size) { - PRINT_ERROR_PR("%d %x %d", res, cmnd_opcode(cmnd), conn->read_size); + PRINT_ERROR("%d %x %d", res, cmnd_opcode(cmnd), conn->read_size); sBUG(); } @@ -540,13 +540,13 @@ struct iscsi_cmnd *cmd = (struct iscsi_cmnd*)page->net_priv; int v; - TRACE_DBG("cmd %p, page %p, _count %d, new net_ref_cnt %d", + TRACE_NET_PAGE("cmd %p, page %p, _count %d, new net_ref_cnt %d", cmd, page, atomic_read(&page->_count), atomic_read(&cmd->net_ref_cnt)+1); v = atomic_inc_return(&cmd->net_ref_cnt); if (v == 1) { - TRACE_DBG("getting cmd %p for page %p", cmd, page); + TRACE_NET_PAGE("getting cmd %p for page %p", cmd, page); cmnd_get(cmd); } } @@ -555,19 +555,30 @@ { struct iscsi_cmnd *cmd = (struct iscsi_cmnd*)page->net_priv; - TRACE_DBG("cmd %p, page %p, _count %d, new net_ref_cnt %d", + TRACE_NET_PAGE("cmd %p, page %p, _count %d, new net_ref_cnt %d", cmd, page, atomic_read(&page->_count), atomic_read(&cmd->net_ref_cnt)-1); if (atomic_dec_and_test(&cmd->net_ref_cnt)) { int i, sg_cnt = get_pgcnt(cmd->bufflen, cmd->sg[0].offset); for(i = 0; i < sg_cnt; i++) { - TRACE_DBG("Clearing page %p", cmd->sg[i].page); + TRACE_NET_PAGE("Clearing page %p", cmd->sg[i].page); cmd->sg[i].page->net_priv = NULL; } cmnd_put(cmd); } } + +static void check_net_priv(struct iscsi_cmnd *cmd, struct page *page) +{ + if (atomic_read(&cmd->net_ref_cnt) == 0) { + TRACE_DBG("%s", "sendpage() not called get_page(), " + "zeroing net_priv"); + page->net_priv = NULL; + } +} +#else +static inline void check_net_priv(struct iscsi_cmnd *cmd, struct page *page) {} #endif /* This is partially taken from the Ardis code. */ @@ -607,7 +618,7 @@ set_fs(KERNEL_DS); res = vfs_writev(file, (struct iovec __user *)iop, count, &off); set_fs(oldfs); - TRACE(TRACE_D_DATA, "%#Lx:%u: %d(%ld)", + TRACE(TRACE_D_WRITE, "%#Lx:%u: %d(%ld)", (unsigned long long) conn->session->sid, conn->cid, res, (long) iop->iov_len); if (unlikely(res <= 0)) { @@ -642,7 +653,7 @@ sg = write_cmnd->sg; if (sg == NULL) { - PRINT_ERROR_PR("%s", "warning data missing!"); + PRINT_ERROR("%s", "warning data missing!"); return 0; } offset = conn->write_offset; @@ -667,7 +678,7 @@ #ifdef NET_PAGE_CALLBACKS_DEFINED if (unlikely((sg[idx].page->net_priv != NULL) && (sg[idx].page->net_priv != ref_cmd))) { - PRINT_ERROR_PR("net_priv isn't NULL and != ref_cmd " + PRINT_ERROR("net_priv isn't NULL and != ref_cmd " "(write_cmnd %p, ref_cmd %p, sg %p, idx %d, " "net_priv %p)", write_cmnd, ref_cmd, sg, idx, sg[idx].page->net_priv); @@ -679,7 +690,7 @@ if (size <= sendsize) { retry2: res = sendpage(sock, sg[idx].page, offset, size, flags); - TRACE(TRACE_D_DATA, "%s %#Lx:%u: %d(%lu,%u,%u)", + TRACE(TRACE_D_WRITE, "%s %#Lx:%u: %d(%lu,%u,%u)", sock->ops->sendpage ? "sendpage" : "sock_no_sendpage", (unsigned long long)conn->session->sid, conn->cid, res, sg[idx].page->index, offset, size); @@ -689,13 +700,7 @@ else goto out_res; } -#ifdef NET_PAGE_CALLBACKS_DEFINED - if (atomic_read(&ref_cmd->net_ref_cnt) == 0) { - TRACE_DBG("%s", "sendpage() not called " - "get_page(), zeroing net_priv"); - sg[idx].page->net_priv = NULL; - } -#endif + check_net_priv(ref_cmd, sg[idx].page); if (res == size) { conn->write_size = 0; return saved_size; @@ -708,7 +713,7 @@ retry1: res = sendpage(sock, sg[idx].page, offset, sendsize, flags | MSG_MORE); - TRACE(TRACE_D_DATA, "%s %#Lx:%u: %d(%lu,%u,%u)", + TRACE(TRACE_D_WRITE, "%s %#Lx:%u: %d(%lu,%u,%u)", sock->ops->sendpage ? "sendpage" : "sock_no_sendpage", (unsigned long long ) conn->session->sid, conn->cid, res, sg[idx].page->index, offset, sendsize); @@ -718,13 +723,7 @@ else goto out_res; } -#ifdef NET_PAGE_CALLBACKS_DEFINED - if (atomic_read(&ref_cmd->net_ref_cnt) == 0) { - TRACE_DBG("%s", "sendpage() not called get_page(), " - "zeroing net_priv"); - sg[idx].page->net_priv = NULL; - } -#endif + check_net_priv(ref_cmd, sg[idx].page); if (res == sendsize) { idx++; offset = 0; @@ -742,12 +741,7 @@ return saved_size - size; out_res: -#ifdef NET_PAGE_CALLBACKS_DEFINED - if (atomic_read(&ref_cmd->net_ref_cnt) == 0) { - TRACE_DBG("sendpage() returned %d, zeroing net_priv", res); - sg[idx].page->net_priv = NULL; - } -#endif + check_net_priv(ref_cmd, sg[idx].page); if (res == -EAGAIN) goto out; /* else go through */ @@ -757,7 +751,7 @@ if (!conn->closing) #endif { - PRINT_ERROR_PR("error %d at sid:cid %#Lx:%u, cmnd %p", res, + PRINT_ERROR("error %d at sid:cid %#Lx:%u, cmnd %p", res, (unsigned long long)conn->session->sid, conn->cid, conn->write_cmnd); } @@ -778,7 +772,7 @@ if (!conn->closing) #endif { - PRINT_ERROR_PR("Sending data failed: initiator %s, " + PRINT_ERROR("Sending data failed: initiator %s, " "write_size %d, write_state %d, res %d", conn->session->initiator_name, conn->write_size, conn->write_state, res); @@ -892,7 +886,7 @@ res = tx_ddigest(cmnd, TX_END); break; default: - PRINT_ERROR_PR("%d %d %x", res, conn->write_state, + PRINT_ERROR("%d %d %x", res, conn->write_state, cmnd_opcode(cmnd)); sBUG(); } @@ -904,7 +898,7 @@ goto out; if (conn->write_size) { - PRINT_ERROR_PR("%d %x %u", res, cmnd_opcode(cmnd), + PRINT_ERROR("%d %x %u", res, cmnd_opcode(cmnd), conn->write_size); sBUG(); } Modified: trunk/iscsi-scst/kernel/param.c =================================================================== --- trunk/iscsi-scst/kernel/param.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/param.c 2007-11-01 17:07:07 UTC (rev 214) @@ -21,7 +21,7 @@ if (!info->partial || (info->partial & 1 << key_##word)) \ if (iparam[key_##word] < min || \ iparam[key_##word] > max) { \ - PRINT_ERROR_PR("%s: %u is out of range (%u %u)",\ + PRINT_ERROR("%s: %u is out of range (%u %u)",\ #word, iparam[key_##word], min, max); \ iparam[key_##word] = min; \ } \ @@ -63,21 +63,21 @@ static void log_params(struct iscsi_sess_param *param) { - PRINT_INFO_PR("Negotiated parameters: InitialR2T %s, ImmediateData %s, " + PRINT_INFO("Negotiated parameters: InitialR2T %s, ImmediateData %s, " "MaxConnections %d, MaxRecvDataSegmentLength %d, " "MaxXmitDataSegmentLength %d, ", get_bool_name(param->initial_r2t), get_bool_name(param->immediate_data), param->max_connections, param->max_recv_data_length, param->max_xmit_data_length); - PRINT_INFO_PR(" MaxBurstLength %d, FirstBurstLength %d, " + PRINT_INFO(" MaxBurstLength %d, FirstBurstLength %d, " "DefaultTime2Wait %d, DefaultTime2Retain %d, ", param->max_burst_length, param->first_burst_length, param->default_wait_time, param->default_retain_time); - PRINT_INFO_PR(" MaxOutstandingR2T %d, DataPDUInOrder %s, " + PRINT_INFO(" MaxOutstandingR2T %d, DataPDUInOrder %s, " "DataSequenceInOrder %s, ErrorRecoveryLevel %d, ", param->max_outstanding_r2t, get_bool_name(param->data_pdu_inorder), get_bool_name(param->data_sequence_inorder), param->error_recovery_level); - PRINT_INFO_PR(" HeaderDigest %s, DataDigest %s, OFMarker %s, " + PRINT_INFO(" HeaderDigest %s, DataDigest %s, OFMarker %s, " "IFMarker %s, OFMarkInt %d, IFMarkInt %d", get_digest_name(param->header_digest), get_digest_name(param->data_digest), @@ -191,7 +191,7 @@ trgt_param_set(target, info); prm = &target->trgt_param; - PRINT_INFO_PR("Target parameter changed: queued_cmnds %d", + PRINT_INFO("Target parameter changed: queued_cmnds %d", prm->queued_cmnds); } else trgt_param_get(&target->trgt_param, info); Modified: trunk/iscsi-scst/kernel/session.c =================================================================== --- trunk/iscsi-scst/kernel/session.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/session.c 2007-11-01 17:07:07 UTC (rev 214) @@ -84,7 +84,7 @@ session->scst_sess = scst_register_session(target->scst_tgt, 0, name, NULL, NULL); if (session->scst_sess == NULL) { - PRINT_ERROR_PR("%s", "scst_register_session() failed"); + PRINT_ERROR("%s", "scst_register_session() failed"); err = -ENOMEM; goto err; } @@ -151,7 +151,7 @@ return -ENOENT; if (!list_empty(&session->conn_list)) { - PRINT_ERROR_PR("%llu still have connections", + PRINT_ERROR("%llu still have connections", (unsigned long long)session->sid); return -EBUSY; } Modified: trunk/iscsi-scst/kernel/target.c =================================================================== --- trunk/iscsi-scst/kernel/target.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/iscsi-scst/kernel/target.c 2007-11-01 17:07:07 UTC (rev 214) @@ -88,12 +88,12 @@ TRACE_MGMT_DBG("Creating target tid %u, name %s", tid, name); if (!(len = strlen(name))) { - PRINT_ERROR_PR("The length of the target name is zero %u", tid); + PRINT_ERROR("The length of the target name is zero %u", tid); goto out; } if (!try_module_get(THIS_MODULE)) { - PRINT_ERROR_PR("Fail to get module %u", tid); + PRINT_ERROR("Fail to get module %u", tid); goto out; } @@ -118,7 +118,7 @@ target->scst_tgt = scst_register(&iscsi_template, target->name); if (!target->scst_tgt) { - PRINT_ERROR_PR("%s", "scst_register() failed"); + PRINT_ERROR("%s", "scst_register() failed"); goto out_free; } @@ -216,7 +216,7 @@ TRACE_ENTRY(); - TRACE(TRACE_MGMT, "%s", "Deleting all targets"); + TRACE_MGMT_DBG("%s", "Deleting all targets"); /* Complete brain damage, ToDo */ while(1) { Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-11-01 17:07:07 UTC (rev 214) @@ -53,8 +53,8 @@ TRACE_MINOR | TRACE_SPECIAL) #else # ifdef TRACING -#define Q2T_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_PID | \ - TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MINOR | TRACE_SPECIAL) +#define Q2T_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MINOR | \ + TRACE_SPECIAL) # endif #endif Modified: trunk/qla2x00t-full_perf.patch =================================================================== --- trunk/qla2x00t-full_perf.patch 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/qla2x00t-full_perf.patch 2007-11-01 17:07:07 UTC (rev 214) @@ -1,17 +1,16 @@ Index: qla2x00t/qla2x00-target/Makefile =================================================================== ---- qla2x00t/qla2x00-target/Makefile (revision 324) +--- qla2x00t/qla2x00-target/Makefile (revision 213) +++ qla2x00t/qla2x00-target/Makefile (working copy) -@@ -35,10 +35,10 @@ INSTALL_DIR := /lib/modules/$(shell unam +@@ -35,9 +35,9 @@ EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_T - EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT -Wextra -Wno-unused-parameter + INSTALL_DIR := /lib/modules/$(shell uname -r)/extra -EXTRA_CFLAGS += -DEXTRACHECKS +#EXTRA_CFLAGS += -DEXTRACHECKS #EXTRA_CFLAGS += -DTRACING - -EXTRA_CFLAGS += -DDEBUG_TGT -g +#EXTRA_CFLAGS += -DDEBUG_TGT -g #EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD - #EXTRA_CFLAGS += -DDEBUG_SRR + ifeq ($(KVER),) Modified: trunk/qla2x00t-release.patch =================================================================== --- trunk/qla2x00t-release.patch 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/qla2x00t-release.patch 2007-11-01 17:07:07 UTC (rev 214) @@ -1,18 +1,17 @@ Index: qla2x00t/qla2x00-target/Makefile =================================================================== ---- qla2x00t/qla2x00-target/Makefile (revision 324) +--- qla2x00t/qla2x00-target/Makefile (revision 213) +++ qla2x00t/qla2x00-target/Makefile (working copy) -@@ -35,10 +35,10 @@ INSTALL_DIR := /lib/modules/$(shell unam +@@ -35,9 +35,9 @@ EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_T - EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT -Wextra -Wno-unused-parameter + INSTALL_DIR := /lib/modules/$(shell uname -r)/extra -EXTRA_CFLAGS += -DEXTRACHECKS -#EXTRA_CFLAGS += -DTRACING +-EXTRA_CFLAGS += -DDEBUG_TGT -g +#EXTRA_CFLAGS += -DEXTRACHECKS +EXTRA_CFLAGS += -DTRACING - --EXTRA_CFLAGS += -DDEBUG_TGT -g +#EXTRA_CFLAGS += -DDEBUG_TGT -g #EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD - #EXTRA_CFLAGS += -DDEBUG_SRR + ifeq ($(KVER),) Modified: trunk/scst/include/scst_debug.h =================================================================== --- trunk/scst/include/scst_debug.h 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/include/scst_debug.h 2007-11-01 17:07:07 UTC (rev 214) @@ -125,9 +125,16 @@ #define PRINT(log_flag, format, args...) printk(log_flag format "\n", ## args); #define PRINTN(log_flag, format, args...) printk(log_flag format, ## args); +#ifdef LOG_PREFIX +#define __LOG_PREFIX LOG_PREFIX +#else +#define __LOG_PREFIX NULL +#endif + #if defined(DEBUG) || defined(TRACING) -extern int debug_print_prefix(unsigned long trace_flag, const char *func, int line); +extern int debug_print_prefix(unsigned long trace_flag, const char *prefix, + const char *func, int line); extern void debug_print_buffer(const void *data, int len); #define TRACE(trace, format, args...) \ @@ -135,7 +142,8 @@ if (trace_flag & (trace)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -148,7 +156,8 @@ char *__tflag = log_flag; \ if (trace_flag & (trace)) \ { \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -161,7 +170,8 @@ if (trace_flag & TRACE_BUFF) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -175,7 +185,8 @@ if (trace_flag & (flag)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -199,7 +210,8 @@ if (trace_flag & TRACE_MEMORY) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -212,7 +224,8 @@ if (trace_flag & TRACE_DEBUG) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -225,7 +238,8 @@ if (trace_flag & (TRACE_DEBUG|TRACE_SPECIAL)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -238,7 +252,8 @@ if (trace_flag & TRACE_MGMT_DEBUG) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -251,7 +266,8 @@ if (trace_flag & (TRACE_MGMT_DEBUG|TRACE_SPECIAL)) \ { \ char *__tflag = LOG_FLAG; \ - if (debug_print_prefix(trace_flag, __FUNCTION__, __LINE__) > 0) \ + if (debug_print_prefix(trace_flag, __LOG_PREFIX, __FUNCTION__, \ + __LINE__) > 0) \ { \ __tflag = NO_FLAG; \ } \ @@ -259,28 +275,6 @@ } \ } while(0) -#define PRINT_ERROR_PR(format, args...) \ -do { \ - if (ERROR_FLAG != LOG_FLAG) \ - { \ - TRACE_LOG_FLAG(LOG_FLAG, trace_flag, "%s: ***ERROR*** " format, \ - LOG_PREFIX, args); \ - } \ - TRACE_LOG_FLAG(ERROR_FLAG, trace_flag, "%s: ***ERROR*** " format, \ - LOG_PREFIX, args); \ -} while(0) - -#define PRINT_INFO_PR(format, args...) \ -do { \ - if (INFO_FLAG != LOG_FLAG) \ - { \ - TRACE_LOG_FLAG(LOG_FLAG, trace_flag, "%s: " \ - format, LOG_PREFIX, args); \ - } \ - TRACE_LOG_FLAG(INFO_FLAG, trace_flag, "%s: " \ - format, LOG_PREFIX, args); \ -} while(0) - #define PRINT_ERROR(format, args...) \ do { \ if (ERROR_FLAG != LOG_FLAG) \ @@ -375,17 +369,21 @@ #define TRACE_EXIT_RES(res) {} #define TRACE_EXIT_HRES(res) {} -#define PRINT_INFO_PR(format, args...) \ +#ifdef LOG_PREFIX + +#define PRINT_INFO(format, args...) \ do { \ PRINT(INFO_FLAG, "%s: " format, LOG_PREFIX, args); \ } while(0) -#define PRINT_ERROR_PR(format, args...) \ +#define PRINT_ERROR(format, args...) \ do { \ PRINT(ERROR_FLAG, "%s: ***ERROR*** " \ format, LOG_PREFIX, args); \ } while(0) +#else + #define PRINT_INFO(format, args...) \ do { \ PRINT(INFO_FLAG, format, args); \ @@ -397,6 +395,8 @@ format, args); \ } while(0) +#endif /* LOG_PREFIX */ + #endif /* DEBUG */ #if defined(DEBUG) && defined(CONFIG_DEBUG_SLAB) Modified: trunk/scst/src/dev_handlers/scst_cdrom.c =================================================================== --- trunk/scst/src/dev_handlers/scst_cdrom.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_cdrom.c 2007-11-01 17:07:07 UTC (rev 214) @@ -80,7 +80,7 @@ if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } @@ -123,7 +123,7 @@ break; } if (!--retries) { - PRINT_ERROR_PR("UA not clear after %d retries", + PRINT_ERROR("UA not clear after %d retries", SCST_DEV_UA_RETRIES); params->block_shift = CDROM_DEF_BLOCK_SHIFT; // res = -ENODEV; Modified: trunk/scst/src/dev_handlers/scst_changer.c =================================================================== --- trunk/scst/src/dev_handlers/scst_changer.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_changer.c 2007-11-01 17:07:07 UTC (rev 214) @@ -65,7 +65,7 @@ if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } Modified: trunk/scst/src/dev_handlers/scst_dev_handler.h =================================================================== --- trunk/scst/src/dev_handlers/scst_dev_handler.h 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_dev_handler.h 2007-11-01 17:07:07 UTC (rev 214) @@ -18,7 +18,8 @@ TRACE_LINE | TRACE_FUNCTION | TRACE_MGMT | TRACE_MINOR | \ TRACE_MGMT_DEBUG | TRACE_SPECIAL) #else -#define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MINOR) +#define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ + TRACE_MINOR | TRACE_SPECIAL) #endif static unsigned long dh_trace_flag = SCST_DEFAULT_DEV_LOG_FLAGS; @@ -72,7 +73,7 @@ p = scst_create_proc_entry(root, DEV_HANDLER_LOG_ENTRY_NAME, &dev_handler_log_proc_data); if (p == NULL) { - PRINT_ERROR_PR("Not enough memory to register dev " + PRINT_ERROR("Not enough memory to register dev " "handler %s entry %s in /proc", dev_type->name, DEV_HANDLER_LOG_ENTRY_NAME); res = -ENOMEM; Modified: trunk/scst/src/dev_handlers/scst_disk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_disk.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_disk.c 2007-11-01 17:07:07 UTC (rev 214) @@ -156,7 +156,7 @@ if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } @@ -199,7 +199,7 @@ break; } if (!--retries) { - PRINT_ERROR_PR("UA not clear after %d retries", + PRINT_ERROR("UA not clear after %d retries", SCST_DEV_UA_RETRIES); res = -ENODEV; goto out_free_buf; Modified: trunk/scst/src/dev_handlers/scst_modisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_modisk.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_modisk.c 2007-11-01 17:07:07 UTC (rev 214) @@ -156,7 +156,7 @@ if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } @@ -211,7 +211,7 @@ break; } if (!--retries) { - PRINT_ERROR_PR("UA not clear after %d retries", + PRINT_ERROR("UA not clear after %d retries", SCST_DEV_UA_RETRIES); goto out_free_buf; } Modified: trunk/scst/src/dev_handlers/scst_processor.c =================================================================== --- trunk/scst/src/dev_handlers/scst_processor.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_processor.c 2007-11-01 17:07:07 UTC (rev 214) @@ -65,7 +65,7 @@ if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } Modified: trunk/scst/src/dev_handlers/scst_raid.c =================================================================== --- trunk/scst/src/dev_handlers/scst_raid.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_raid.c 2007-11-01 17:07:07 UTC (rev 214) @@ -65,7 +65,7 @@ if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } Modified: trunk/scst/src/dev_handlers/scst_tape.c =================================================================== --- trunk/scst/src/dev_handlers/scst_tape.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_tape.c 2007-11-01 17:07:07 UTC (rev 214) @@ -158,7 +158,7 @@ if (dev->scsi_dev == NULL || dev->scsi_dev->type != dev->handler->type) { - PRINT_ERROR_PR("%s", "SCSI device not define or illegal type"); + PRINT_ERROR("%s", "SCSI device not define or illegal type"); res = -ENODEV; goto out; } Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2007-10-26 15:58:50 UTC (rev 213) +++ trunk/scst/src/dev_handlers/scst_user.c 2007-11-01 17:07:07 UTC (rev 214) @@ -236,7 +236,7 @@ static void __dev_user_not_reg(void) { - PRINT_ERROR_PR("%s", "Device not registered"); + PRINT_ERROR("%s", "Device not registered"); return; } @@ -728,7 +728,7 @@ return res; out_invalid: - PRINT_ERROR_PR("PARSE failed (ucmd %p, rc %d, invalid %d)", ucmd, rc, + PRINT_ERROR("PARSE failed (ucmd %p, rc %d, invalid %d)", ucmd, rc, info_cdb->flags & SCST_INFO_INVALID); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode)); @@ -942,7 +942,7 @@ "active (ucmd %p)", ucmd); break; } else { - TRACE(TRACE_MGMT, "Pre unreg sess %p " + TRACE_MGMT_DBG("Pre unreg sess %p " "active (ucmd %p)", found, ucmd); } } @@ -1047,7 +1047,7 @@ goto out; out_unmap: - PRINT_ERROR_PR("Failed to get %d user pages (rc %d)", + PRINT_ERROR("Failed to get %d user pages (rc %d)", ucmd->num_data_pages, rc); if (rc > 0) { for(i = 0; i < rc; i++) @@ -1074,7 +1074,7 @@ int pages; if (ucmd->buff_cached) { if (unlikely((reply->alloc_reply.pbuf & ~PAGE_MASK) != 0)) { - PRINT_ERROR_PR("Supplied pbuf %Lx isn't " + PRINT_ERROR("Supplied pbuf %Lx isn't " "page aligned", reply->alloc_reply.pbuf); goto out_hwerr; } @@ -1141,7 +1141,7 @@ return res; out_inval: - PRINT_ERROR_PR("%s", "Invalid parse_reply parameter(s)"); + PRINT_ERROR("%s", "Invalid parse_reply parameter(s)"); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); res = -EINVAL; goto out_process; @@ -1220,7 +1220,7 @@ goto out_busy; if (ucmd->buff_cached) { if (unlikely((ereply->pbuf & ~PAGE_MASK) != 0)) { - PRINT_ERROR_PR("Supplied pbuf %Lx isn't " + PRINT_ERROR("Supplied pbuf %Lx isn't " "page aligned", ereply->pbuf); goto out_hwerr; } @@ -1252,7 +1252,7 @@ min(sizeof(cmd->sense_buffer), (unsigned int)ereply->sense_len)); if (res < 0) { - PRINT_ERROR_PR("%s", "Unable to get sense data"); + PRINT_ERROR("%s", "Unable to get sense data"); goto out_hwerr_res_set; } } @@ -1267,7 +1267,7 @@ return res; out_inval: - PRINT_ERROR_PR("%s", "Invalid exec_reply parameter(s)"); + PRINT_ERROR("%s", "Invalid exec_reply parameter(s)"); out_hwerr: res = -EINVAL; @@ -1374,7 +1374,7 @@ return res; out_wrong_state: - PRINT_ERROR_PR("Command's %p subcode %x doesn't match internal " + PRINT_ERROR("Command's %p subcode %x doesn't match internal " "command's state %x or reply->subcode (%x) != ucmd->subcode " "(%x)", ucmd, _IOC_NR(reply->subcode), ucmd->state, reply->subcode, ucmd->user_cmd.subcode); @@ -1761,7 +1761,7 @@ break; default: - PRINT_ERROR_PR("Invalid ioctl cmd %x", cmd); + PRINT_ERROR("Invalid ioctl cmd %x", cmd); res = -EINVAL; goto out; } @@ -1923,7 +1923,7 @@ } default: - PRINT_ERROR_PR("Wrong ucmd state %x", state); + PRINT_ERROR("Wrong ucmd state %x", state); sBUG(); break; } @@ -2129,7 +2129,7 @@ spin_lock_irq(&dev->cmd_lists.cmd_list_lock); if (dev->internal_reset_active) { - PRINT_ERROR_PR("Loosing TM cmd %d, because there are other " + PRINT_ERROR("Loosing TM cmd %d, because there are other " "unprocessed TM commands", mcmd->fn); res = SCST_MGMT_STATUS_FAILED; goto out_locked_free; @@ -2138,7 +2138,7 @@ * We are going to miss some TM commands, so replace it * by the hardest one. */ - PRINT_ERROR_PR("Replacing TM cmd %d by TARGET_RESET, because " + PRINT_ERROR("Replacing TM cmd %d by TARGET_RESET, because " "there is another unprocessed TM command", mcmd->fn); ucmd->user_cmd.tm_cmd.fn = SCST_TARGET_RESET; ucmd->internal_reset_tm = 1; @@ -2159,7 +2159,7 @@ if (rc > 0) res = ucmd->result; else { - PRINT_ERROR_PR("Task management command %p timeout", ucmd); + PRINT_ERROR("Task management command %p timeout", ucmd); res = SCST_MGMT_STATUS_FAILED; } @@ -2196,7 +2196,7 @@ } spin_unlock(&dev_list_lock); if (dev == NULL) { - PRINT_ERROR_PR("Device %s not found", sdev->virt_name); + PRINT_ERROR("Device %s not found", sdev->virt_name); res = -EINVAL; goto out; } @@ -2205,7 +2205,7 @@ sdev->dh_priv = dev; - PRINT_INFO_PR("Attached user space SCSI target virtual device \"%s\"", + PRINT_INFO("Attached user space SCSI target virtual device \"%s\"", dev->name); out: @@ -2221,7 +2221,7 @@ TRACE_DBG("virt_id %d", sdev->virt_id); - PRINT_INFO_PR("Detached user space SCSI target virtual device \"%s\"", + PRINT_INFO("Detached user space SCSI target virtual device \"%s\"", dev->name); /* dev will be freed by the caller */ @@ -2306,7 +2306,7 @@ spin_lock_irq(&dev->cmd_lists.cmd_list_lock); if (dev->attach_cmd_active) { - PRINT_ERROR_PR("%s", "ATTACH_SESS command failed, because " + PRINT_ERROR("%s", "ATTACH_SESS command failed, because " "there is another unprocessed ATTACH_SESS command"); res = -EBUSY; goto out_locked_free; @@ -2321,7 +2321,7 @@ if (rc > 0) res = ucmd->result; else { - PRINT_ERROR_PR("%s", "ATTACH_SESS command timeout"); + PRINT_ERROR("%s", "ATTACH_SESS command timeout"); res = -EFAULT; } @@ -2512,7 +2512,7 @@ break; default: - PRINT_INFO_PR("Unknown SCSI type %x, using PARSE_CALL " + PRINT_INFO("Unknown SCSI type %x, using PARSE_CALL " "for it", dev->devtype.type); dev->parse_type = SCST_USER_PARSE_CALL; break; @@ -2536,7 +2536,7 @@ TRACE_ENTRY(); if (dev_desc->version != DEV_USER_VERSION) { - PRINT_ERROR_PR("Version mismatch (requested %d, required %d)", + PRINT_ERROR("Version mismatch (requested %d, required %d)", dev_desc->version, DEV_USER_VERSION); res = -EINVAL; goto out; @@ -2547,7 +2547,7 @@ case TYPE_ROM: case TYPE_MOD: if (dev_desc->block_size == 0) { - PRINT_ERROR_PR("Wrong block size %d", dev_desc->block_size); + PRINT_ERROR("Wrong block size %d", dev_desc->block_size); res = -EINVAL; goto out; } @@ -2563,7 +2563,7 @@ } if (!try_module_get(THIS_MODULE)) { - PRINT_ERROR_PR("%s", "Fail to get module"); + PRINT_ERROR("%s", "Fail to get module"); goto out; } @@ -2632,7 +2632,7 @@ list_for_each_entry(d, &dev_list, dev_list_entry) { if (strcmp(d->name, dev->name) == 0) { - PRINT_ERROR_PR("Device %s already exist", + PRINT_ERROR("Device %s already exist", dev->name); res = -EEXIST; spin_unlock(&dev_list_lock); @@ -2660,7 +2660,7 @@ mutex_lock(&dev_priv_mutex); if (file->private_data != NULL) { mutex_unlock(&dev_priv_mutex); - PRINT_ERROR_PR("%s", "Device already registered"); + PRINT_ERROR("%s", "Device already registered"); res = -EINVAL; goto out_unreg_drv; } @@ -2709,7 +2709,7 @@ (opt->memory_reuse_type > SCST_USER_MAX_MEM_REUSE_OPT) || (opt->prio_queue_type > SCST_USER_MAX_PRIO_QUEUE_OPT) || (opt->partial_transfers_type > SCST_USER_MAX_PARTIAL_TRANSFERS_OPT)) { - PRINT_ERROR_PR("%s", "Invalid option"); + PRINT_ERROR("%s", "Invalid option"); res = -EINVAL; goto out; } @@ -2913,7 +2913,7 @@ struct list_head *head = &dev->ucmd_hash[i]; struct scst_user_cmd *ucmd, *t; list_for_each_entry_safe(ucmd, t, head, hash_list_entry) { - PRINT_ERROR_PR("Lost ucmd %p (state %x, ref %d)", ucmd, + PRINT_ERROR("Lost ucmd %p (state %x, ref %d)", ucmd, ucmd->state, atomic_read(&ucmd->ucmd_ref)); ucmd_put(ucmd); } @@ -2990,7 +2990,7 @@ TRACE_ENTRY(); #if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G) - PRINT_ERROR_PR("%s", "HIGHMEM kerne... [truncated message content] |