Patch from Bart Van Assche <bart.vanassche@gmail.com>:

The patch below implements the following changes:
- Fixes the remaining warnings reported by checkpatch.pl with regard to the use
  of whitespace in C code.
- Adds double qoutes around some #warning messages, such that checkpatch.pl
  does no longer try to interprete the text behind the #warning preprocessor
  directive.
- Adds an extra conversion to the generate-kernel-patch script that removes
  the single space from before goto-labels while generating the kernel patch.

This patch has been tested as follows:
- Verified that svn diff -x -w only shows changes in the #warning preprocessor directives.
- Verified the output of svn diff by reading it.
- Verified that checkpatch.pl does no longer complain on the use of whitespace
  (searched through the checkpatch.pl output for the text ' space').
- Verified that the patch generated by the generate-kernel-patch script still
  applies cleanly to the 2.6.24 kernel, and that the patched kernel still compiles cleanly.

Please let me know if I have to resubmit parts of this patch to other SCST authors.

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@381 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2008-05-21 11:56:09 +00:00
parent 58e15c0864
commit 56e642cf77
47 changed files with 585 additions and 585 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ struct iscsi_event {
static inline int iscsi_is_key_declarative(int key)
{
switch(key)
switch (key)
{
case key_max_xmit_data_length:
return 1;
+4 -4
View File
@@ -30,7 +30,7 @@ static void print_conn_state(char *p, size_t size, struct iscsi_conn *conn)
return;
}
switch(conn->rd_state) {
switch (conn->rd_state) {
case ISCSI_CONN_RD_STATE_PROCESSING:
snprintf(p, size, "%s", "read_processing ");
printed = 1;
@@ -41,7 +41,7 @@ static void print_conn_state(char *p, size_t size, struct iscsi_conn *conn)
break;
}
switch(conn->wr_state) {
switch (conn->wr_state) {
case ISCSI_CONN_WR_STATE_PROCESSING:
snprintf(p, size, "%s", "write_processing ");
printed = 1;
@@ -452,7 +452,7 @@ void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn)
if (unlikely(current != conn->rd_task)) {
printk(KERN_EMERG "conn %p rd_task != current %p (pid %d)\n", conn,
current, current->pid);
while(in_softirq())
while (in_softirq())
local_bh_enable();
printk(KERN_EMERG "rd_state %x\n", conn->rd_state);
printk(KERN_EMERG "rd_task %p\n", conn->rd_task);
@@ -466,7 +466,7 @@ void iscsi_extracheck_is_wr_thread(struct iscsi_conn *conn)
if (unlikely(current != conn->wr_task)) {
printk(KERN_EMERG "conn %p wr_task != current %p (pid %d)\n", conn,
current, current->pid);
while(in_softirq())
while (in_softirq())
local_bh_enable();
printk(KERN_EMERG "wr_state %x\n", conn->wr_state);
printk(KERN_EMERG "wr_task %p\n", conn->wr_task);
+10 -10
View File
@@ -39,7 +39,7 @@ static int event_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
return 0;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
static int event_recv_skb(struct sk_buff *skb)
#else
static void event_recv_skb(struct sk_buff *skb)
@@ -64,14 +64,14 @@ static void event_recv_skb(struct sk_buff *skb)
}
out:
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
return 0;
#else
return;
#endif
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
static void event_recv(struct sock *sk, int length)
{
struct sk_buff *skb;
@@ -118,17 +118,17 @@ int event_send(u32 tid, u64 sid, u32 cid, u32 state, int atomic)
int __init event_init(void)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22))
nl = netlink_kernel_create(NETLINK_ISCSI_SCST, 1, event_recv,
THIS_MODULE);
#else
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
nl = netlink_kernel_create(NETLINK_ISCSI_SCST, 1, event_recv, NULL,
THIS_MODULE);
#else
# if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
nl = netlink_kernel_create(NETLINK_ISCSI_SCST, 1, event_recv, NULL,
THIS_MODULE);
# else
nl = netlink_kernel_create(&init_net, NETLINK_ISCSI_SCST, 1,
event_recv_skb, NULL, THIS_MODULE);
#endif
event_recv_skb, NULL, THIS_MODULE);
# endif
#endif
if (!nl) {
PRINT_ERROR("%s", "netlink_kernel_create() failed");
+15 -15
View File
@@ -130,7 +130,7 @@ struct iscsi_cmnd *cmnd_alloc(struct iscsi_conn *conn, struct iscsi_cmnd *parent
struct iscsi_cmnd *cmnd;
/* ToDo: __GFP_NOFAIL?? */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
cmnd = kmem_cache_alloc(iscsi_cmnd_cache, GFP_KERNEL|__GFP_NOFAIL);
memset(cmnd, 0, sizeof(*cmnd));
#else
@@ -236,7 +236,7 @@ void cmnd_done(struct iscsi_cmnd *cmnd)
/* Order between above and below code is important! */
if (cmnd->scst_cmd) {
switch(cmnd->scst_state) {
switch (cmnd->scst_state) {
case ISCSI_CMD_STATE_PROCESSED:
TRACE_DBG("cmd %p PROCESSED", cmnd);
scst_tgt_cmd_done(cmnd->scst_cmd);
@@ -254,7 +254,7 @@ void cmnd_done(struct iscsi_cmnd *cmnd)
}
default:
PRINT_CRIT_ERROR("Unexpected cmnd scst state %d",
cmnd->scst_state);
cmnd->scst_state);
sBUG();
break;
}
@@ -572,7 +572,7 @@ static void iscsi_set_datasize(struct iscsi_cmnd *cmnd, u32 offset, u32 size)
u8 *p = (u8*)page_address(sg_page(&cmnd->sg[idx])) +
(last_off & ~PAGE_MASK);
int i = 4 - (size & 3);
while(i--)
while (i--)
*p++ = 0;
}
}
@@ -593,7 +593,7 @@ static void send_data_rsp(struct iscsi_cmnd *req, u8 status, int send_status)
offset = 0;
sn = 0;
while(1) {
while (1) {
rsp = iscsi_cmnd_create_rsp_cmnd(req);
TRACE_DBG("rsp %p", rsp);
rsp->sg = req->sg;
@@ -681,7 +681,7 @@ static struct iscsi_cmnd *create_status_rsp(struct iscsi_cmnd *req, int status,
u8 *p = (u8 *)sense + i;
while (i < rsp->bufflen) {
*p ++ = 0;
*p++ = 0;
i++;
}
}
@@ -1126,7 +1126,7 @@ static void send_r2t(struct iscsi_cmnd *req)
if (++req->outstanding_r2t >= session->sess_param.max_outstanding_r2t)
break;
} while(req->r2t_length != 0);
} while (req->r2t_length != 0);
iscsi_cmnds_init_write(&send, ISCSI_INIT_WRITE_WAKE);
@@ -1322,7 +1322,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req)
dir = SCST_DATA_NONE;
scst_cmd_set_expected(scst_cmd, dir, be32_to_cpu(req_hdr->data_length));
switch(req_hdr->flags & ISCSI_CMD_ATTR_MASK) {
switch (req_hdr->flags & ISCSI_CMD_ATTR_MASK) {
case ISCSI_CMD_SIMPLE:
scst_cmd->queue_type = SCST_CMD_QUEUE_SIMPLE;
break;
@@ -1621,8 +1621,8 @@ static int cmnd_abort(struct iscsi_cmnd *req)
if (req_hdr->lun != hdr->lun) {
PRINT_ERROR("ABORT TASK: LUN mismatch: req LUN "
"%Lx, cmd LUN %Lx, rtt %u", req_hdr->lun,
hdr->lun, req_hdr->rtt);
"%Lx, cmd LUN %Lx, rtt %u", req_hdr->lun,
hdr->lun, req_hdr->rtt);
err = ISCSI_RESPONSE_FUNCTION_REJECTED;
goto out_put;
}
@@ -2494,7 +2494,7 @@ static void iscsi_try_local_processing(struct iscsi_conn *conn,
TRACE_ENTRY();
spin_lock_bh(&iscsi_wr_lock);
switch(conn->wr_state) {
switch (conn->wr_state) {
case ISCSI_CONN_WR_STATE_IN_LIST:
list_del(&conn->wr_list_entry);
/* go through */
@@ -2514,7 +2514,7 @@ static void iscsi_try_local_processing(struct iscsi_conn *conn,
if (local) {
int rc = 1;
while(test_write_ready(conn)) {
while (test_write_ready(conn)) {
rc = iscsi_send(conn);
if ((rc <= 0) || single_only) {
break;
@@ -2581,7 +2581,7 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd)
create_status_rsp(req, status, sense, sense_len);
switch(old_state) {
switch (old_state) {
case ISCSI_CMD_STATE_RX_CMD:
case ISCSI_CMD_STATE_AFTER_PREPROC:
break;
@@ -2681,7 +2681,7 @@ static bool iscsi_is_delay_tm_resp(struct iscsi_cmnd *rsp)
/* This should be checked for immediate TM commands as well */
switch(function) {
switch (function) {
default:
if (before(sess->exp_cmd_sn, req_hdr->cmd_sn))
res = 1;
@@ -2781,7 +2781,7 @@ out_release:
static inline int iscsi_get_mgmt_response(int status)
{
switch(status) {
switch (status) {
case SCST_MGMT_STATUS_SUCCESS:
return ISCSI_RESPONSE_FUNCTION_COMPLETE;
+25 -25
View File
@@ -95,7 +95,7 @@ again:
if (cmnd_get_check(cmnd))
continue;
for(i = 0; i < cmnd->sg_cnt; i++) {
for (i = 0; i < cmnd->sg_cnt; i++) {
struct page *page = sg_page(&cmnd->sg[i]);
TRACE_CONN_CLOSE_DBG("page %p, net_priv %p, "
"_count %d", page, page->net_priv,
@@ -106,7 +106,7 @@ again:
spin_unlock_bh(&conn->cmd_list_lock);
restart = 1;
}
while(page->net_priv != NULL)
while (page->net_priv != NULL)
iscsi_put_page_callback(page);
}
}
@@ -128,7 +128,7 @@ again:
if (cmnd_get_check(rsp))
continue;
for(i = 0; i < rsp->sg_cnt; i++) {
for (i = 0; i < rsp->sg_cnt; i++) {
struct page *page = sg_page(&rsp->sg[i]);
TRACE_CONN_CLOSE_DBG(" page %p, net_priv %p, "
"_count %d", page, page->net_priv,
@@ -140,7 +140,7 @@ again:
spin_unlock_bh(&conn->cmd_list_lock);
restart = 1;
}
while(page->net_priv != NULL)
while (page->net_priv != NULL)
iscsi_put_page_callback(page);
}
}
@@ -229,7 +229,7 @@ static void close_conn(struct iscsi_conn *conn)
conn_abort(conn);
/* ToDo: not the best way to wait */
while(atomic_read(&conn->conn_ref_cnt) != 0) {
while (atomic_read(&conn->conn_ref_cnt) != 0) {
struct iscsi_cmnd *cmnd;
mutex_lock(&target->target_mutex);
@@ -252,19 +252,19 @@ static void close_conn(struct iscsi_conn *conn)
if (!list_empty(&session->pending_list)) {
struct list_head *pending_list = &session->pending_list;
int req_freed;
TRACE_CONN_CLOSE_DBG("Disposing pending commands on "
"connection %p (conn_ref_cnt=%d)", conn,
atomic_read(&conn->conn_ref_cnt));
int req_freed;
TRACE_CONN_CLOSE_DBG("Disposing pending commands on "
"connection %p (conn_ref_cnt=%d)", conn,
atomic_read(&conn->conn_ref_cnt));
/*
* Such complicated approach currently isn't necessary,
* but it will be necessary for MC/S, if we won't want
* to reestablish the whole session on a connection
* failure.
*/
spin_lock(&session->sn_lock);
do {
req_freed = 0;
@@ -293,7 +293,7 @@ static void close_conn(struct iscsi_conn *conn)
break;
}
}
} while(req_freed);
} while (req_freed);
spin_unlock(&session->sn_lock);
if (time_after(jiffies, start_waiting + CONN_PENDING_TIMEOUT)) {
@@ -329,7 +329,7 @@ static void close_conn(struct iscsi_conn *conn)
break;
}
}
} while(req_freed);
} while (req_freed);
spin_unlock(&session->sn_lock);
}
}
@@ -389,7 +389,7 @@ static void close_conn(struct iscsi_conn *conn)
atomic_read(&cmnd->net_ref_cnt), cmnd->sg);
if (cmnd->sg != NULL) {
int i;
for(i = 0; i < cmnd->sg_cnt; i++) {
for (i = 0; i < cmnd->sg_cnt; i++) {
struct page *page = sg_page(&cmnd->sg[i]);
TRACE_CONN_CLOSE_DBG("page %p, net_priv %p, _count %d",
page, page->net_priv,
@@ -406,7 +406,7 @@ static void close_conn(struct iscsi_conn *conn)
atomic_read(&rsp->net_ref_cnt), rsp->sg);
if ((rsp->sg != cmnd->sg) && (rsp->sg != NULL)) {
int i;
for(i = 0; i < rsp->sg_cnt; i++) {
for (i = 0; i < rsp->sg_cnt; i++) {
TRACE_CONN_CLOSE_DBG(" page %p, net_priv %p, "
"_count %d", sg_page(&rsp->sg[i]),
sg_page(&rsp->sg[i])->net_priv,
@@ -429,7 +429,7 @@ static void close_conn(struct iscsi_conn *conn)
conn->sock->sk->sk_write_space = conn->old_write_space;
write_unlock_bh(&conn->sock->sk->sk_callback_lock);
while(1) {
while (1) {
bool t;
spin_lock_bh(&iscsi_wr_lock);
@@ -577,8 +577,8 @@ static int do_recv(struct iscsi_conn *conn, int state)
if (res >= first_len) {
int done = 1 + ((res - first_len) >> PAGE_SHIFT);
conn->read_msg.msg_iov += done;
conn->read_msg.msg_iovlen -= done;
}
conn->read_msg.msg_iovlen -= done;
}
} else
conn->read_state = state;
}
@@ -756,7 +756,7 @@ static int process_read_io(struct iscsi_conn *conn, int *closed)
*closed = 1;
break;
}
} while(res > 0);
} while (res > 0);
TRACE_EXIT_RES(res);
return res;
@@ -772,7 +772,7 @@ static void scst_do_job_rd(void)
/* We delete/add to tail connections to maintain fairness between them */
while(!list_empty(&iscsi_rd_list)) {
while (!list_empty(&iscsi_rd_list)) {
int rc, closed = 0;
struct iscsi_conn *conn = list_entry(iscsi_rd_list.next,
typeof(*conn), rd_list_entry);
@@ -824,7 +824,7 @@ int istrd(void *arg)
current->flags |= PF_NOFREEZE;
spin_lock_bh(&iscsi_rd_lock);
while(!kthread_should_stop()) {
while (!kthread_should_stop()) {
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
@@ -889,7 +889,7 @@ static inline void __iscsi_put_page_callback(struct iscsi_cmnd *cmd)
if (atomic_dec_and_test(&cmd->net_ref_cnt)) {
int i, sg_cnt = cmd->sg_cnt;
for(i = 0; i < sg_cnt; i++) {
for (i = 0; i < sg_cnt; i++) {
struct page *page = sg_page(&cmd->sg[i]);
TRACE_NET_PAGE("Clearing page %p", page);
if (page->net_priv == cmd)
@@ -1356,7 +1356,7 @@ static void scst_do_job_wr(void)
/* We delete/add to tail connections to maintain fairness between them */
while(!list_empty(&iscsi_wr_list)) {
while (!list_empty(&iscsi_wr_list)) {
int rc;
struct iscsi_conn *conn = list_entry(iscsi_wr_list.next,
typeof(*conn), wr_list_entry);
@@ -1419,7 +1419,7 @@ int istwr(void *arg)
current->flags |= PF_NOFREEZE;
spin_lock_bh(&iscsi_wr_lock);
while(!kthread_should_stop()) {
while (!kthread_should_stop()) {
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
+1 -1
View File
@@ -57,7 +57,7 @@ static int iscsi_session_alloc(struct iscsi_target *target, struct session_info
name = kmalloc(strlen(info->user_name) + strlen(info->initiator_name) +
1, GFP_KERNEL);
if (name == NULL){
if (name == NULL) {
err = -ENOMEM;
goto err;
}
+2 -2
View File
@@ -155,7 +155,7 @@ int target_add(struct target_info *info)
do {
if (!++next_target_id)
++next_target_id;
} while(target_lookup_by_id(next_target_id));
} while (target_lookup_by_id(next_target_id));
tid = next_target_id;
}
@@ -219,7 +219,7 @@ void target_del_all(void)
TRACE_MGMT_DBG("%s", "Deleting all targets");
/* Complete brain damage, ToDo */
while(1) {
while (1) {
mutex_lock(&target_mgmt_mutex);
if (list_empty(&target_list))
+2 -2
View File
@@ -32,7 +32,7 @@
#include <linux/seq_file.h>
#include <scsi/scsi_host.h>
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
#include <linux/pci.h>
#endif
@@ -155,7 +155,7 @@ mpt_target_show(struct seq_file *seq, void *v)
ioc->prod_name,
tgt->target_enable ? "True" : "False");
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 15))
if (ioc->bus_type == SCSI) {
#else
if (ioc->bus_type == SPI) {
+1 -1
View File
@@ -2,7 +2,7 @@
#define __MPT_SCST_H
#if defined(MODULE) && !defined(__GENKSYMS__)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
#include <linux/config.h>
#else
#include <linux/autoconf.h>
+1 -1
View File
@@ -78,7 +78,7 @@ static struct pci_device_id qla24xx_pci_tbl[] = {
.subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[1],
},
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
{
.vendor = PCI_VENDOR_ID_QLOGIC,
.device = PCI_DEVICE_ID_QLOGIC_ISP5422,
+3 -3
View File
@@ -1240,7 +1240,7 @@ static int q2t_do_send_cmd_to_scst(scsi_qla_host_t *ha, struct q2t_cmd *cmd)
scst_cmd_set_expected(cmd->scst_cmd, dir,
le32_to_cpu(cmd->atio.data_length));
switch(cmd->atio.task_codes) {
switch (cmd->atio.task_codes) {
case ATIO_SIMPLE_QUEUE:
cmd->scst_cmd->queue_type = SCST_CMD_QUEUE_SIMPLE;
break;
@@ -1388,7 +1388,7 @@ static int q2t_send_cmd_to_scst(scsi_qla_host_t *ha, atio_entry_t *atio)
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
cmd = kmem_cache_alloc(q2t_cmd_cachep, GFP_ATOMIC);
#else
cmd = kmem_cache_zalloc(q2t_cmd_cachep, GFP_ATOMIC);
@@ -1398,7 +1398,7 @@ static int q2t_send_cmd_to_scst(scsi_qla_host_t *ha, atio_entry_t *atio)
res = -ENOMEM;
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
memset(cmd, 0, sizeof(*cmd));
#endif
+10 -10
View File
@@ -321,7 +321,7 @@ static CLASS_DEVICE_ATTR(port_database,
qla2x00_update_portdb);
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -346,7 +346,7 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj, struct bin_attribute *attr,
return (count);
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -431,7 +431,7 @@ static struct bin_attribute sysfs_fw_dump_attr = {
.write = qla2x00_sysfs_write_fw_dump,
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -457,7 +457,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, struct bin_attribute *attr,
return ha->nvram_size;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -517,7 +517,7 @@ static struct bin_attribute sysfs_nvram_attr = {
.write = qla2x00_sysfs_write_nvram,
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -542,7 +542,7 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj, struct bin_attribute *attr,
return count;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -578,7 +578,7 @@ static struct bin_attribute sysfs_optrom_attr = {
.write = qla2x00_sysfs_write_optrom,
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -664,7 +664,7 @@ static struct bin_attribute sysfs_optrom_ctl_attr = {
.write = qla2x00_sysfs_write_optrom_ctl,
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -692,7 +692,7 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj, struct bin_attribute *attr,
return ha->vpd_size;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
static ssize_t
qla2x00_sysfs_write_vpd(struct kobject *kobj, char *buf, loff_t off,
size_t count)
@@ -1239,7 +1239,7 @@ struct fc_function_template qla2xxx_transport_functions = {
.set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo,
.show_rport_dev_loss_tmo = 1,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
.issue_fc_host_lip = qla2x00_issue_lip,
.get_fc_host_stats = qla2x00_get_fc_host_stats,
#endif
+10 -10
View File
@@ -126,26 +126,26 @@
#endif
#if defined(QL_DEBUG_LEVEL_11)
#define DEBUG11(x) do{x;} while(0);
#define DEBUG11(x) do{x;} while (0);
#if !defined(DEBUG2_11)
#define DEBUG2_11(x) do{x;} while(0);
#define DEBUG2_11(x) do{x;} while (0);
#endif
#if !defined(DEBUG2_3_11)
#define DEBUG2_3_11(x) do{x;} while(0);
#define DEBUG2_3_11(x) do{x;} while (0);
#endif
#if !defined(DEBUG3_11)
#define DEBUG3_11(x) do{x;} while(0);
#define DEBUG3_11(x) do{x;} while (0);
#endif
#else
#define DEBUG11(x) do{} while(0);
#define DEBUG11(x) do{} while (0);
#if !defined(QL_DEBUG_LEVEL_2)
#define DEBUG2_11(x) do{} while(0);
#define DEBUG2_11(x) do{} while (0);
#if !defined(QL_DEBUG_LEVEL_3)
#define DEBUG2_3_11(x) do{} while(0);
#define DEBUG2_3_11(x) do{} while (0);
#endif
#endif
#if !defined(QL_DEBUG_LEVEL_3)
#define DEBUG3_11(x) do{} while(0);
#define DEBUG3_11(x) do{} while (0);
#endif
#endif
@@ -158,12 +158,12 @@
#if defined(QL_DEBUG_LEVEL_13)
#define DEBUG13(x) do {x;} while (0)
#if !defined(DEBUG2_13)
#define DEBUG2_13(x) do {x;} while(0)
#define DEBUG2_13(x) do {x;} while (0)
#endif
#else
#define DEBUG13(x) do {} while (0)
#if !defined(QL_DEBUG_LEVEL_2)
#define DEBUG2_13(x) do {} while(0)
#define DEBUG2_13(x) do {} while (0)
#endif
#endif
+1 -1
View File
@@ -2124,7 +2124,7 @@ struct isp_operations {
char * (*pci_info_str) (struct scsi_qla_host *, char *);
char * (*fw_version_str) (struct scsi_qla_host *, char *);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
irqreturn_t (*intr_handler) (int, void *, struct pt_regs *);
#else
irq_handler_t intr_handler;
+2 -2
View File
@@ -213,7 +213,7 @@ qla2x00_stop_firmware(scsi_qla_host_t *);
/*
* Global Function Prototypes in qla_isr.c source file.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
extern irqreturn_t qla2100_intr_handler(int, void *, struct pt_regs *);
extern irqreturn_t qla2300_intr_handler(int, void *, struct pt_regs *);
extern irqreturn_t qla24xx_intr_handler(int, void *, struct pt_regs *);
@@ -320,7 +320,7 @@ extern void qla2x00_init_host_attr(scsi_qla_host_t *);
extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
{
cmd->resid = resid;
+7 -7
View File
@@ -1725,13 +1725,13 @@ out:
}
static void
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
qla2x00_rport_add(void *data)
#else
qla2x00_rport_add(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
fc_port_t *fcport = data;
#else
fc_port_t *fcport = container_of(work, struct fc_port, rport_add_work);
@@ -1741,13 +1741,13 @@ qla2x00_rport_add(struct work_struct *work)
}
static void
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
qla2x00_rport_del(void *data)
#else
qla2x00_rport_del(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
fc_port_t *fcport = data;
#else
fc_port_t *fcport = container_of(work, struct fc_port, rport_del_work);
@@ -1790,7 +1790,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags)
fcport->flags = FCF_RLC_SUPPORT;
fcport->supported_classes = FC_COS_UNSPECIFIED;
spin_lock_init(&fcport->rport_lock);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&fcport->rport_add_work, qla2x00_rport_add, fcport);
INIT_WORK(&fcport->rport_del_work, qla2x00_rport_del, fcport);
#else
@@ -2137,7 +2137,7 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport)
unsigned long flags;
if (fcport->drport)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
qla2x00_rport_del(fcport);
#else
qla2x00_rport_del(&fcport->rport_del_work);
@@ -3056,7 +3056,7 @@ qla2x00_update_fcports(scsi_qla_host_t *ha)
/* Go with deferred removal of rport references. */
list_for_each_entry(fcport, &ha->fcports, list)
if (fcport->drport)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
qla2x00_rport_del(fcport);
#else
qla2x00_rport_del(&fcport->rport_del_work);
+1 -1
View File
@@ -104,7 +104,7 @@ static __inline__ void qla2x00_poll(scsi_qla_host_t *);
static inline void
qla2x00_poll(scsi_qla_host_t *ha)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
ha->isp_ops.intr_handler(0, ha, NULL);
#else
ha->isp_ops.intr_handler(0, ha);
+3 -3
View File
@@ -32,7 +32,7 @@ static void qla24xx_ms_entry(scsi_qla_host_t *, struct ct_entry_24xx *);
*
* Returns handled flag.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
irqreturn_t
qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
#else
@@ -117,7 +117,7 @@ qla2100_intr_handler(int irq, void *dev_id)
*
* Returns handled flag.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
irqreturn_t
qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
#else
@@ -1581,7 +1581,7 @@ qla24xx_process_response_queue(struct scsi_qla_host *ha)
*
* Returns handled flag.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
irqreturn_t
qla24xx_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
#else
+5 -5
View File
@@ -1198,7 +1198,7 @@ qla2x00_set_isp_flags(scsi_qla_host_t *ha)
ha->device_type |= DT_ISP2432;
ha->device_type |= DT_ZIO_SUPPORTED;
break;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
case PCI_DEVICE_ID_QLOGIC_ISP5422:
ha->device_type |= DT_ISP5422;
break;
@@ -2181,7 +2181,7 @@ qla2x00_allocate_sp_pool(scsi_qla_host_t *ha)
int rval;
rval = QLA_SUCCESS;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep);
#else
ha->srb_mempool = mempool_create(SRB_MIN_REQ, mempool_alloc_slab,
@@ -2402,7 +2402,7 @@ qla2x00_do_dpc(void *data)
ha->isp_ops.beacon_blink(ha);
ha->dpc_active = 0;
} /* End of while(1) */
} /* End of while (1) */
DEBUG(printk("scsi(%ld): DPC handler exiting\n", ha->host_no));
@@ -2719,7 +2719,7 @@ static struct pci_device_id qla2xxx_pci_tbl[] = {
PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2432,
PCI_ANY_ID, PCI_ANY_ID, },
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
{ PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5422,
PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP5432,
@@ -2776,7 +2776,7 @@ qla2x00_module_init(void)
/* Allocate cache for SRBs. */
srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
SLAB_HWCACHE_ALIGN, NULL
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
, NULL);
#else
);
+4 -4
View File
@@ -381,7 +381,7 @@ isp_reset(ispsoftc_t *isp)
sdp = SDPARAM(isp, 1);
l = ISP_READ(isp, SXP_PINS_DIFF|SXP_BANK1_SELECT);
l &= ISP1080_MODE_MASK;
switch(l) {
switch (l) {
case ISP1080_LVD_MODE:
sdp->isp_lvdmode = 1;
isp_prt(isp, ISP_LOGCONFIG, m, 1, "LVD");
@@ -1648,7 +1648,7 @@ isp_fibre_init(ispsoftc_t *isp)
/*
* Prefer or force Point-To-Point instead Loop?
*/
switch(isp->isp_confopts & ISP_CFG_PORT_PREF) {
switch (isp->isp_confopts & ISP_CFG_PORT_PREF) {
case ISP_CFG_NPORT:
icbp->icb_xfwoptions |= ICBXOPT_PTP_2_LOOP;
break;
@@ -1921,7 +1921,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
icbp->icb_fwoptions2 = fcp->isp_xfwoptions;
switch(isp->isp_confopts & ISP_CFG_PORT_PREF) {
switch (isp->isp_confopts & ISP_CFG_PORT_PREF) {
#if 0
case ISP_CFG_NPORT:
/*
@@ -2901,7 +2901,7 @@ not_on_fabric:
static const char *
ispfc_fw_statename(int state)
{
switch(state) {
switch (state) {
case FW_CONFIG_WAIT: return "Config Wait";
case FW_WAIT_AL_PA: return "Waiting for AL_PA";
case FW_WAIT_LOGIN: return "Wait Login";
+6 -6
View File
@@ -200,7 +200,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
ISP_TDQE(isp, "isp_target_notify", (int) *optrp, vptr);
switch(type) {
switch (type) {
case RQSTYPE_ATIO:
if (IS_24XX(isp)) {
int len;
@@ -1182,7 +1182,7 @@ isp_handle_atio(ispsoftc_t *isp, at_entry_t *aep)
* about this so it's ignored.
*/
switch(aep->at_status & ~QLTM_SVALID) {
switch (aep->at_status & ~QLTM_SVALID) {
case AT_PATH_INVALID:
/*
* ATIO rejected by the firmware due to disabled lun.
@@ -1275,7 +1275,7 @@ isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep)
* about this so it's ignored.
*/
switch(aep->at_status & ~QLTM_SVALID) {
switch (aep->at_status & ~QLTM_SVALID) {
case AT_PATH_INVALID:
/*
* ATIO rejected by the firmware due to disabled lun.
@@ -1351,7 +1351,7 @@ isp_handle_ctio(ispsoftc_t *isp, ct_entry_t *ct)
xs = NULL;
}
switch(ct->ct_status & ~QLTM_SVALID) {
switch (ct->ct_status & ~QLTM_SVALID) {
case CT_OK:
/*
* There are generally 3 possibilities as to why we'd get
@@ -1512,7 +1512,7 @@ isp_handle_ctio2(ispsoftc_t *isp, ct2_entry_t *ct)
xs = NULL;
}
switch(ct->ct_status & ~QLTM_SVALID) {
switch (ct->ct_status & ~QLTM_SVALID) {
case CT_BUS_ERROR:
isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error");
/* FALL Through */
@@ -1674,7 +1674,7 @@ isp_handle_ctio7(ispsoftc_t *isp, ct7_entry_t *ct)
xs = NULL;
}
switch(ct->ct_nphdl) {
switch (ct->ct_nphdl) {
case CT7_BUS_ERROR:
isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error");
/* FALL Through */
+1 -1
View File
@@ -843,7 +843,7 @@ isp_qlogic_ext_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsign
unsigned int i;
ext.Instance = 0;
for(i = 0; i < MAX_ISP; i++) {
for (i = 0; i < MAX_ISP; i++) {
if (isplist[i] && IS_FC(isplist[i])) {
ext.Instance++;
}
+1 -1
View File
@@ -3973,7 +3973,7 @@ isplinux_mbtimer(unsigned long arg)
ISP_IUNLK_SOFTC(isp);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
#define PTARG , struct pt_regs *pt
#else
#define PTARG
+6 -6
View File
@@ -80,7 +80,7 @@
#define KERNEL_VERSION(v,p,s) (((v)<<16)+(p<<8)+s)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(2,7,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 7, 0)
#error "Only Linux 2.5/2.6 kernels are supported with this driver"
#endif
@@ -122,7 +122,7 @@
#include <scsi/scsi_device.h>
#include <linux/cdev.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
#include <linux/devfs_fs_kernel.h>
#define ISP_CLASS struct class_simple
#define CREATE_ISP_CLASS class_simple_create
@@ -197,7 +197,7 @@ typedef struct scsi_host_template Scsi_Host_Template;
#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
#define sg_page(_sg) ((_sg)->page)
#define sg_assign_page(_sg, _pg) ((_sg)->page = (_pg))
#endif
@@ -395,8 +395,8 @@ struct isposinfo {
#define ISP_IUNLK_SOFTC ISP_UNLK_SOFTC
#define ISP_IGET_LK_SOFTC(isp) spin_lock_irq(&isp->isp_osinfo.slock)
#define ISP_DROP_LK_SOFTC(isp) spin_unlock_irq(&isp->isp_osinfo.slock)
#define ISP_LOCK_SCSI_DONE(isp) do { } while(0)
#define ISP_UNLK_SCSI_DONE(isp) do { } while(0)
#define ISP_LOCK_SCSI_DONE(isp) do { } while (0)
#define ISP_UNLK_SCSI_DONE(isp) do { } while (0)
#define ISP_LOCKU_SOFTC ISP_ILOCK_SOFTC
#define ISP_UNLKU_SOFTC ISP_IUNLK_SOFTC
#define ISP_TLOCK_INIT(isp) spin_lock_init(&isp->isp_osinfo.tlock)
@@ -628,7 +628,7 @@ typedef struct {
*/
void isplinux_timer(unsigned long);
void isplinux_mbtimer(unsigned long);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
irqreturn_t isplinux_intr(int, void *, struct pt_regs *);
#else
irqreturn_t isplinux_intr(int, void *);
+9 -9
View File
@@ -87,7 +87,7 @@ static int isp_pci_mbxdma(ispsoftc_t *);
static int isp_pci_dmasetup(ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t);
static void isp_pci_dmateardown(ispsoftc_t *, XS_T *, uint32_t);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,6)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 6)
#define DMA_64BIT_MASK 0xffffffffffffffffULL
#define DMA_32BIT_MASK 0x00000000ffffffffULL
#endif
@@ -99,7 +99,7 @@ static void isp_pci_dmateardown(ispsoftc_t *, XS_T *, uint32_t);
#define SAME_4G(addr, cnt) (FOURG_SEG(addr) == FOURG_SEG(addr + cnt - 1))
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
#define ISP_IRQ_FLAGS SA_INTERRUPT | SA_SHIRQ
#else
#define ISP_IRQ_FLAGS IRQF_SHARED
@@ -365,11 +365,11 @@ struct isp_pcisoftc {
msix_enabled : 2,
msi_enabled : 1;
};
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 8)
#define pci_enable_msi(x) -ENXIO
#define pci_enable_msix(x) -ENXIO
#define pci_disable_msi(x) do { ; } while(0)
#define pci_disable_msix(x) do { ; } while(0)
#define pci_disable_msi(x) do { ; } while (0)
#define pci_disable_msix(x) do { ; } while (0)
#endif
/*
@@ -506,7 +506,7 @@ isplinux_pci_release(struct Scsi_Host *host)
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,7) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 7) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
/**
* pci_intx - enables/disables PCI INTx for device dev
* @pdev: the PCI device to operate on
@@ -619,7 +619,7 @@ isplinux_pci_init_one(struct Scsi_Host *host)
return (1);
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,7)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 7)
if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432) {
struct msix_entry isp_msix[3];
int reg;
@@ -669,7 +669,7 @@ isplinux_pci_init_one(struct Scsi_Host *host)
pci_write_config_word(pdev, reg + PCI_EXP_DEVCTL, pectl);
}
} else
#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
#elif LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)
if (pci_enable_msi(pdev) == 0) {
isp_pci->msi_enabled = 1;
}
@@ -3479,7 +3479,7 @@ isplinux_pci_remove(struct pci_dev *pdev)
static struct pci_driver isplinux_pci_driver = {
.name = ISP_NAME,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 9)
.driver = {
.owner = THIS_MODULE,
},
+1 -1
View File
@@ -1245,7 +1245,7 @@ static DEFINE_MUTEX(proc_mutex);
* Many procfs things is taken from scst/src/scst_proc.c
*/
#if !defined(CONFIG_PPC) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
#if !defined(CONFIG_PPC) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22))
static int strncasecmp(const char *s1, const char *s2, size_t n)
{
+2 -2
View File
@@ -79,7 +79,7 @@
#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
#define sg_page(_sg) ((_sg)->page)
#define sg_assign_page(_sg, _pg) ((_sg)->page = (_pg))
#endif
@@ -482,7 +482,7 @@ scsi_target_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned
{
int rv = 0;
switch(cmd) {
switch (cmd) {
case SC_ENABLE_LUN:
case SC_DISABLE_LUN:
{
+1 -1
View File
@@ -60,7 +60,7 @@ diff -uprN orig/linux-${kernel_version}/$2 linux-${kernel_version}/$2
@@ -0,0 +1,$(wc -l "$1" | { read a b; echo $a; }) @@
EOF
if [ "${2%.[ch]}" != "$2" ]; then
sed -e 's/^/+/' -e 's/[ ]*$//g' < "$1"
sed -e 's/^ \([^ ]*:\)$/\1/' -e 's/^/+/' < "$1"
else
sed -e 's/^/+/' < "$1"
fi
+6 -6
View File
@@ -40,7 +40,7 @@
#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name, 0)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
typedef _Bool bool;
#define true 1
#define false 0
@@ -48,7 +48,7 @@ typedef _Bool bool;
/* Version numbers, the same as for the kernel */
#define SCST_VERSION_CODE 0x00090601
#define SCST_VERSION(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d)
#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d)
#define SCST_VERSION_STRING "0.9.6-rc1"
#define SCST_INTERFACE_VERSION SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION
@@ -1146,7 +1146,7 @@ struct scst_cmd
unsigned long start_time;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
struct scsi_request *scsi_req; /* SCSI request */
#endif
@@ -2335,7 +2335,7 @@ static inline int scst_mgmt_cmd_get_fn(struct scst_mgmt_cmd *mcmd)
return mcmd->fn;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
static inline struct page *sg_page(struct scatterlist *sg)
{
@@ -2365,7 +2365,7 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
sg->length = len;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */
static inline void sg_clear(struct scatterlist *sg)
{
@@ -2549,7 +2549,7 @@ struct scst_proc_data {
int scst_single_seq_open(struct inode *inode, struct file *file);
struct proc_dir_entry *scst_create_proc_entry(struct proc_dir_entry * root,
const char *name, struct scst_proc_data *pdata);
const char *name, struct scst_proc_data *pdata);
#define SCST_DEF_RW_SEQ_OP(x) \
.seq_op = { \
+186 -186
View File
@@ -146,40 +146,40 @@ extern int debug_print_prefix(unsigned long trace_flag, const char *log_level,
extern void debug_print_buffer(const char *log_level, const void *data,
int len);
#define TRACE(trace, format, args...) \
do { \
if (___unlikely(trace_flag & (trace))) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \
__FUNCTION__, __LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s" format, __tflag, args); \
} \
} while(0)
#define TRACE(trace, format, args...) \
do { \
if (___unlikely(trace_flag & (trace))) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \
__FUNCTION__, __LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s" format, __tflag, args); \
} \
} while (0)
#define PRINT_BUFFER(message, buff, len) \
do { \
PRINT(NO_FLAG, "%s:", message); \
debug_print_buffer(INFO_FLAG, buff, len); \
} while(0)
PRINT(NO_FLAG, "%s:", message); \
debug_print_buffer(INFO_FLAG, buff, len); \
} while (0)
#define PRINT_BUFF_FLAG(flag, message, buff, len) \
do { \
if (___unlikely(trace_flag & (flag))) \
{ \
char *__tflag = INFO_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s%s:", __tflag, message); \
debug_print_buffer(INFO_FLAG, buff, len); \
} \
} while(0)
#define PRINT_BUFF_FLAG(flag, message, buff, len) \
do { \
if (___unlikely(trace_flag & (flag))) \
{ \
char *__tflag = INFO_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s%s:", __tflag, message); \
debug_print_buffer(INFO_FLAG, buff, len); \
} \
} while (0)
#else /* DEBUG || TRACING */
@@ -191,19 +191,19 @@ do { \
#ifdef DEBUG
#define __TRACE(trace, format, args...) \
do { \
if (trace_flag & (trace)) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s" format, __tflag, args); \
} \
} while(0)
#define __TRACE(trace, format, args...) \
do { \
if (trace_flag & (trace)) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s" format, __tflag, args); \
} \
} while (0)
#define TRACE_MEM(args...) __TRACE(TRACE_MEMORY, args)
#define TRACE_SG(args...) __TRACE(TRACE_SG_OP, args)
@@ -212,137 +212,137 @@ do { \
#define TRACE_MGMT_DBG(args...) __TRACE(TRACE_MGMT_DEBUG, args)
#define TRACE_MGMT_DBG_SPECIAL(args...) __TRACE(TRACE_MGMT_DEBUG|TRACE_SPECIAL, args)
#define TRACE_BUFFER(message, buff, len) \
do { \
if (trace_flag & TRACE_BUFF) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s%s:", __tflag, message); \
debug_print_buffer(LOG_FLAG, buff, len); \
} \
} while(0)
#define TRACE_BUFFER(message, buff, len) \
do { \
if (trace_flag & TRACE_BUFF) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s%s:", __tflag, message); \
debug_print_buffer(LOG_FLAG, buff, len); \
} \
} while (0)
#define TRACE_BUFF_FLAG(flag, message, buff, len) \
do { \
if (trace_flag & (flag)) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s%s:", __tflag, message); \
debug_print_buffer(LOG_FLAG, buff, len); \
} \
} while(0)
#define TRACE_BUFF_FLAG(flag, message, buff, len) \
do { \
if (trace_flag & (flag)) \
{ \
char *__tflag = LOG_FLAG; \
if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
__LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s%s:", __tflag, message); \
debug_print_buffer(LOG_FLAG, buff, len); \
} \
} while (0)
#define PRINT_LOG_FLAG(log_flag, format, args...) \
do { \
char *__tflag = log_flag; \
if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \
__FUNCTION__, __LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s" format, __tflag, args); \
} while(0)
#define PRINT_LOG_FLAG(log_flag, format, args...) \
do { \
char *__tflag = log_flag; \
if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \
__FUNCTION__, __LINE__) > 0) \
{ \
__tflag = NO_FLAG; \
} \
PRINT(NO_FLAG, "%s" format, __tflag, args); \
} while (0)
#define PRINT_ERROR(format, args...) \
do { \
if (strcmp(ERROR_FLAG, LOG_FLAG)) \
{ \
PRINT_LOG_FLAG(LOG_FLAG, "***ERROR*** " format, args); \
} \
PRINT_LOG_FLAG(ERROR_FLAG, "***ERROR*** " format, args); \
} while(0)
#define PRINT_ERROR(format, args...) \
do { \
if (strcmp(ERROR_FLAG, LOG_FLAG)) \
{ \
PRINT_LOG_FLAG(LOG_FLAG, "***ERROR*** " format, args); \
} \
PRINT_LOG_FLAG(ERROR_FLAG, "***ERROR*** " format, args); \
} while (0)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
/* if (strcmp(CRIT_FLAG, LOG_FLAG)) \
{ \
PRINT_LOG_FLAG(LOG_FLAG, "***CRITICAL ERROR*** " format, args); \
}*/ \
PRINT_LOG_FLAG(CRIT_FLAG, "***CRITICAL ERROR*** " format, args); \
} while(0)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
/* if (strcmp(CRIT_FLAG, LOG_FLAG)) \
{ \
PRINT_LOG_FLAG(LOG_FLAG, "***CRITICAL ERROR*** " format, args); \
}*/ \
PRINT_LOG_FLAG(CRIT_FLAG, "***CRITICAL ERROR*** " format, args); \
} while (0)
#define PRINT_INFO(format, args...) \
do { \
if (strcmp(INFO_FLAG, LOG_FLAG)) \
{ \
PRINT_LOG_FLAG(LOG_FLAG, format, args); \
} \
PRINT_LOG_FLAG(INFO_FLAG, format, args); \
} while(0)
#define PRINT_INFO(format, args...) \
do { \
if (strcmp(INFO_FLAG, LOG_FLAG)) \
{ \
PRINT_LOG_FLAG(LOG_FLAG, format, args); \
} \
PRINT_LOG_FLAG(INFO_FLAG, format, args); \
} while (0)
#define TRACE_ENTRY() \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: ENTRY %s", current->pid, \
__FUNCTION__); \
} \
else \
{ \
PRINT(LOG_FLAG, "ENTRY %s", __FUNCTION__); \
} \
} \
} while(0)
#define TRACE_ENTRY() \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: ENTRY %s", current->pid, \
__FUNCTION__); \
} \
else \
{ \
PRINT(LOG_FLAG, "ENTRY %s", __FUNCTION__); \
} \
} \
} while (0)
#define TRACE_EXIT() \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: EXIT %s", current->pid, \
__FUNCTION__); \
} \
else \
{ \
PRINT(LOG_FLAG, "EXIT %s", __FUNCTION__); \
} \
} \
} while(0)
#define TRACE_EXIT() \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: EXIT %s", current->pid, \
__FUNCTION__); \
} \
else \
{ \
PRINT(LOG_FLAG, "EXIT %s", __FUNCTION__); \
} \
} \
} while (0)
#define TRACE_EXIT_RES(res) \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: EXIT %s: %ld", current->pid, \
__FUNCTION__, (long)(res)); \
} \
else \
{ \
PRINT(LOG_FLAG, "EXIT %s: %ld", __FUNCTION__, (long)(res)); \
} \
} \
} while(0)
#define TRACE_EXIT_RES(res) \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: EXIT %s: %ld", current->pid, \
__FUNCTION__, (long)(res)); \
} \
else \
{ \
PRINT(LOG_FLAG, "EXIT %s: %ld", __FUNCTION__, (long)(res)); \
} \
} \
} while (0)
#define TRACE_EXIT_HRES(res) \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: EXIT %s: 0x%lx", current->pid, \
__FUNCTION__, (long)(res)); \
} \
else \
{ \
PRINT(LOG_FLAG, "EXIT %s: %lx", __FUNCTION__, (long)(res)); \
} \
} \
} while(0)
#define TRACE_EXIT_HRES(res) \
do { \
if (trace_flag & TRACE_ENTRYEXIT) \
{ \
if (trace_flag & TRACE_PID) \
{ \
PRINT(LOG_FLAG, "[%d]: EXIT %s: 0x%lx", current->pid, \
__FUNCTION__, (long)(res)); \
} \
else \
{ \
PRINT(LOG_FLAG, "EXIT %s: %lx", __FUNCTION__, (long)(res)); \
} \
} \
} while (0)
#else /* DEBUG */
@@ -361,48 +361,48 @@ do { \
#ifdef LOG_PREFIX
#define PRINT_INFO(format, args...) \
do { \
PRINT(INFO_FLAG, "%s: " format, LOG_PREFIX, args); \
} while(0)
#define PRINT_INFO(format, args...) \
do { \
PRINT(INFO_FLAG, "%s: " format, LOG_PREFIX, args); \
} while (0)
#define PRINT_ERROR(format, args...) \
do { \
PRINT(ERROR_FLAG, "%s: ***ERROR*** " \
format, LOG_PREFIX, args); \
} while(0)
PRINT(ERROR_FLAG, "%s: ***ERROR*** " \
format, LOG_PREFIX, args); \
} while (0)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
PRINT(CRIT_FLAG, "%s: ***CRITICAL ERROR*** " \
format, LOG_PREFIX, args); \
} while(0)
PRINT(CRIT_FLAG, "%s: ***CRITICAL ERROR*** " \
format, LOG_PREFIX, args); \
} while (0)
#else
#define PRINT_INFO(format, args...) \
do { \
PRINT(INFO_FLAG, format, args); \
} while(0)
PRINT(INFO_FLAG, format, args); \
} while (0)
#define PRINT_ERROR(format, args...) \
do { \
PRINT(ERROR_FLAG, "***ERROR*** " \
format, args); \
} while(0)
PRINT(ERROR_FLAG, "***ERROR*** " \
format, args); \
} while (0)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
PRINT(CRIT_FLAG, "***CRITICAL ERROR*** " \
format, args); \
} while(0)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
PRINT(CRIT_FLAG, "***CRITICAL ERROR*** " \
format, args); \
} while (0)
#endif /* LOG_PREFIX */
#endif /* DEBUG */
#if defined(DEBUG) && defined(CONFIG_DEBUG_SLAB)
#define SCST_SLAB_FLAGS ( SLAB_RED_ZONE | SLAB_POISON )
#define SCST_SLAB_FLAGS (SLAB_RED_ZONE | SLAB_POISON)
#else
#define SCST_SLAB_FLAGS 0L
#endif
+1 -1
View File
@@ -88,7 +88,7 @@ int changer_attach(struct scst_device *dev)
TRACE_DBG("%s", "Doing TEST_UNIT_READY");
res = scsi_test_unit_ready(dev->scsi_dev, CHANGER_TIMEOUT,
CHANGER_RETRIES
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
);
#else
, NULL);
+2 -2
View File
@@ -16,8 +16,8 @@
#ifdef DEBUG
#define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_PID | \
TRACE_LINE | TRACE_FUNCTION | TRACE_MGMT | TRACE_MGMT_MINOR | \
TRACE_MINOR | TRACE_MGMT_DEBUG | TRACE_SPECIAL)
TRACE_LINE | TRACE_FUNCTION | TRACE_MGMT | TRACE_MGMT_MINOR | \
TRACE_MINOR | TRACE_MGMT_DEBUG | TRACE_SPECIAL)
#else
#define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \
TRACE_MINOR | TRACE_SPECIAL)
+1 -1
View File
@@ -88,7 +88,7 @@ int processor_attach(struct scst_device *dev)
TRACE_DBG("%s", "Doing TEST_UNIT_READY");
res = scsi_test_unit_ready(dev->scsi_dev, PROCESSOR_TIMEOUT,
PROCESSOR_RETRIES
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
);
#else
, NULL);
+1 -1
View File
@@ -88,7 +88,7 @@ int raid_attach(struct scst_device *dev)
TRACE_DBG("%s", "Doing TEST_UNIT_READY");
res = scsi_test_unit_ready(dev->scsi_dev, RAID_TIMEOUT,
RAID_RETRIES
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
);
#else
, NULL);
+1 -1
View File
@@ -184,7 +184,7 @@ int tape_attach(struct scst_device *dev)
TRACE_DBG("%s", "Doing TEST_UNIT_READY");
res = scsi_test_unit_ready(dev->scsi_dev, TAPE_SMALL_TIMEOUT,
TAPE_RETRIES
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
);
#else
, NULL);
+29 -29
View File
@@ -107,7 +107,7 @@ struct scst_user_pre_unreg_sess_obj
unsigned int active:1;
unsigned int exit:1;
struct list_head pre_unreg_sess_list_entry;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
struct work_struct pre_unreg_sess_work;
#else
struct delayed_work pre_unreg_sess_work;
@@ -166,7 +166,7 @@ static int dev_user_tape_done(struct scst_cmd *cmd);
static struct page *dev_user_alloc_pages(struct scatterlist *sg,
gfp_t gfp_mask, void *priv);
static void dev_user_free_sg_entries(struct scatterlist *sg, int sg_count,
void *priv);
void *priv);
static void dev_user_add_to_ready(struct scst_user_cmd *ucmd);
@@ -289,7 +289,7 @@ static void cmd_insert_hash(struct scst_user_cmd *ucmd)
do {
ucmd->h = dev->handle_counter++;
u = __ucmd_find_hash(dev, ucmd->h);
} while(u != NULL);
} while (u != NULL);
head = &dev->ucmd_hash[scst_user_cmd_hashfn(ucmd->h)];
list_add_tail(&ucmd->hash_list_entry, head);
spin_unlock_irqrestore(&dev->cmd_lists.cmd_list_lock, flags);
@@ -388,7 +388,7 @@ static void dev_user_unmap_buf(struct scst_user_cmd *ucmd)
TRACE_MEM("Unmapping data pages (ucmd %p, ubuff %lx, num %d)", ucmd,
ucmd->ubuff, ucmd->num_data_pages);
for(i = 0; i < ucmd->num_data_pages; i++) {
for (i = 0; i < ucmd->num_data_pages; i++) {
struct page *page = ucmd->data_pages[i];
if (ucmd->buf_dirty)
@@ -535,7 +535,7 @@ static int dev_user_alloc_sg(struct scst_user_cmd *ucmd, int cached_buff)
sBUG_ON(ucmd->sgv != NULL);
res = -1;
} else {
switch(ucmd->state & ~UCMD_STATE_MASK) {
switch (ucmd->state & ~UCMD_STATE_MASK) {
case UCMD_STATE_BUF_ALLOCING:
res = 1;
break;
@@ -615,7 +615,7 @@ static struct scst_user_cmd *dev_user_alloc_ucmd(struct scst_user_dev *dev,
TRACE_ENTRY();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
ucmd = kmem_cache_alloc(user_cmd_cachep, gfp_mask);
if (ucmd != NULL)
memset(ucmd, 0, sizeof(*ucmd));
@@ -683,7 +683,7 @@ static int dev_user_parse(struct scst_cmd *cmd)
if (ucmd->state != UCMD_STATE_NEW)
goto alloc;
switch(dev->parse_type) {
switch (dev->parse_type) {
case SCST_USER_PARSE_STANDARD:
TRACE_DBG("PARSE STANDARD: ucmd %p", ucmd);
rc = dev->generic_parse(cmd, dev_user_get_block);
@@ -764,7 +764,7 @@ static void dev_user_flush_dcache(struct scst_user_cmd *ucmd)
if (start == 0)
goto out;
for(i = 0; i < buf_ucmd->num_data_pages; i++) {
for (i = 0; i < buf_ucmd->num_data_pages; i++) {
struct page *page;
page = buf_ucmd->data_pages[i];
#ifdef ARCH_HAS_FLUSH_ANON_PAGE
@@ -951,7 +951,7 @@ static void dev_user_add_to_ready(struct scst_user_cmd *ucmd)
if (unlikely(dev->attach_cmd_active || dev->tm_cmd_active ||
dev->internal_reset_active || dev->pre_unreg_sess_active ||
(dev->detach_cmd_count != 0))) {
switch(ucmd->state) {
switch (ucmd->state) {
case UCMD_STATE_PARSING:
case UCMD_STATE_BUF_ALLOCING:
case UCMD_STATE_EXECING:
@@ -989,8 +989,8 @@ static void dev_user_add_to_ready(struct scst_user_cmd *ucmd)
unlikely(ucmd->state == UCMD_STATE_ATTACH_SESS) ||
unlikely(ucmd->state == UCMD_STATE_DETACH_SESS)) {
if (dev->prio_queue_type == SCST_USER_PRIO_QUEUE_SEPARATE) {
TRACE_MGMT_DBG("Adding mgmt ucmd %p to prio ready cmd "
"list", ucmd);
TRACE_MGMT_DBG("Adding mgmt ucmd %p to prio ready cmd "
"list", ucmd);
list_add_tail(&ucmd->ready_cmd_list_entry,
&dev->prio_ready_cmd_list);
wake_up(&dev->prio_cmd_list_waitQ);
@@ -1081,7 +1081,7 @@ out_unmap:
PRINT_ERROR("Failed to get %d user pages (rc %d)",
ucmd->num_data_pages, rc);
if (rc > 0) {
for(i = 0; i < rc; i++)
for (i = 0; i < rc; i++)
page_cache_release(ucmd->data_pages[i]);
}
kfree(ucmd->data_pages);
@@ -1369,7 +1369,7 @@ static int dev_user_process_reply(struct scst_user_dev *dev,
unlock_process:
spin_unlock_irq(&dev->cmd_lists.cmd_list_lock);
switch(state) {
switch (state) {
case UCMD_STATE_PARSING:
res = dev_user_process_reply_parse(ucmd, reply);
break;
@@ -1527,7 +1527,7 @@ again:
spin_lock_irq(&dev->cmd_lists.cmd_list_lock);
} else if (unlikely(test_bit(SCST_CMD_ABORTED,
&u->cmd->cmd_flags))) {
switch(u->state) {
switch (u->state) {
case UCMD_STATE_PARSING:
case UCMD_STATE_BUF_ALLOCING:
TRACE_MGMT_DBG("Aborting ucmd %p", u);
@@ -1563,7 +1563,7 @@ static int dev_user_get_next_cmd(struct scst_user_dev *dev,
init_waitqueue_entry(&wait, current);
while(1) {
while (1) {
if (!test_cmd_lists(dev)) {
add_wait_queue_exclusive(&dev->cmd_lists.cmd_list_waitQ,
&wait);
@@ -1629,7 +1629,7 @@ static int dev_user_get_next_prio_cmd(struct scst_user_dev *dev,
init_waitqueue_entry(&wait, current);
while(1) {
while (1) {
if (!test_prio_cmd_list(dev)) {
add_wait_queue_exclusive(&dev->prio_cmd_list_waitQ,
&wait);
@@ -1878,7 +1878,7 @@ static void dev_user_unjam_cmd(struct scst_user_cmd *ucmd, int busy,
ucmd->state = state | UCMD_STATE_JAMMED_MASK;
switch(state) {
switch (state) {
case UCMD_STATE_PARSING:
case UCMD_STATE_BUF_ALLOCING:
if (test_bit(SCST_CMD_ABORTED, &ucmd->cmd->cmd_flags))
@@ -1934,7 +1934,7 @@ static void dev_user_unjam_cmd(struct scst_user_cmd *ucmd, int busy,
else
spin_unlock_irq(&dev->cmd_lists.cmd_list_lock);
switch(state) {
switch (state) {
case UCMD_STATE_ON_FREEING:
dev_user_process_reply_on_free(ucmd);
break;
@@ -1982,7 +1982,7 @@ static int __unjam_check_tgt_dev(struct scst_user_cmd *ucmd, int state,
if (ucmd->cmd->tgt_dev != tgt_dev)
goto out;
switch(state & ~UCMD_STATE_MASK) {
switch (state & ~UCMD_STATE_MASK) {
case UCMD_STATE_PARSING:
case UCMD_STATE_BUF_ALLOCING:
case UCMD_STATE_EXECING:
@@ -2000,7 +2000,7 @@ static int __unjam_check_tm(struct scst_user_cmd *ucmd, int state)
{
int res = 0;
switch(state & ~UCMD_STATE_MASK) {
switch (state & ~UCMD_STATE_MASK) {
case UCMD_STATE_PARSING:
case UCMD_STATE_BUF_ALLOCING:
case UCMD_STATE_EXECING:
@@ -2032,7 +2032,7 @@ static void dev_user_unjam_dev(struct scst_user_dev *dev, int tm,
spin_lock_irqsave(&dev->cmd_lists.cmd_list_lock, flags);
repeat:
for(i = 0; i < (int)ARRAY_SIZE(dev->ucmd_hash); i++) {
for (i = 0; i < (int)ARRAY_SIZE(dev->ucmd_hash); i++) {
struct list_head *head = &dev->ucmd_hash[i];
list_for_each_entry(ucmd, head, hash_list_entry) {
TRACE_DBG("ALL: ucmd %p, state %x, scst_cmd %p",
@@ -2394,13 +2394,13 @@ out_nomem:
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void dev_user_pre_unreg_sess_work_fn(void *p)
#else
static void dev_user_pre_unreg_sess_work_fn(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
struct scst_user_pre_unreg_sess_obj *pd = (struct scst_user_pre_unreg_sess_obj*)p;
#else
struct scst_user_pre_unreg_sess_obj *pd = container_of(
@@ -2442,7 +2442,7 @@ static void dev_user_pre_unreg_sess(struct scst_tgt_dev *tgt_dev)
pd = kzalloc(sizeof(*pd), GFP_KERNEL|__GFP_NOFAIL);
pd->tgt_dev = tgt_dev;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&pd->pre_unreg_sess_work, dev_user_pre_unreg_sess_work_fn, pd);
#else
INIT_DELAYED_WORK(&pd->pre_unreg_sess_work, dev_user_pre_unreg_sess_work_fn);
@@ -2525,7 +2525,7 @@ static void dev_user_setup_functions(struct scst_user_dev *dev)
dev->devtype.dev_done = NULL;
if (dev->parse_type != SCST_USER_PARSE_CALL) {
switch(dev->devtype.type) {
switch (dev->devtype.type) {
case TYPE_DISK:
dev->generic_parse = scst_sbc_generic_parse;
dev->devtype.dev_done = dev_user_disk_done;
@@ -2611,7 +2611,7 @@ static int dev_user_register_dev(struct file *file,
if (res != 0)
goto out;
switch(dev_desc->type) {
switch (dev_desc->type) {
case TYPE_DISK:
case TYPE_ROM:
case TYPE_MOD:
@@ -2988,7 +2988,7 @@ static void dev_user_process_cleanup(struct scst_user_dev *dev)
dev->cleaning = 1;
dev->blocking = 1;
while(1) {
while (1) {
TRACE_DBG("Cleanuping dev %p", dev);
dev_user_unjam_dev(dev, 0, NULL);
@@ -3007,7 +3007,7 @@ static void dev_user_process_cleanup(struct scst_user_dev *dev)
#ifdef EXTRACHECKS
{
int i;
for(i = 0; i < (int)ARRAY_SIZE(dev->ucmd_hash); i++) {
for (i = 0; i < (int)ARRAY_SIZE(dev->ucmd_hash); i++) {
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) {
@@ -3044,7 +3044,7 @@ static int dev_user_cleanup_thread(void *arg)
current->flags |= PF_NOFREEZE;
spin_lock(&cleanup_lock);
while(!kthread_should_stop()) {
while (!kthread_should_stop()) {
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
+63 -63
View File
@@ -430,7 +430,7 @@ static int vdisk_attach(struct scst_device *dev)
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
if ((fd->f_op == NULL) || (fd->f_op->readv == NULL) ||
(fd->f_op->writev == NULL))
#else
@@ -463,7 +463,7 @@ static int vdisk_attach(struct scst_device *dev)
res = -EINVAL;
filp_close(fd, NULL);
goto out;
}
}
err = inode->i_size;
filp_close(fd, NULL);
@@ -565,7 +565,7 @@ static struct scst_vdisk_thr *vdisk_init_thr_data(
TRACE_ENTRY();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
res = kmem_cache_alloc(vdisk_thr_cachep, GFP_KERNEL);
if (res != NULL)
memset(res, 0, sizeof(*res));
@@ -646,7 +646,7 @@ static void vdisk_detach_tgt(struct scst_tgt_dev *tgt_dev)
static inline int vdisk_sync_queue_type(enum scst_cmd_queue_type qt)
{
switch(qt) {
switch (qt) {
case SCST_CMD_QUEUE_ORDERED:
case SCST_CMD_QUEUE_HEAD_OF_QUEUE:
return 1;
@@ -688,7 +688,7 @@ static int vdisk_do_job(struct scst_cmd *cmd)
goto out;
}
switch(cmd->queue_type) {
switch (cmd->queue_type) {
case SCST_CMD_QUEUE_ORDERED:
TRACE(TRACE_ORDER, "ORDERED cmd %p", cmd);
break;
@@ -774,7 +774,7 @@ static int vdisk_do_job(struct scst_cmd *cmd)
lba_start, (uint64_t)loff, (uint64_t)data_len);
if (unlikely(loff < 0) || unlikely(data_len < 0) ||
unlikely((loff + data_len) > virt_dev->file_size)) {
PRINT_INFO("Access beyond the end of the device "
PRINT_INFO("Access beyond the end of the device "
"(%lld of %lld, len %Ld)", (uint64_t)loff,
(uint64_t)virt_dev->file_size, (uint64_t)data_len);
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(
@@ -819,11 +819,11 @@ static int vdisk_do_job(struct scst_cmd *cmd)
ftgt_dev->last_write_cmd_queue_type;
ftgt_dev->last_write_cmd_queue_type = cmd->queue_type;
if (vdisk_need_pre_sync(cmd->queue_type, last_queue_type)) {
TRACE(TRACE_ORDER, "ORDERED "
"WRITE(%d): loff=%Ld, data_len=%Ld",
cmd->queue_type, (uint64_t)loff,
(uint64_t)data_len);
do_fsync = 1;
TRACE(TRACE_ORDER, "ORDERED "
"WRITE(%d): loff=%Ld, data_len=%Ld",
cmd->queue_type, (uint64_t)loff,
(uint64_t)data_len);
do_fsync = 1;
if (vdisk_fsync(thr, 0, 0, cmd) != 0)
goto out_compl;
}
@@ -837,9 +837,9 @@ static int vdisk_do_job(struct scst_cmd *cmd)
vdisk_fsync(thr, loff, data_len, cmd);
} else {
TRACE(TRACE_MINOR, "Attempt to write to read-only "
"device %s", virt_dev->name);
"device %s", virt_dev->name);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_data_protect));
SCST_LOAD_SENSE(scst_sense_data_protect));
}
break;
case WRITE_VERIFY:
@@ -854,11 +854,11 @@ static int vdisk_do_job(struct scst_cmd *cmd)
ftgt_dev->last_write_cmd_queue_type;
ftgt_dev->last_write_cmd_queue_type = cmd->queue_type;
if (vdisk_need_pre_sync(cmd->queue_type, last_queue_type)) {
TRACE(TRACE_ORDER, "ORDERED "
"WRITE_VERIFY(%d): loff=%Ld, data_len=%Ld",
cmd->queue_type, (uint64_t)loff,
(uint64_t)data_len);
do_fsync = 1;
TRACE(TRACE_ORDER, "ORDERED "
"WRITE_VERIFY(%d): loff=%Ld, data_len=%Ld",
cmd->queue_type, (uint64_t)loff,
(uint64_t)data_len);
do_fsync = 1;
if (vdisk_fsync(thr, 0, 0, cmd) != 0)
goto out_compl;
}
@@ -873,7 +873,7 @@ static int vdisk_do_job(struct scst_cmd *cmd)
TRACE(TRACE_MINOR, "Attempt to write to read-only "
"device %s", virt_dev->name);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_data_protect));
SCST_LOAD_SENSE(scst_sense_data_protect));
}
break;
case SYNCHRONIZE_CACHE:
@@ -937,7 +937,7 @@ static int vdisk_do_job(struct scst_cmd *cmd)
case READ_CAPACITY:
vdisk_exec_read_capacity(cmd);
break;
case SERVICE_ACTION_IN:
case SERVICE_ACTION_IN:
if ((cmd->cdb[1] & 0x1f) == SAI_READ_CAPACITY_16) {
vdisk_exec_read_capacity16(cmd);
break;
@@ -1307,14 +1307,14 @@ static int vdisk_format_pg(unsigned char *p, int pcontrol,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x40, 0, 0, 0};
memcpy(p, format_pg, sizeof(format_pg));
p[10] = (DEF_SECTORS_PER >> 8) & 0xff;
p[11] = DEF_SECTORS_PER & 0xff;
p[12] = (virt_dev->block_size >> 8) & 0xff;
p[13] = virt_dev->block_size & 0xff;
if (1 == pcontrol)
memset(p + 2, 0, sizeof(format_pg) - 2);
return sizeof(format_pg);
memcpy(p, format_pg, sizeof(format_pg));
p[10] = (DEF_SECTORS_PER >> 8) & 0xff;
p[11] = DEF_SECTORS_PER & 0xff;
p[12] = (virt_dev->block_size >> 8) & 0xff;
p[13] = virt_dev->block_size & 0xff;
if (1 == pcontrol)
memset(p + 2, 0, sizeof(format_pg) - 2);
return sizeof(format_pg);
}
static int vdisk_caching_pg(unsigned char *p, int pcontrol,
@@ -1337,7 +1337,7 @@ static int vdisk_ctrl_m_pg(unsigned char *p, int pcontrol,
0, 0, 0x2, 0x4b};
memcpy(p, ctrl_m_pg, sizeof(ctrl_m_pg));
switch(pcontrol) {
switch (pcontrol) {
case 0:
p[2] |= virt_dev->dev->tst << 5;
p[3] |= virt_dev->dev->queue_alg << 4;
@@ -1372,7 +1372,7 @@ static int vdisk_iec_m_pg(unsigned char *p, int pcontrol,
struct scst_vdisk_dev *virt_dev)
{ /* Informational Exceptions control mode page for mode_sense */
const unsigned char iec_m_pg[] = {0x1c, 0xa, 0x08, 0, 0, 0, 0, 0,
0, 0, 0x0, 0x0};
0, 0, 0x0, 0x0};
memcpy(p, iec_m_pg, sizeof(iec_m_pg));
if (1 == pcontrol)
memset(p + 2, 0, sizeof(iec_m_pg) - 2);
@@ -1479,10 +1479,10 @@ static void vdisk_exec_mode_sense(struct scst_cmd *cmd)
len = vdisk_disconnect_pg(bp, pcontrol, virt_dev);
offset += len;
break;
case 0x3: /* Format device page, direct access */
len = vdisk_format_pg(bp, pcontrol, virt_dev);
offset += len;
break;
case 0x3: /* Format device page, direct access */
len = vdisk_format_pg(bp, pcontrol, virt_dev);
offset += len;
break;
case 0x8: /* Caching page, direct access */
len = vdisk_caching_pg(bp, pcontrol, virt_dev);
offset += len;
@@ -1524,7 +1524,7 @@ static void vdisk_exec_mode_sense(struct scst_cmd *cmd)
out_put:
scst_put_buf(cmd, address);
if (offset < cmd->resp_data_len)
scst_set_resp_data_len(cmd, offset);
scst_set_resp_data_len(cmd, offset);
out_free:
kfree(buf);
@@ -1603,7 +1603,7 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd)
if (address[offset] & PS) {
PRINT_ERROR("%s", "MODE SELECT: Illegal PS bit");
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(
scst_sense_invalid_field_in_parm_list));
scst_sense_invalid_field_in_parm_list));
goto out_put;
}
if ((address[offset] & 0x3f) == 0x8) { /* Caching page */
@@ -1611,7 +1611,7 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd)
PRINT_ERROR("%s", "MODE SELECT: Invalid "
"caching page request");
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(
scst_sense_invalid_field_in_parm_list));
scst_sense_invalid_field_in_parm_list));
goto out_put;
}
if (vdisk_set_wt(virt_dev,
@@ -1630,7 +1630,7 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd)
PRINT_ERROR("%s", "MODE SELECT: Invalid "
"control page request");
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(
scst_sense_invalid_field_in_parm_list));
scst_sense_invalid_field_in_parm_list));
goto out_put;
}
#endif
@@ -1638,7 +1638,7 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd)
PRINT_ERROR("MODE SELECT: Invalid request %x",
address[offset] & 0x3f);
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(
scst_sense_invalid_field_in_parm_list));
scst_sense_invalid_field_in_parm_list));
goto out_put;
}
offset += address[offset + 1];
@@ -1823,15 +1823,15 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd)
buffer[3] = 0x01; /* Last Track/Session */
off = 4;
if (cmd->cdb[6] <= 1)
{
{
/* Fistr TOC Track Descriptor */
buffer[off+1] = 0x14; /* ADDR 0x10 - Q Sub-channel encodes current position data
CONTROL 0x04 - Data track, recoreded uninterrupted */
buffer[off+2] = 0x01; /* Track Number */
off += 8;
}
}
if (!(cmd->cdb[2] & 0x01))
{
{
/* Lead-out area TOC Track Descriptor */
buffer[off+1] = 0x14;
buffer[off+2] = 0xAA; /* Track Number */
@@ -1840,7 +1840,7 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd)
buffer[off+6] = (nblocks >> (BYTE * 1)) & 0xFF;
buffer[off+7] = (nblocks >> (BYTE * 0)) & 0xFF;
off += 8;
}
}
buffer[1] = off - 2; /* Data Length */
@@ -1851,7 +1851,7 @@ static void vdisk_exec_read_toc(struct scst_cmd *cmd)
scst_put_buf(cmd, address);
if (off < cmd->resp_data_len)
scst_set_resp_data_len(cmd, off);
scst_set_resp_data_len(cmd, off);
out:
TRACE_EXIT();
@@ -1936,7 +1936,7 @@ out:
/*
* copied from <ksrc>/fs/read_write.*
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
static void wait_on_retry_sync_kiocb(struct kiocb *iocb)
{
set_current_state(TASK_UNINTERRUPTIBLE);
@@ -2033,7 +2033,7 @@ static void vdisk_exec_read(struct scst_cmd *cmd,
goto out_set_fs;
}
/* READ */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
err = fd->f_op->readv(fd, iv, iv_count, &fd->f_pos);
#else
err = do_sync_readv_writev(fd, iv, iv_count, full_len, &fd->f_pos, fd->f_op->aio_read);
@@ -2056,7 +2056,7 @@ out_set_fs:
set_fs(old_fs);
out_put:
for(; i >= 0; i--)
for (; i >= 0; i--)
scst_put_buf(cmd, iv[i].iov_base);
out:
@@ -2113,9 +2113,9 @@ restart:
else {
/* SEEK */
if (fd->f_op->llseek) {
err = fd->f_op->llseek(fd, loff, 0 /*SEEK_SET */ );
err = fd->f_op->llseek(fd, loff, 0 /*SEEK_SET */);
} else {
err = default_llseek(fd, loff, 0 /*SEEK_SET */ );
err = default_llseek(fd, loff, 0 /*SEEK_SET */);
}
if (err != loff) {
PRINT_ERROR("lseek trouble %Ld != %Ld", (uint64_t)err,
@@ -2126,7 +2126,7 @@ restart:
}
/* WRITE */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
err = fd->f_op->writev(fd, eiv, eiv_count, &fd->f_pos);
#else
err = do_sync_readv_writev(fd, iv, iv_count, full_len, &fd->f_pos,
@@ -2158,7 +2158,7 @@ restart:
"%zd (iv_count=%d)", full_len, eiv_count);
}
full_len -= err;
for(i = 0; i < e; i++) {
for (i = 0; i < e; i++) {
if (eiv->iov_len < err) {
err -= eiv->iov_len;
eiv++;
@@ -2203,7 +2203,7 @@ static inline void blockio_check_finish(struct blockio_work *blockio_work)
}
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
static int blockio_endio(struct bio *bio, unsigned int bytes_done, int error)
#else
static void blockio_endio(struct bio *bio, int error)
@@ -2211,7 +2211,7 @@ static void blockio_endio(struct bio *bio, int error)
{
struct blockio_work *blockio_work = bio->bi_private;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
if (bio->bi_size)
return 1;
#endif
@@ -2237,7 +2237,7 @@ static void blockio_endio(struct bio *bio, int error)
blockio_check_finish(blockio_work);
bio_put(bio);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
return 0;
#else
return;
@@ -2263,7 +2263,7 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr,
goto out;
/* Allocate and initialize blockio_work struct */
blockio_work = kmalloc(sizeof (*blockio_work), GFP_KERNEL);
blockio_work = kmalloc(sizeof(*blockio_work), GFP_KERNEL);
if (blockio_work == NULL)
goto out_no_mem;
@@ -2277,7 +2277,7 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr,
need_new_bio = 1;
length = scst_get_buf_first(cmd, &address);
while(length > 0) {
while (length > 0) {
int len, bytes, off, thislen;
uint8_t *addr;
u64 lba_start0;
@@ -2311,10 +2311,10 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr,
#if 0 /* It could be win, but could be not, so a performance study is needed */
bio->bi_rw |= 1 << BIO_RW_SYNC;
#endif
if (!hbio)
hbio = tbio = bio;
else
tbio = tbio->bi_next = bio;
if (!hbio)
hbio = tbio = bio;
else
tbio = tbio->bi_next = bio;
}
bytes = min_t(unsigned int, len, PAGE_SIZE - off);
@@ -2393,7 +2393,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd,
/*
* Until the cache is cleared prior the verifying, there is not
* much point in this code. ToDo.
* much point in this code. ToDo.
*
* Nevertherless, this code is valuable if the data have not read
* from the file/disk yet.
@@ -2422,7 +2422,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd,
PRINT_ERROR("Unable to allocate memory %d for verify",
LEN_MEM);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_hardw_error));
SCST_LOAD_SENSE(scst_sense_hardw_error));
goto out_set_fs;
}
@@ -3075,7 +3075,7 @@ static int vcdrom_change(char *p, char *name)
virt_dev->file_name, res);
goto out_free;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
if ((fd->f_op == NULL) || (fd->f_op->readv == NULL)) {
#else
if ((fd->f_op == NULL) || (fd->f_op->aio_read == NULL)) {
+1 -1
View File
@@ -347,7 +347,7 @@ static const struct scst_sdbops scst_scsi_op_table[] = {
{0x5E, "OOOOO OOOO ", "PERSISTENT_RESERV_IN",
SCST_DATA_READ, FLAG_NONE, 5, get_trans_len_4},
{0x5F, "OOOOO OOOO ", "PERSISTENT_RESERV_OUT",
SCST_DATA_WRITE, FLAG_NONE, 5, get_trans_len_4},
SCST_DATA_WRITE, FLAG_NONE, 5, get_trans_len_4},
/* 16-bytes length CDB */
{0x80, "O OO O ", "XDWRITE EXTENDED",
+1 -1
View File
@@ -31,7 +31,7 @@ static spinlock_t trace_buf_lock = SPIN_LOCK_UNLOCKED;
static inline int get_current_tid(void)
{
/* Code should be the same as in sys_gettid() */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
return current->pid;
#else
return task_pid_vnr(current);
+33 -33
View File
@@ -188,7 +188,7 @@ void scst_set_resp_data_len(struct scst_cmd *cmd, int resp_data_len)
goto out;
l = 0;
for(i = 0; i < cmd->sg_cnt; i++) {
for (i = 0; i < cmd->sg_cnt; i++) {
l += cmd->sg[i].length;
if (l >= resp_data_len) {
int left = resp_data_len - (l - cmd->sg[i].length);
@@ -280,7 +280,7 @@ struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg,
TRACE_ENTRY();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
res = kmem_cache_alloc(scst_acgd_cachep, GFP_KERNEL);
#else
res = kmem_cache_zalloc(scst_acgd_cachep, GFP_KERNEL);
@@ -289,7 +289,7 @@ struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg,
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_acg_dev failed");
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
memset(res, 0, sizeof(*res));
#endif
@@ -403,7 +403,7 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess,
TRACE_ENTRY();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
tgt_dev = kmem_cache_alloc(scst_tgtd_cachep, GFP_KERNEL);
#else
tgt_dev = kmem_cache_zalloc(scst_tgtd_cachep, GFP_KERNEL);
@@ -413,7 +413,7 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess,
"Allocation of scst_tgt_dev failed");
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
memset(tgt_dev, 0, sizeof(*tgt_dev));
#endif
@@ -471,13 +471,13 @@ static struct scst_tgt_dev *scst_alloc_add_tgt_dev(struct scst_session *sess,
tgt_dev->expected_sn = 1;
tgt_dev->num_free_sn_slots = ARRAY_SIZE(tgt_dev->sn_slots)-1;
tgt_dev->cur_sn_slot = &tgt_dev->sn_slots[0];
for(i = 0; i < (int)ARRAY_SIZE(tgt_dev->sn_slots); i++)
for (i = 0; i < (int)ARRAY_SIZE(tgt_dev->sn_slots); i++)
atomic_set(&tgt_dev->sn_slots[i], 0);
if (dev->handler->parse_atomic &&
(sess->tgt->tgtt->preprocessing_done == NULL)) {
if (sess->tgt->tgtt->rdy_to_xfer_atomic ||
(sess->tgt->tgtt->rdy_to_xfer == NULL))
if (sess->tgt->tgtt->rdy_to_xfer_atomic ||
(sess->tgt->tgtt->rdy_to_xfer == NULL))
__set_bit(SCST_TGT_DEV_AFTER_INIT_WR_ATOMIC,
&tgt_dev->tgt_dev_flags);
if (dev->handler->exec_atomic || (dev->handler->exec == NULL))
@@ -658,7 +658,7 @@ void scst_sess_free_tgt_devs(struct scst_session *sess)
TRACE_ENTRY();
/* The session is going down, no users, so no locks */
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&sess->sess_tgt_dev_list_hash[i];
list_for_each_entry_safe(tgt_dev, t, sess_tgt_dev_list_head,
@@ -858,8 +858,8 @@ int scst_acg_remove_name(struct scst_acg *acg, const char *name)
{
if (strcmp(n->name, name) == 0) {
list_del(&n->acn_list_entry);
kfree(n->name);
kfree(n);
kfree(n->name);
kfree(n);
res = 0;
break;
}
@@ -997,7 +997,7 @@ struct scst_cmd *scst_complete_request_sense(struct scst_cmd *req_cmd)
return orig_cmd;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
static void scst_req_done(struct scsi_cmnd *scsi_cmd)
{
struct scsi_request *req;
@@ -1060,7 +1060,7 @@ out:
TRACE_EXIT();
return;
}
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
static void scst_send_release(struct scst_device *dev)
{
struct scsi_device *scsi_dev;
@@ -1078,7 +1078,7 @@ static void scst_send_release(struct scst_device *dev)
scsi_dev = dev->scsi_dev;
for(i = 0; i < 5; i++) {
for (i = 0; i < 5; i++) {
memset(cdb, 0, sizeof(cdb));
cdb[0] = RELEASE;
cdb[1] = (scsi_dev->scsi_level <= SCSI_2) ?
@@ -1109,7 +1109,7 @@ out:
TRACE_EXIT();
return;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
/* scst_mutex supposed to be held */
static void scst_clear_reservation(struct scst_tgt_dev *tgt_dev)
@@ -1151,7 +1151,7 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask,
TRACE_ENTRY();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
sess = kmem_cache_alloc(scst_sess_cachep, gfp_mask);
#else
sess = kmem_cache_zalloc(scst_sess_cachep, gfp_mask);
@@ -1161,14 +1161,14 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask,
"Allocation of scst_session failed");
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
memset(sess, 0, sizeof(*sess));
#endif
sess->init_phase = SCST_SESS_IPH_INITING;
sess->shut_phase = SCST_SESS_SPH_READY;
atomic_set(&sess->refcnt, 0);
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&sess->sess_tgt_dev_list_hash[i];
INIT_LIST_HEAD(sess_tgt_dev_list_head);
@@ -1284,7 +1284,7 @@ struct scst_cmd *scst_alloc_cmd(int gfp_mask)
TRACE_ENTRY();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
cmd = kmem_cache_alloc(scst_cmd_cachep, gfp_mask);
#else
cmd = kmem_cache_zalloc(scst_cmd_cachep, gfp_mask);
@@ -1293,7 +1293,7 @@ struct scst_cmd *scst_alloc_cmd(int gfp_mask)
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_cmd failed");
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
memset(cmd, 0, sizeof(*cmd));
#endif
@@ -1342,7 +1342,7 @@ void scst_free_cmd(struct scst_cmd *cmd)
sBUG_ON(cmd->inc_blocking || cmd->needs_unblocking ||
cmd->dec_on_dev_needed);
#if defined(EXTRACHECKS) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
#if defined(EXTRACHECKS) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
if (cmd->scsi_req) {
PRINT_ERROR("%s: %s", __FUNCTION__, "Cmd with unfreed "
"scsi_req!");
@@ -1513,7 +1513,7 @@ void scst_free_mgmt_cmd(struct scst_mgmt_cmd *mcmd)
return;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
int scst_alloc_request(struct scst_cmd *cmd)
{
int res = 0;
@@ -1852,7 +1852,7 @@ lun_t scst_unpack_lun(const uint8_t *lun, int len)
}
if (len > 2) {
switch(len) {
switch (len) {
case 8:
if ((*((uint64_t*)lun) &
__constant_cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0)
@@ -1932,7 +1932,7 @@ int scst_calc_block_shift(int sector_size)
sector_size = 512;
t = sector_size;
while(1) {
while (1) {
if ((t & 1) != 0)
break;
t >>= 1;
@@ -2322,7 +2322,7 @@ int scst_obtain_device_parameters(struct scst_device *dev)
sBUG_ON(in_interrupt() || in_atomic());
EXTRACHECKS_BUG_ON(dev->scsi_dev == NULL);
for(i = 0; i < 5; i++) {
for (i = 0; i < 5; i++) {
/* Get control mode page */
memset(cmd, 0, sizeof(cmd));
cmd[0] = MODE_SENSE;
@@ -2390,14 +2390,14 @@ int scst_obtain_device_parameters(struct scst_device *dev)
dev->scsi_dev->channel, dev->scsi_dev->id,
dev->scsi_dev->lun, dev->tst, dev->queue_alg,
dev->swp, dev->tas, dev->has_own_order_mgmt);
res = 0;
res = 0;
goto out;
} else if (sense_buffer[2] == NOT_READY) {
TRACE(TRACE_SCSI, "Device %d:%d:%d:%d not ready",
dev->scsi_dev->host->host_no,
dev->scsi_dev->channel, dev->scsi_dev->id,
dev->scsi_dev->lun);
res = 0;
res = 0;
goto out;
}
} else {
@@ -3201,9 +3201,9 @@ void tm_dbg_init_tgt_dev(struct scst_tgt_dev *tgt_dev,
struct scst_acg_dev *acg_dev)
{
if ((acg_dev->acg == scst_default_acg) && (acg_dev->lun == 0)) {
unsigned long flags;
/* Do TM debugging only for LUN 0 */
spin_lock_irqsave(&scst_tm_dbg_lock, flags);
unsigned long flags;
/* Do TM debugging only for LUN 0 */
spin_lock_irqsave(&scst_tm_dbg_lock, flags);
tm_dbg_p_cmd_list_waitQ =
&tgt_dev->dev->p_cmd_lists->cmd_list_waitQ;
tm_dbg_state = INIT_TM_DBG_STATE;
@@ -3238,7 +3238,7 @@ static void tm_dbg_timer_fn(unsigned long arg)
/* Called under scst_tm_dbg_lock and IRQs off */
static void tm_dbg_delay_cmd(struct scst_cmd *cmd)
{
switch(tm_dbg_state) {
switch (tm_dbg_state) {
case TM_DBG_STATE_ABORT:
if (tm_dbg_delayed_cmds_count == 0) {
unsigned long d = 58*HZ + (scst_random() % (4*HZ));
@@ -3308,7 +3308,7 @@ static void tm_dbg_change_state(void)
{
tm_dbg_flags.tm_dbg_blocked = 0;
if (--tm_dbg_on_state_passes == 0) {
switch(tm_dbg_state) {
switch (tm_dbg_state) {
case TM_DBG_STATE_ABORT:
TRACE_MGMT_DBG("%s", "Changing "
"tm_dbg_state to RESET");
@@ -3481,7 +3481,7 @@ void scst_check_debug_sn(struct scst_cmd *cmd)
type = SCST_CMD_QUEUE_ORDERED;
do {
cnt = scst_random() % 10;
} while(cnt == 0);
} while (cnt == 0);
} else
goto out_unlock;
}
+10 -10
View File
@@ -33,23 +33,23 @@
#include "scst_mem.h"
#if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G)
#warning HIGHMEM kernel configurations are fully supported, but not \
#warning "HIGHMEM kernel configurations are fully supported, but not \
recommended for performance reasons. Consider change VMSPLIT \
option or use 64-bit configuration instead. See README file for \
details.
details."
#endif
#ifdef SCST_HIGHMEM
#error SCST_HIGHMEM configuration isn't supported and broken, because there \
#error "SCST_HIGHMEM configuration isn't supported and broken, because there \
is no real point to support it, at least it definitely doesn't worth \
the effort. Better use no-HIGHMEM kernel with VMSPLIT option \
or in 64-bit configuration instead. See README file for details.
or in 64-bit configuration instead. See README file for details."
#endif
#if !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && !defined(STRICT_SERIALIZING)
#warning Patch scst_exec_req_fifo-<kernel-version>.patch was not applied on \
#warning "Patch scst_exec_req_fifo-<kernel-version>.patch was not applied on \
your kernel and STRICT_SERIALIZING isn't defined. Pass-through dev \
handlers will not be supported.
handlers will not be supported."
#endif
/**
@@ -1038,7 +1038,7 @@ void scst_del_dev_threads(struct scst_device *dev, int num)
}
list_del(&ct->thread_list_entry);
kfree(ct);
if ((num >0) && (++i >= num))
if ((num > 0) && (++i >= num))
break;
}
@@ -1359,7 +1359,7 @@ void scst_put(void)
__scst_put();
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
static int scst_add(struct class_device *cdev)
#else
static int scst_add(struct class_device *cdev, struct class_interface *intf)
@@ -1377,7 +1377,7 @@ static int scst_add(struct class_device *cdev, struct class_interface *intf)
return res;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
static void scst_remove(struct class_device *cdev)
#else
static void scst_remove(struct class_device *cdev, struct class_interface *intf)
@@ -1477,7 +1477,7 @@ static int __init init_scst(void)
TRACE_ENTRY();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
{
struct scsi_request *req;
BUILD_BUG_ON(SCST_SENSE_BUFFERSIZE !=
+29 -29
View File
@@ -106,7 +106,7 @@ static int scst_check_clustering(struct scatterlist *sg, int cur, int hint)
}
/* ToDo: implement more intelligent search */
for(i = cur - 1; i >= 0; i--) {
for (i = cur - 1; i >= 0; i--) {
pfn = page_to_pfn(sg_page(&sg[i]));
pfn_next = pfn + (sg[i].length >> PAGE_SHIFT);
full_page = (sg[i].length & (PAGE_SIZE - 1)) == 0;
@@ -144,7 +144,7 @@ static void scst_free_sys_sg_entries(struct scatterlist *sg, int sg_count,
TRACE_MEM("sg=%p, sg_count=%d", sg, sg_count);
for(i = 0; i < sg_count; i++) {
for (i = 0; i < sg_count; i++) {
struct page *p = sg_page(&sg[i]);
int len = sg[i].length;
int pages =
@@ -153,7 +153,7 @@ static void scst_free_sys_sg_entries(struct scatterlist *sg, int sg_count,
TRACE_MEM("page %lx, len %d, pages %d",
(unsigned long)p, len, pages);
while(pages > 0) {
while (pages > 0) {
int order = 0;
/*
@@ -162,7 +162,7 @@ static void scst_free_sys_sg_entries(struct scatterlist *sg, int sg_count,
*/
#if 0
if (len > 0) {
while(((1 << order) << PAGE_SHIFT) < len)
while (((1 << order) << PAGE_SHIFT) < len)
order++;
len = 0;
}
@@ -209,7 +209,7 @@ static int scst_alloc_sg_entries(struct scatterlist *sg, int pages,
gfp_mask |= __GFP_ZERO;
#endif
for(pg = 0; pg < pages; pg++) {
for (pg = 0; pg < pages; pg++) {
void *rc;
#ifdef DEBUG_OOM
if (((gfp_mask & __GFP_NOFAIL) != __GFP_NOFAIL) &&
@@ -233,11 +233,11 @@ static int scst_alloc_sg_entries(struct scatterlist *sg, int pages,
if (clustered && (trans_tbl != NULL)) {
pg = 0;
for(i = 0; i < pages; i++) {
for (i = 0; i < pages; i++) {
int n = (sg[i].length >> PAGE_SHIFT) +
((sg[i].length & ~PAGE_MASK) != 0);
trans_tbl[i].pg_count = pg;
for(j = 0; j < n; j++)
for (j = 0; j < n; j++)
trans_tbl[pg++].sg_num = i+1;
TRACE_MEM("i=%d, n=%d, pg_count=%d", i, n,
trans_tbl[i].pg_count);
@@ -265,12 +265,12 @@ static int sgv_alloc_arrays(struct sgv_pool_obj *obj,
sz = pages_to_alloc * sizeof(obj->sg_entries[0]);
obj->sg_entries = (struct scatterlist*)kmalloc(sz, gfp_mask);
if (unlikely(obj->sg_entries == NULL)) {
if (unlikely(obj->sg_entries == NULL)) {
TRACE(TRACE_OUT_OF_MEM, "Allocation of sgv_pool_obj "
"SG vector failed (size %d)", sz);
res = -ENOMEM;
goto out;
}
}
sg_init_table(obj->sg_entries, pages_to_alloc);
@@ -284,12 +284,12 @@ static int sgv_alloc_arrays(struct sgv_pool_obj *obj,
} else {
tsz = pages_to_alloc * sizeof(obj->trans_tbl[0]);
obj->trans_tbl = (struct trans_tbl_ent*)kzalloc(tsz, gfp_mask);
if (unlikely(obj->trans_tbl == NULL)) {
if (unlikely(obj->trans_tbl == NULL)) {
TRACE(TRACE_OUT_OF_MEM, "Allocation of trans_tbl "
"failed (size %d)", tsz);
res = -ENOMEM;
goto out_free;
}
}
}
}
@@ -445,7 +445,7 @@ static int sgv_pool_cached_purge(struct sgv_pool_obj *e, int t,
static int sgv_pool_oom_free_objs(int pgs)
{
TRACE_MEM("Shrinking pools about %d pages", pgs);
while((sgv_pools_mgr.mgr.thr.inactive_pages_total >
while ((sgv_pools_mgr.mgr.thr.inactive_pages_total >
sgv_pools_mgr.mgr.thr.lo_wmk) &&
(pgs > 0)) {
struct sgv_pool_obj *e;
@@ -809,7 +809,7 @@ void scst_free(struct scatterlist *sg, int count)
static void sgv_pool_cached_init(struct sgv_pool *pool)
{
int i;
for(i = 0; i < SGV_POOL_ELEMENTS; i++) {
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
INIT_LIST_HEAD(&pool->recycling_lists[i]);
}
}
@@ -841,7 +841,7 @@ int sgv_pool_init(struct sgv_pool *pool, const char *name, int clustered)
strncpy(pool->name, name, sizeof(pool->name)-1);
pool->name[sizeof(pool->name)-1] = '\0';
for(i = 0; i < SGV_POOL_ELEMENTS; i++) {
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
int size;
atomic_set(&pool->cache_acc[i].total_alloc, 0);
@@ -869,7 +869,7 @@ int sgv_pool_init(struct sgv_pool *pool, const char *name, int clustered)
"%s-%luK", name, (PAGE_SIZE >> 10) << i);
pool->caches[i] = kmem_cache_create(pool->cache_names[i],
size, 0, SCST_SLAB_FLAGS, NULL
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
, NULL);
#else
);
@@ -895,7 +895,7 @@ out:
return res;
out_free:
for(i = 0; i < SGV_POOL_ELEMENTS; i++) {
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
if (pool->caches[i]) {
kmem_cache_destroy(pool->caches[i]);
pool->caches[i] = NULL;
@@ -943,11 +943,11 @@ void sgv_pool_deinit(struct sgv_pool *pool)
list_del(&pool->sgv_pool_list_entry);
mutex_unlock(&sgv_pools_mgr.scst_sgv_pool_mutex);
for(i = 0; i < SGV_POOL_ELEMENTS; i++) {
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
struct sgv_pool_obj *e;
spin_lock_bh(&sgv_pools_mgr.mgr.pool_mgr_lock);
while(!list_empty(&pool->recycling_lists[i])) {
while (!list_empty(&pool->recycling_lists[i])) {
e = list_entry(pool->recycling_lists[i].next,
struct sgv_pool_obj,
recycle_entry.recycling_list_entry);
@@ -1026,7 +1026,7 @@ static int sgv_pool_cached_shrinker(int nr, gfp_t gfpm)
struct sgv_pool_obj *e;
unsigned long rt = jiffies;
while(!list_empty(&sgv_pools_mgr.mgr.sorted_recycling_list)) {
while (!list_empty(&sgv_pools_mgr.mgr.sorted_recycling_list)) {
e = list_entry(
sgv_pools_mgr.mgr.sorted_recycling_list.next,
struct sgv_pool_obj,
@@ -1065,7 +1065,7 @@ static void sgv_pool_cached_pitbool(void *p)
sgv_pools_mgr.mgr.pitbool_running = 0;
while(!list_empty(&sgv_pools_mgr.mgr.sorted_recycling_list)) {
while (!list_empty(&sgv_pools_mgr.mgr.sorted_recycling_list)) {
e = list_entry(sgv_pools_mgr.mgr.sorted_recycling_list.next,
struct sgv_pool_obj,
recycle_entry.sorted_recycling_list_entry);
@@ -1132,14 +1132,14 @@ int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark)
goto out_free_dma;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
INIT_DELAYED_WORK(&pools->mgr.apit_pool,
(void (*)(struct work_struct *))sgv_pool_cached_pitbool);
#else
INIT_WORK(&pools->mgr.apit_pool, sgv_pool_cached_pitbool, NULL);
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
pools->mgr.sgv_shrinker = set_shrinker(DEFAULT_SEEKS,
sgv_pool_cached_shrinker);
#else
@@ -1171,7 +1171,7 @@ void scst_sgv_pools_deinit(void)
TRACE_ENTRY();
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
remove_shrinker(pools->mgr.sgv_shrinker);
#else
unregister_shrinker(&pools->mgr.sgv_shrinker);
@@ -1197,7 +1197,7 @@ static void scst_do_sgv_read(struct seq_file *seq, const struct sgv_pool *pool)
int i, total = 0, hit = 0, merged = 0, allocated = 0;
int oa, om;
for(i = 0; i < SGV_POOL_ELEMENTS; i++) {
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
int t;
hit += atomic_read(&pool->cache_acc[i].hit_alloc);
@@ -1213,7 +1213,7 @@ static void scst_do_sgv_read(struct seq_file *seq, const struct sgv_pool *pool)
hit, total, (allocated != 0) ? merged*100/allocated : 0,
pool->acc.cached_pages, pool->acc.cached_entries);
for(i = 0; i < SGV_POOL_ELEMENTS; i++) {
for (i = 0; i < SGV_POOL_ELEMENTS; i++) {
int t = atomic_read(&pool->cache_acc[i].total_alloc) -
atomic_read(&pool->cache_acc[i].hit_alloc);
allocated = t * (1 << i);
@@ -1232,10 +1232,10 @@ static void scst_do_sgv_read(struct seq_file *seq, const struct sgv_pool *pool)
om = atomic_read(&pool->acc.other_merged);
seq_printf(seq, " %-40s %d/%-9d %d/%d\n", "big/other",
atomic_read(&pool->acc.big_alloc),
atomic_read(&pool->acc.other_alloc),
(allocated != 0) ? merged*100/allocated : 0,
(oa != 0) ? om/oa : 0);
atomic_read(&pool->acc.big_alloc),
atomic_read(&pool->acc.other_alloc),
(allocated != 0) ? merged*100/allocated : 0,
(oa != 0) ? om/oa : 0);
return;
}
+2 -2
View File
@@ -115,13 +115,13 @@ struct scst_sgv_pools_manager
u32 releases_failed;
} thr; /* protected by pool_mgr_lock */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23))
struct shrinker *sgv_shrinker;
#else
struct shrinker sgv_shrinker;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
struct delayed_work apit_pool;
#else
struct work_struct apit_pool;
+17 -17
View File
@@ -26,7 +26,7 @@
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
#include <scsi/scsi_request.h>
#endif
@@ -320,7 +320,7 @@ void scst_proccess_redirect_cmd(struct scst_cmd *cmd, int context,
void scst_check_retries(struct scst_tgt *tgt);
void scst_tgt_retry_timer_fn(unsigned long arg);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
int scst_alloc_request(struct scst_cmd *cmd);
void scst_release_request(struct scst_cmd *cmd);
@@ -328,13 +328,13 @@ static inline void scst_do_req(struct scsi_request *sreq,
const void *cmnd, void *buffer, unsigned bufflen,
void (*done)(struct scsi_cmnd *), int timeout, int retries)
{
#ifdef STRICT_SERIALIZING
#ifdef STRICT_SERIALIZING
scsi_do_req(sreq, cmnd, buffer, bufflen, done, timeout, retries);
#elif !defined(SCSI_EXEC_REQ_FIFO_DEFINED)
sBUG();
#else
#elif !defined(SCSI_EXEC_REQ_FIFO_DEFINED)
sBUG();
#else
scsi_do_req_fifo(sreq, cmnd, buffer, bufflen, done, timeout, retries);
#endif
#endif
}
#else
static inline int scst_exec_req(struct scsi_device *sdev,
@@ -342,16 +342,16 @@ static inline int scst_exec_req(struct scsi_device *sdev,
void *buffer, unsigned bufflen, int use_sg, int timeout, int retries,
void *privdata, void (*done)(void *, char *, int, int), gfp_t gfp)
{
#ifdef STRICT_SERIALIZING
#ifdef STRICT_SERIALIZING
return scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
bufflen, use_sg, timeout, retries, privdata, done, gfp);
#elif !defined(SCSI_EXEC_REQ_FIFO_DEFINED)
sBUG();
return -1;
#else
return scsi_execute_async_fifo(sdev, cmd, cmd_len, data_direction,
buffer, bufflen, use_sg, timeout, retries, privdata, done, gfp);
#endif
bufflen, use_sg, timeout, retries, privdata, done, gfp);
#elif !defined(SCSI_EXEC_REQ_FIFO_DEFINED)
sBUG();
return -1;
#else
return scsi_execute_async_fifo(sdev, cmd, cmd_len, data_direction,
buffer, bufflen, use_sg, timeout, retries, privdata, done, gfp);
#endif
}
#endif
@@ -571,7 +571,7 @@ static inline void scst_check_debug_sn(struct scst_cmd *cmd) {}
*/
static inline int scst_sn_before(__u32 seq1, __u32 seq2)
{
return (__s32)(seq1-seq2) < 0;
return (__s32)(seq1-seq2) < 0;
}
#endif /* __SCST_PRIV_H */
+6 -6
View File
@@ -172,7 +172,7 @@ static DEFINE_MUTEX(scst_proc_mutex);
#include <linux/ctype.h>
#if !defined(CONFIG_PPC) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
#if !defined(CONFIG_PPC) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22))
#if defined(DEBUG) || defined(TRACING)
static int strcasecmp(const char *s1, const char *s2)
@@ -196,7 +196,7 @@ static int strncasecmp(const char *s1, const char *s2, int n)
return c1 - c2;
}
#endif /* !CONFIG_PPC && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) */
#endif /* !CONFIG_PPC && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) */
#if defined(DEBUG) || defined(TRACING)
@@ -416,8 +416,8 @@ static int lat_info_show(struct seq_file *seq, void *v)
#if BITS_PER_LONG == 32
/* Unfortunately, do_div() doesn't work too well */
while(((proc_time & 0xFFFFFFFF00000000LL) != 0) ||
((scst_time & 0xFFFFFFFF00000000LL) != 0)) {
while (((proc_time & 0xFFFFFFFF00000000LL) != 0) ||
((scst_time & 0xFFFFFFFF00000000LL) != 0)) {
TRACE_DBG("%s", "Gathered time too big");
proc_time >>= 1;
scst_time >>= 1;
@@ -1873,7 +1873,7 @@ static struct scst_proc_data scst_sgv_proc_data = {
static int scst_groups_names_show(struct seq_file *seq, void *v)
{
int res = 0;
struct scst_acg *acg = (struct scst_acg *)seq->private;
struct scst_acg *acg = (struct scst_acg *)seq->private;
struct scst_acn *name;
TRACE_ENTRY();
@@ -2149,7 +2149,7 @@ struct proc_dir_entry *scst_create_proc_entry(struct proc_dir_entry * root,
int scst_single_seq_open(struct inode *inode, struct file *file)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
struct scst_proc_data *pdata = container_of(PDE(inode)->proc_fops,
struct scst_proc_data, seq_op);
#else
+47 -47
View File
@@ -125,11 +125,11 @@ static int scst_init_cmd(struct scst_cmd *cmd, int context)
(context == SCST_CONTEXT_DIRECT_ATOMIC)) &&
scst_cmd_is_expected_set(cmd)) {
if (cmd->expected_data_direction == SCST_DATA_WRITE) {
if ( !test_bit(SCST_TGT_DEV_AFTER_INIT_WR_ATOMIC,
if (!test_bit(SCST_TGT_DEV_AFTER_INIT_WR_ATOMIC,
&cmd->tgt_dev->tgt_dev_flags))
context = SCST_CONTEXT_THREAD;
} else {
if ( !test_bit(SCST_TGT_DEV_AFTER_INIT_OTH_ATOMIC,
if (!test_bit(SCST_TGT_DEV_AFTER_INIT_OTH_ATOMIC,
&cmd->tgt_dev->tgt_dev_flags))
context = SCST_CONTEXT_THREAD;
}
@@ -224,7 +224,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context)
if (cmd->search_cmd_list_entry.next == NULL)
list_add_tail(&cmd->search_cmd_list_entry,
&sess->search_cmd_list);
switch(sess->init_phase) {
switch (sess->init_phase) {
case SCST_SESS_IPH_SUCCESS:
break;
case SCST_SESS_IPH_INITING:
@@ -249,7 +249,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, int pref_context)
if (unlikely(cmd->lun == (lun_t)-1)) {
PRINT_ERROR("Wrong LUN %d, finishing cmd", -1);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_lun_not_supported));
SCST_LOAD_SENSE(scst_sense_lun_not_supported));
cmd->state = SCST_CMD_STATE_PRE_XMIT_RESP;
goto active;
}
@@ -482,7 +482,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd)
goto set_res;
if (unlikely((cmd->bufflen == 0) &&
(cmd->op_flags & SCST_UNKNOWN_LENGTH))) {
(cmd->op_flags & SCST_UNKNOWN_LENGTH))) {
PRINT_ERROR("Unknown data transfer length for opcode 0x%x "
"(handler %s, target %s)", cmd->cdb[0],
dev->handler->name, cmd->tgtt->name);
@@ -746,12 +746,12 @@ void scst_restart_cmd(struct scst_cmd *cmd, int status, int pref_context)
/* Small context optimization */
if ((pref_context == SCST_CONTEXT_TASKLET) ||
(pref_context == SCST_CONTEXT_DIRECT_ATOMIC)) {
if (cmd->data_direction == SCST_DATA_WRITE) {
if ( !test_bit(SCST_TGT_DEV_AFTER_RESTART_WR_ATOMIC,
if (cmd->data_direction == SCST_DATA_WRITE) {
if (!test_bit(SCST_TGT_DEV_AFTER_RESTART_WR_ATOMIC,
&cmd->tgt_dev->tgt_dev_flags))
pref_context = SCST_CONTEXT_THREAD;
} else {
if ( !test_bit(SCST_TGT_DEV_AFTER_RESTART_OTH_ATOMIC,
if (!test_bit(SCST_TGT_DEV_AFTER_RESTART_OTH_ATOMIC,
&cmd->tgt_dev->tgt_dev_flags))
pref_context = SCST_CONTEXT_THREAD;
}
@@ -913,7 +913,7 @@ void scst_proccess_redirect_cmd(struct scst_cmd *cmd, int context,
TRACE_DBG("Context: %x", context);
switch(context & ~SCST_CONTEXT_PROCESSABLE) {
switch (context & ~SCST_CONTEXT_PROCESSABLE) {
case SCST_CONTEXT_DIRECT_ATOMIC:
context &= ~SCST_CONTEXT_PROCESSABLE;
/* go through */
@@ -977,7 +977,7 @@ void scst_rx_data(struct scst_cmd *cmd, int status, int pref_context)
/* Small context optimization */
if ((pref_context == SCST_CONTEXT_TASKLET) ||
(pref_context == SCST_CONTEXT_DIRECT_ATOMIC)) {
if ( !test_bit(SCST_TGT_DEV_AFTER_RX_DATA_ATOMIC,
if (!test_bit(SCST_TGT_DEV_AFTER_RX_DATA_ATOMIC,
&cmd->tgt_dev->tgt_dev_flags))
pref_context = SCST_CONTEXT_THREAD;
}
@@ -1025,7 +1025,7 @@ static int scst_tgt_pre_exec(struct scst_cmd *cmd)
TRACE_DBG("pre_exec() returned %d", rc);
if (unlikely(rc != SCST_PREPROCESS_STATUS_SUCCESS)) {
switch(rc) {
switch (rc) {
case SCST_PREPROCESS_STATUS_ERROR_SENSE_SET:
cmd->state = SCST_CMD_STATE_PRE_DEV_DONE;
break;
@@ -1106,14 +1106,14 @@ static inline int scst_optimize_post_exec_context(struct scst_cmd *cmd,
{
if ((context == SCST_CONTEXT_TASKLET) ||
(context == SCST_CONTEXT_DIRECT_ATOMIC)) {
if ( !test_bit(SCST_TGT_DEV_AFTER_EXEC_ATOMIC,
if (!test_bit(SCST_TGT_DEV_AFTER_EXEC_ATOMIC,
&cmd->tgt_dev->tgt_dev_flags))
context = SCST_CONTEXT_THREAD;
}
return context;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
static inline struct scst_cmd *scst_get_cmd(struct scsi_cmnd *scsi_cmd,
struct scsi_request **req)
{
@@ -1164,7 +1164,7 @@ out:
TRACE_EXIT();
return;
}
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
static void scst_cmd_done(void *data, char *sense, int result, int resid)
{
struct scst_cmd *cmd;
@@ -1186,7 +1186,7 @@ out:
TRACE_EXIT();
return;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state)
{
@@ -1215,7 +1215,7 @@ static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state)
struct scatterlist *sg = cmd->sg;
TRACE_RECV_TOP("Exec'd %d S/G(s) at %p sg[0].page at "
"%p", cmd->sg_cnt, sg, (void*)sg_page(&sg[0]));
for(i = 0; i < cmd->sg_cnt; ++i) {
for (i = 0; i < cmd->sg_cnt; ++i) {
TRACE_BUFF_FLAG(TRACE_RCV_TOP,
"Exec'd sg", sg_virt(&sg[i]),
sg[i].length);
@@ -1286,7 +1286,7 @@ static int scst_report_luns_local(struct scst_cmd *cmd)
offs = 8;
/* sess->sess_tgt_dev_list_hash is protected by suspended activity */
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&cmd->sess->sess_tgt_dev_list_hash[i];
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
@@ -1407,7 +1407,7 @@ static int scst_reserve_local(struct scst_cmd *cmd)
PRINT_ERROR("RESERVE_10: 3rdPty RESERVE not implemented "
"(lun=%Ld)", (uint64_t)cmd->lun);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb));
SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb));
goto out_done;
}
@@ -1747,7 +1747,7 @@ static int scst_do_send_to_midlev(struct scst_cmd *cmd)
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
if (unlikely(scst_alloc_request(cmd) != 0)) {
if (scst_cmd_atomic(cmd)) {
rc = SCST_EXEC_NEED_THREAD;
@@ -1799,7 +1799,7 @@ out_rc_error:
out_error:
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
out_busy:
scst_set_busy(cmd);
/* go through */
@@ -1964,7 +1964,7 @@ static int scst_send_to_midlev(struct scst_cmd **active_cmd)
exec:
count = 0;
while(1) {
while (1) {
atomic_t *slot = cmd->sn_slot;
/* For HQ commands SN is not set */
int inc_expected_sn = !cmd->inc_expected_sn_on_done &&
@@ -2313,7 +2313,7 @@ static int scst_mode_select_checks(struct scst_cmd *cmd)
if (unlikely((cmd->cdb[0] == MODE_SELECT) ||
(cmd->cdb[0] == MODE_SELECT_10) ||
(cmd->cdb[0] == LOG_SELECT))) {
struct scst_device *dev = cmd->dev;
struct scst_device *dev = cmd->dev;
if (atomic && (dev->scsi_dev != NULL)) {
TRACE_DBG("%s", "MODE/LOG SELECT: thread "
"context required");
@@ -2572,7 +2572,7 @@ static int scst_xmit_response(struct scst_cmd *cmd)
struct scatterlist *sg = cmd->sg;
TRACE_SEND_BOT("Xmitting %d S/G(s) at %p sg[0].page at %p",
cmd->sg_cnt, sg, (void*)sg_page(&sg[0]));
for(i = 0; i < cmd->sg_cnt; ++i) {
for (i = 0; i < cmd->sg_cnt; ++i) {
TRACE_BUFF_FLAG(TRACE_SND_BOT,
"Xmitting sg", sg_virt(&sg[i]),
sg[i].length);
@@ -2715,7 +2715,7 @@ static void scst_cmd_set_sn(struct scst_cmd *cmd)
cmd->queue_type = SCST_CMD_QUEUE_ORDERED;
}
switch(cmd->queue_type) {
switch (cmd->queue_type) {
case SCST_CMD_QUEUE_SIMPLE:
case SCST_CMD_QUEUE_UNTAGGED:
#if 1 /* temporary, ToDo */
@@ -2761,7 +2761,7 @@ ordered:
* Commands can finish in any order, so we don't
* know, which slot is empty.
*/
while(1) {
while (1) {
tgt_dev->cur_sn_slot++;
if (tgt_dev->cur_sn_slot == tgt_dev->sn_slots +
ARRAY_SIZE(tgt_dev->sn_slots))
@@ -3031,7 +3031,7 @@ int scst_init_cmd_thread(void *arg)
set_user_nice(current, -10);
spin_lock_irq(&scst_init_lock);
while(!kthread_should_stop()) {
while (!kthread_should_stop()) {
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
@@ -3154,7 +3154,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, int context)
res = SCST_CMD_STATE_RES_CONT_NEXT;
break;
}
} while(res == SCST_CMD_STATE_RES_CONT_SAME);
} while (res == SCST_CMD_STATE_RES_CONT_SAME);
if (res == SCST_CMD_STATE_RES_CONT_NEXT) {
/* None */
@@ -3481,7 +3481,7 @@ static int scst_call_dev_task_mgmt_fn(struct scst_mgmt_cmd *mcmd,
static inline int scst_is_strict_mgmt_fn(int mgmt_fn)
{
switch(mgmt_fn) {
switch (mgmt_fn) {
#ifdef ABORT_CONSIDER_FINISHED_TASKS_AS_NOT_EXISTING
case SCST_ABORT_TASK:
#endif
@@ -3708,10 +3708,10 @@ static void __scst_abort_task_set(struct scst_mgmt_cmd *mcmd,
spin_lock_irq(&sess->sess_list_lock);
TRACE_DBG("Searching in search cmd list (sess=%p)", sess);
list_for_each_entry(cmd, &sess->search_cmd_list,
search_cmd_list_entry) {
if ((cmd->tgt_dev == tgt_dev) ||
((cmd->tgt_dev == NULL) &&
list_for_each_entry(cmd, &sess->search_cmd_list,
search_cmd_list_entry) {
if ((cmd->tgt_dev == tgt_dev) ||
((cmd->tgt_dev == NULL) &&
(cmd->lun == tgt_dev->lun))) {
if (mcmd->cmd_sn_set) {
sBUG_ON(!cmd->tgt_sn_set);
@@ -3819,10 +3819,10 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd)
spin_lock_irq(&sess->sess_list_lock);
TRACE_DBG("Searching in search cmd list (sess=%p)", sess);
list_for_each_entry(cmd, &sess->search_cmd_list,
search_cmd_list_entry) {
if ((cmd->dev == dev) ||
((cmd->dev == NULL) &&
list_for_each_entry(cmd, &sess->search_cmd_list,
search_cmd_list_entry) {
if ((cmd->dev == dev) ||
((cmd->dev == NULL) &&
scst_is_cmd_belongs_to_dev(cmd, dev))) {
scst_abort_cmd(cmd, mcmd, 1, 0);
aborted = 1;
@@ -3895,7 +3895,7 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd)
mcmd->tag);
mcmd->status = SCST_MGMT_STATUS_REJECTED;
} else if (mcmd->cmd_sn_set &&
(scst_sn_before(mcmd->cmd_sn, cmd->tgt_sn) ||
(scst_sn_before(mcmd->cmd_sn, cmd->tgt_sn) ||
(mcmd->cmd_sn == cmd->tgt_sn))) {
PRINT_ERROR("ABORT TASK: SN mismatch: mcmd SN %x, "
"cmd SN %x, cmd tag %Lu", mcmd->cmd_sn,
@@ -4095,7 +4095,7 @@ static void scst_do_nexus_loss_sess(struct scst_mgmt_cmd *mcmd)
TRACE_ENTRY();
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&sess->sess_tgt_dev_list_hash[i];
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
@@ -4132,7 +4132,7 @@ static int scst_abort_all_nexus_loss_sess(struct scst_mgmt_cmd *mcmd,
mutex_lock(&scst_mutex);
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&sess->sess_tgt_dev_list_hash[i];
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
@@ -4174,7 +4174,7 @@ static void scst_do_nexus_loss_tgt(struct scst_mgmt_cmd *mcmd)
TRACE_ENTRY();
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) {
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&sess->sess_tgt_dev_list_hash[i];
struct scst_tgt_dev *tgt_dev;
@@ -4222,7 +4222,7 @@ static int scst_abort_all_nexus_loss_tgt(struct scst_mgmt_cmd *mcmd,
}
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) {
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&sess->sess_tgt_dev_list_hash[i];
struct scst_tgt_dev *tgt_dev;
@@ -4425,7 +4425,7 @@ static void scst_mgmt_cmd_send_done(struct scst_mgmt_cmd *mcmd)
int i;
mutex_lock(&scst_mutex);
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&mcmd->sess->sess_tgt_dev_list_hash[i];
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
@@ -4519,7 +4519,7 @@ int scst_mgmt_cmd_thread(void *arg)
set_user_nice(current, -10);
spin_lock_irq(&scst_mcmd_lock);
while(!kthread_should_stop()) {
while (!kthread_should_stop()) {
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
@@ -4631,7 +4631,7 @@ static int scst_post_rx_mgmt_cmd(struct scst_session *sess,
atomic_inc(&sess->sess_cmd_count);
if (unlikely(sess->init_phase != SCST_SESS_IPH_READY)) {
switch(sess->init_phase) {
switch (sess->init_phase) {
case SCST_SESS_IPH_INITING:
TRACE_DBG("Adding mcmd %p to init deferred mcmd list",
mcmd);
@@ -4994,7 +4994,7 @@ static void scst_pre_unreg_sess(struct scst_session *sess)
tm_dbg_task_mgmt(NULL, "UNREGISTER SESSION", 1);
mutex_lock(&scst_mutex);
for(i = 0; i < TGT_DEV_HASH_SIZE; i++) {
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
struct list_head *sess_tgt_dev_list_head =
&sess->sess_tgt_dev_list_hash[i];
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
@@ -5040,7 +5040,7 @@ int scst_mgmt_thread(void *arg)
set_user_nice(current, -10);
spin_lock_irq(&scst_mgmt_lock);
while(!kthread_should_stop()) {
while (!kthread_should_stop()) {
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
@@ -5087,7 +5087,7 @@ int scst_mgmt_thread(void *arg)
list_del(&sess->sess_shut_list_entry);
spin_unlock_irq(&scst_mgmt_lock);
switch(sess->shut_phase) {
switch (sess->shut_phase) {
case SCST_SESS_SPH_PRE_UNREG:
scst_pre_unreg_sess(sess);
break;
+14 -14
View File
@@ -837,7 +837,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
} else
dir = SCST_DATA_NONE;
scmnd = scst_rx_cmd(ch->scst_sess, (u8 *) & srp_cmd->lun,
scmnd = scst_rx_cmd(ch->scst_sess, (u8 *) &srp_cmd->lun,
sizeof srp_cmd->lun, srp_cmd->cdb, 16,
thread ? SCST_NON_ATOMIC : SCST_ATOMIC);
if (!scmnd) {
@@ -913,7 +913,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
case SRP_TSK_ABORT_TASK_SET:
ret = scst_rx_mgmt_fn_lun(ch->scst_sess,
SCST_ABORT_TASK_SET,
(u8 *) & srp_tsk->lun,
(u8 *) &srp_tsk->lun,
sizeof srp_tsk->lun,
thread ? SCST_NON_ATOMIC : SCST_ATOMIC,
mgmt_ioctx);
@@ -921,7 +921,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
case SRP_TSK_CLEAR_TASK_SET:
ret = scst_rx_mgmt_fn_lun(ch->scst_sess,
SCST_CLEAR_TASK_SET,
(u8 *) & srp_tsk->lun,
(u8 *) &srp_tsk->lun,
sizeof srp_tsk->lun,
thread ? SCST_NON_ATOMIC : SCST_ATOMIC,
mgmt_ioctx);
@@ -930,7 +930,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
case SRP_TSK_LUN_RESET:
ret = scst_rx_mgmt_fn_lun(ch->scst_sess,
SCST_LUN_RESET,
(u8 *) & srp_tsk->lun,
(u8 *) &srp_tsk->lun,
sizeof srp_tsk->lun,
thread ? SCST_NON_ATOMIC : SCST_ATOMIC,
mgmt_ioctx);
@@ -939,7 +939,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
case SRP_TSK_CLEAR_ACA:
ret = scst_rx_mgmt_fn_lun(ch->scst_sess,
SCST_CLEAR_ACA,
(u8 *) & srp_tsk->lun,
(u8 *) &srp_tsk->lun,
sizeof srp_tsk->lun,
thread ? SCST_NON_ATOMIC : SCST_ATOMIC,
mgmt_ioctx);
@@ -1054,7 +1054,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
return -ENOMEM;
cqe = SRPT_RQ_SIZE + SRPT_SQ_SIZE - 1;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, cqe);
#else
ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, cqe, 0);
@@ -1908,7 +1908,7 @@ static void srpt_tsk_mgmt_done(struct scst_mgmt_cmd *mcmnd)
printk(KERN_WARNING PFX
"%s[%d] tsk_mgmt_done for tag= %lld status=%d\n",
__FUNCTION__, __LINE__,(unsigned long long)mgmt_ioctx->tag,
__FUNCTION__, __LINE__, (unsigned long long)mgmt_ioctx->tag,
scst_mgmt_cmd_get_status(mcmnd));
srpt_build_tskmgmt_rsp(ch, ioctx,
@@ -1942,13 +1942,13 @@ static void srpt_on_free_cmd(struct scst_cmd *scmnd)
scst_cmd_set_tgt_priv(scmnd, NULL);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void srpt_refresh_port_work(void *ctx)
#else
static void srpt_refresh_port_work(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
struct srpt_port *sport = (struct srpt_port *)ctx;
#else
struct srpt_port *sport = container_of(work, struct srpt_port, work);
@@ -1976,7 +1976,7 @@ static int srpt_detect(struct scst_tgt_template *tp)
sport = &sdev->port[i - 1];
sport->sdev = sdev;
sport->port = i;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&sport->work, srpt_refresh_port_work, sport);
#else
INIT_WORK(&sport->work, srpt_refresh_port_work);
@@ -2027,11 +2027,11 @@ int srpt_ioctx_thread(void *arg)
current->flags |= PF_NOFREEZE;
spin_lock_irq(&srpt_thread.thread_lock);
while(!kthread_should_stop()) {
while (!kthread_should_stop()) {
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
if(!srpt_test_ioctx_list()) {
if (!srpt_test_ioctx_list()) {
add_wait_queue_exclusive(&ioctx_list_waitQ, &wait);
for (;;) {
@@ -2046,7 +2046,7 @@ int srpt_ioctx_thread(void *arg)
remove_wait_queue(&ioctx_list_waitQ, &wait);
}
while(!list_empty(&srpt_thread.thread_ioctx_list)) {
while (!list_empty(&srpt_thread.thread_ioctx_list)) {
ioctx = list_entry(srpt_thread.thread_ioctx_list.next,
struct srpt_ioctx, comp_list);
@@ -2176,7 +2176,7 @@ static void srpt_add_one(struct ib_device *device)
printk(KERN_DEBUG PFX "%s[%d] create SRQ #wr= %d max_allow=%d dev= %s\n",
__FUNCTION__, __LINE__, srq_attr.attr.max_wr,
sdev->dev_attr.max_srq_wr,device->name);
sdev->dev_attr.max_srq_wr, device->name);
if (!mellanox_ioc_guid)
mellanox_ioc_guid = be64_to_cpu(device->node_guid);