mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-08 09:06:32 +00:00
Merge the trunk's rrs 3438:3445, 3447:3450, 3452:3456 and 3458:3466
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.1.0.x@3470 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+12
-12
@@ -99,44 +99,44 @@ extraclean:
|
||||
|
||||
debug2release:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm $(KMOD)/Makefile.aa
|
||||
|
||||
release2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm $(KMOD)/Makefile.aa
|
||||
|
||||
debug2perf:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm $(KMOD)/Makefile.aa
|
||||
|
||||
perf2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm $(KMOD)/Makefile.aa
|
||||
|
||||
disable_proc:
|
||||
sed -i.aa s/"^#define CONFIG_SCST_PROC"/"\/* #define CONFIG_SCST_PROC *\/"/ $(INCDIR)/iscsi_scst_ver.h
|
||||
@cmp $(INCDIR)/iscsi_scst_ver.h $(INCDIR)/iscsi_scst_ver.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(INCDIR)/iscsi_scst_ver.h.aa; echo "sed failed"; false; fi
|
||||
@cmp $(INCDIR)/iscsi_scst_ver.h $(INCDIR)/iscsi_scst_ver.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(INCDIR)/iscsi_scst_ver.h.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm $(INCDIR)/iscsi_scst_ver.h.aa
|
||||
|
||||
enable_proc:
|
||||
sed -i.aa s/"\/\* #define CONFIG_SCST_PROC \*\/"/"#define CONFIG_SCST_PROC"/ $(INCDIR)/iscsi_scst_ver.h
|
||||
@cmp $(INCDIR)/iscsi_scst_ver.h $(INCDIR)/iscsi_scst_ver.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(INCDIR)/iscsi_scst_ver.h.aa; echo "sed failed"; false; fi
|
||||
@cmp $(INCDIR)/iscsi_scst_ver.h $(INCDIR)/iscsi_scst_ver.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(INCDIR)/iscsi_scst_ver.h.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm $(INCDIR)/iscsi_scst_ver.h.aa
|
||||
|
||||
.PHONY: all mods progs install clean extraclean debug2release release2debug debug2perf perf2debug disable_proc enable_proc
|
||||
|
||||
+30
-30
@@ -620,9 +620,9 @@ void iscsi_check_tm_data_wait_timeouts(struct iscsi_conn *conn, bool force)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
TRACE_DBG_FLAG(force ? TRACE_CONN_OC_DBG : TRACE_MGMT_DEBUG,
|
||||
"conn %p, read_cmnd %p, read_state %d, j %ld (TIMEOUT %d, "
|
||||
"force %d)", conn, conn->read_cmnd, conn->read_state, j,
|
||||
TRACE_DBG_FLAG(TRACE_MGMT_DEBUG, "conn %p, read_cmnd %p, read_state "
|
||||
"%d, j %ld (TIMEOUT %d, force %d)", conn, conn->read_cmnd,
|
||||
conn->read_state, j,
|
||||
ISCSI_TM_DATA_WAIT_TIMEOUT + ISCSI_ADD_SCHED_TIME, force);
|
||||
|
||||
iscsi_extracheck_is_rd_thread(conn);
|
||||
@@ -634,37 +634,37 @@ again:
|
||||
aborted_cmds_pending = false;
|
||||
list_for_each_entry(cmnd, &conn->write_timeout_list,
|
||||
write_timeout_list_entry) {
|
||||
/*
|
||||
* This should not happen, because DATA OUT commands can't get
|
||||
* into write_timeout_list.
|
||||
*/
|
||||
sBUG_ON(cmnd->cmd_req != NULL);
|
||||
|
||||
if (test_bit(ISCSI_CMD_ABORTED, &cmnd->prelim_compl_flags)) {
|
||||
TRACE_DBG_FLAG(force ? TRACE_CONN_OC_DBG : TRACE_MGMT_DEBUG,
|
||||
"Checking aborted cmnd %p (scst_state %d, "
|
||||
"on_write_timeout_list %d, write_start %ld, "
|
||||
"r2t_len_to_receive %d)", cmnd, cmnd->scst_state,
|
||||
cmnd->on_write_timeout_list, cmnd->write_start,
|
||||
cmnd->r2t_len_to_receive);
|
||||
if (cmnd == conn->read_cmnd) {
|
||||
TRACE_DBG_FLAG(force ? TRACE_CONN_OC_DBG : TRACE_MGMT_DEBUG,
|
||||
"cmnd %p is read cmd", cmnd);
|
||||
sBUG_ON(force);
|
||||
if ((conn->read_state == RX_INIT_BHS) ||
|
||||
(conn->read_state == RX_BHS)) {
|
||||
TRACE_MGMT_DBG("Unabort not yet received cmnd %p",
|
||||
cmnd);
|
||||
clear_bit(ISCSI_CMD_ABORTED, &cmnd->prelim_compl_flags);
|
||||
continue;
|
||||
} else if (cmnd->scst_state == ISCSI_CMD_STATE_RX_CMD) {
|
||||
TRACE_MGMT_DBG("Aborted cmnd %p is RX_CMD, "
|
||||
"keep waiting", cmnd);
|
||||
goto cont;
|
||||
}
|
||||
TRACE_MGMT_DBG("Checking aborted cmnd %p (scst_state "
|
||||
"%d, on_write_timeout_list %d, write_start "
|
||||
"%ld, r2t_len_to_receive %d)", cmnd,
|
||||
cmnd->scst_state, cmnd->on_write_timeout_list,
|
||||
cmnd->write_start, cmnd->r2t_len_to_receive);
|
||||
if ((cmnd == conn->read_cmnd) ||
|
||||
cmnd->data_out_in_data_receiving) {
|
||||
sBUG_ON((cmnd == conn->read_cmnd) && force);
|
||||
/*
|
||||
* We can't abort command waiting for data from
|
||||
* the net, because otherwise we are risking to
|
||||
* get out of sync with the sender, so we have
|
||||
* to wait until the timeout timer gets into the
|
||||
* action and close this connection.
|
||||
*/
|
||||
TRACE_MGMT_DBG("Aborted cmnd %p is %s, "
|
||||
"keep waiting", cmnd,
|
||||
(cmnd == conn->read_cmnd) ? "RX cmnd" :
|
||||
"waiting for DATA OUT data");
|
||||
goto cont;
|
||||
}
|
||||
if (((cmnd == conn->read_cmnd) || (cmnd->r2t_len_to_receive != 0)) &&
|
||||
if ((cmnd->r2t_len_to_receive != 0) &&
|
||||
(time_after_eq(j, cmnd->write_start + ISCSI_TM_DATA_WAIT_TIMEOUT) ||
|
||||
force)) {
|
||||
if (cmnd == conn->read_cmnd) {
|
||||
TRACE_MGMT_DBG("Clearing read_cmnd for conn %p", conn);
|
||||
conn->read_cmnd = NULL;
|
||||
conn->read_state = RX_INIT_BHS;
|
||||
}
|
||||
spin_unlock(&conn->write_list_lock);
|
||||
spin_unlock_bh(&conn->conn_thr_pool->rd_lock);
|
||||
iscsi_fail_data_waiting_cmnd(cmnd);
|
||||
|
||||
+101
-71
@@ -61,7 +61,6 @@ static void iscsi_send_task_mgmt_resp(struct iscsi_cmnd *req, int status);
|
||||
static void iscsi_check_send_delayed_tm_resp(struct iscsi_session *sess);
|
||||
static void req_cmnd_release(struct iscsi_cmnd *req);
|
||||
static int cmnd_insert_data_wait_hash(struct iscsi_cmnd *cmnd);
|
||||
static void __cmnd_abort(struct iscsi_cmnd *cmnd);
|
||||
static void iscsi_cmnd_init_write(struct iscsi_cmnd *rsp, int flags);
|
||||
static void iscsi_set_resid_no_scst_cmd(struct iscsi_cmnd *rsp);
|
||||
static void iscsi_set_resid(struct iscsi_cmnd *rsp);
|
||||
@@ -418,6 +417,7 @@ void cmnd_done(struct iscsi_cmnd *cmnd)
|
||||
EXTRACHECKS_BUG_ON(cmnd->on_rx_digest_list);
|
||||
EXTRACHECKS_BUG_ON(cmnd->hashed);
|
||||
EXTRACHECKS_BUG_ON(cmnd->cmd_req);
|
||||
EXTRACHECKS_BUG_ON(cmnd->data_out_in_data_receiving);
|
||||
|
||||
req_del_from_write_timeout_list(cmnd);
|
||||
|
||||
@@ -626,11 +626,14 @@ static void req_cmnd_pre_release(struct iscsi_cmnd *req)
|
||||
|
||||
if (unlikely(req->hashed)) {
|
||||
/* It sometimes can happen during errors recovery */
|
||||
TRACE_MGMT_DBG("Removing req %p from hash", req);
|
||||
cmnd_remove_data_wait_hash(req);
|
||||
}
|
||||
|
||||
if (unlikely(req->cmd_req)) {
|
||||
/* It sometimes can happen during errors recovery */
|
||||
TRACE_MGMT_DBG("Putting cmd_req %p (req %p)", req->cmd_req, req);
|
||||
req->cmd_req->data_out_in_data_receiving = 0;
|
||||
cmnd_put(req->cmd_req);
|
||||
req->cmd_req = NULL;
|
||||
}
|
||||
@@ -1272,8 +1275,6 @@ static struct iscsi_cmnd *cmnd_find_data_wait_hash(struct iscsi_conn *conn,
|
||||
|
||||
spin_lock(&session->cmnd_data_wait_hash_lock);
|
||||
res = __cmnd_find_data_wait_hash(conn, itt);
|
||||
if (cmnd_get_check(res) != 0)
|
||||
res = NULL;
|
||||
spin_unlock(&session->cmnd_data_wait_hash_lock);
|
||||
|
||||
return res;
|
||||
@@ -2049,8 +2050,9 @@ static int data_out_start(struct iscsi_cmnd *cmnd)
|
||||
TRACE_ENTRY();
|
||||
|
||||
/*
|
||||
* There is no race with send_r2t() and conn_abort(), since
|
||||
* all functions called from single read thread
|
||||
* There is no race with send_r2t(), conn_abort() and
|
||||
* iscsi_check_tm_data_wait_timeouts(), since
|
||||
* all the functions called from single read thread
|
||||
*/
|
||||
iscsi_extracheck_is_rd_thread(cmnd->conn);
|
||||
|
||||
@@ -2070,6 +2072,8 @@ static int data_out_start(struct iscsi_cmnd *cmnd)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmnd_get(orig_req);
|
||||
|
||||
if (unlikely(orig_req->r2t_len_to_receive < cmnd->pdu.datasize)) {
|
||||
if (orig_req->prelim_compl_flags != 0) {
|
||||
/* We can have fake r2t_len_to_receive */
|
||||
@@ -2103,6 +2107,9 @@ go:
|
||||
goto out;
|
||||
}
|
||||
|
||||
EXTRACHECKS_BUG_ON(orig_req->data_out_in_data_receiving);
|
||||
orig_req->data_out_in_data_receiving = 1;
|
||||
|
||||
TRACE_WRITE("cmnd %p, orig_req %p, offset %u, datasize %u", cmnd,
|
||||
orig_req, offset, cmnd->pdu.datasize);
|
||||
|
||||
@@ -2130,6 +2137,8 @@ static void data_out_end(struct iscsi_cmnd *cmnd)
|
||||
|
||||
iscsi_extracheck_is_rd_thread(cmnd->conn);
|
||||
|
||||
req->data_out_in_data_receiving = 0;
|
||||
|
||||
if (!(cmnd->conn->ddigest_type & DIGEST_NONE) &&
|
||||
!cmnd->ddigest_checked) {
|
||||
cmd_add_on_rx_ddigest_list(req, cmnd);
|
||||
@@ -2250,7 +2259,7 @@ static void __cmnd_abort(struct iscsi_cmnd *cmnd)
|
||||
}
|
||||
|
||||
/* Must be called from the read or conn close thread */
|
||||
static int cmnd_abort(struct iscsi_cmnd *req, int *status)
|
||||
static int cmnd_abort_pre_checks(struct iscsi_cmnd *req, int *status)
|
||||
{
|
||||
struct iscsi_task_mgt_hdr *req_hdr =
|
||||
(struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
|
||||
@@ -2268,7 +2277,6 @@ static int cmnd_abort(struct iscsi_cmnd *req, int *status)
|
||||
|
||||
cmnd = cmnd_find_itt_get(req->conn, req_hdr->rtt);
|
||||
if (cmnd) {
|
||||
struct iscsi_conn *conn = cmnd->conn;
|
||||
struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd);
|
||||
|
||||
if (req_hdr->lun != hdr->lun) {
|
||||
@@ -2310,10 +2318,6 @@ static int cmnd_abort(struct iscsi_cmnd *req, int *status)
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
spin_lock_bh(&conn->cmd_list_lock);
|
||||
__cmnd_abort(cmnd);
|
||||
spin_unlock_bh(&conn->cmd_list_lock);
|
||||
|
||||
cmnd_put(cmnd);
|
||||
res = 0;
|
||||
} else {
|
||||
@@ -2351,69 +2355,86 @@ out_put:
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Must be called from the read or conn close thread */
|
||||
static int target_abort(struct iscsi_cmnd *req, int all)
|
||||
struct iscsi_cmnd_abort_params {
|
||||
struct work_struct iscsi_cmnd_abort_work;
|
||||
struct scst_cmd *scst_cmd;
|
||||
};
|
||||
|
||||
static mempool_t *iscsi_cmnd_abort_mempool;
|
||||
|
||||
static void iscsi_cmnd_abort_fn(struct work_struct *work)
|
||||
{
|
||||
struct iscsi_target *target = req->conn->session->target;
|
||||
struct iscsi_task_mgt_hdr *req_hdr =
|
||||
(struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
|
||||
struct iscsi_session *session;
|
||||
struct iscsi_cmnd_abort_params *params = container_of(work,
|
||||
struct iscsi_cmnd_abort_params, iscsi_cmnd_abort_work);
|
||||
struct scst_cmd *scst_cmd = params->scst_cmd;
|
||||
struct iscsi_session *session = scst_sess_get_tgt_priv(scst_cmd->sess);
|
||||
struct iscsi_conn *conn;
|
||||
struct iscsi_cmnd *cmnd;
|
||||
struct iscsi_cmnd *cmnd = scst_cmd_get_tgt_priv(scst_cmd);
|
||||
bool done = false;
|
||||
|
||||
mutex_lock(&target->target_mutex);
|
||||
TRACE_ENTRY();
|
||||
|
||||
list_for_each_entry(session, &target->session_list,
|
||||
session_list_entry) {
|
||||
list_for_each_entry(conn, &session->conn_list,
|
||||
conn_list_entry) {
|
||||
spin_lock_bh(&conn->cmd_list_lock);
|
||||
list_for_each_entry(cmnd, &conn->cmd_list,
|
||||
cmd_list_entry) {
|
||||
if (cmnd == req)
|
||||
continue;
|
||||
if (all)
|
||||
__cmnd_abort(cmnd);
|
||||
else if (req_hdr->lun == cmnd_hdr(cmnd)->lun)
|
||||
__cmnd_abort(cmnd);
|
||||
}
|
||||
spin_unlock_bh(&conn->cmd_list_lock);
|
||||
}
|
||||
}
|
||||
TRACE_MGMT_DBG("Checking aborted scst_cmd %p (cmnd %p)", scst_cmd, cmnd);
|
||||
|
||||
mutex_unlock(&target->target_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Must be called from the read or conn close thread */
|
||||
static void task_set_abort(struct iscsi_cmnd *req)
|
||||
{
|
||||
struct iscsi_session *session = req->conn->session;
|
||||
struct iscsi_task_mgt_hdr *req_hdr =
|
||||
(struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
|
||||
struct iscsi_target *target = session->target;
|
||||
struct iscsi_conn *conn;
|
||||
struct iscsi_cmnd *cmnd;
|
||||
|
||||
mutex_lock(&target->target_mutex);
|
||||
mutex_lock(&session->target->target_mutex);
|
||||
|
||||
/*
|
||||
* cmnd pointer is valid only under cmd_list_lock, but we can't know the
|
||||
* corresponding conn without dereferencing cmnd at first, so let's
|
||||
* check all conns and cmnds to find out if our cmnd is still valid
|
||||
* under lock.
|
||||
*/
|
||||
list_for_each_entry(conn, &session->conn_list, conn_list_entry) {
|
||||
struct iscsi_cmnd *c;
|
||||
spin_lock_bh(&conn->cmd_list_lock);
|
||||
list_for_each_entry(cmnd, &conn->cmd_list, cmd_list_entry) {
|
||||
struct iscsi_scsi_cmd_hdr *hdr = cmnd_hdr(cmnd);
|
||||
if (cmnd == req)
|
||||
continue;
|
||||
if (req_hdr->lun != hdr->lun)
|
||||
continue;
|
||||
if (before(req_hdr->cmd_sn, hdr->cmd_sn) ||
|
||||
req_hdr->cmd_sn == hdr->cmd_sn)
|
||||
continue;
|
||||
__cmnd_abort(cmnd);
|
||||
list_for_each_entry(c, &conn->cmd_list, cmd_list_entry) {
|
||||
if (c == cmnd) {
|
||||
__cmnd_abort(cmnd);
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&conn->cmd_list_lock);
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&target->target_mutex);
|
||||
mutex_unlock(&session->target->target_mutex);
|
||||
|
||||
scst_cmd_put(scst_cmd);
|
||||
|
||||
mempool_free(params, iscsi_cmnd_abort_mempool);
|
||||
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
|
||||
static void iscsi_on_abort_cmd(struct scst_cmd *scst_cmd)
|
||||
{
|
||||
struct iscsi_cmnd_abort_params *params;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
params = mempool_alloc(iscsi_cmnd_abort_mempool, GFP_ATOMIC);
|
||||
if (params == NULL) {
|
||||
PRINT_CRIT_ERROR("Unable to create iscsi_cmnd_abort_params, "
|
||||
"iSCSI cmnd for scst_cmd %p may not be aborted",
|
||||
scst_cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(params, 0, sizeof(*params));
|
||||
INIT_WORK(¶ms->iscsi_cmnd_abort_work, iscsi_cmnd_abort_fn);
|
||||
params->scst_cmd = scst_cmd;
|
||||
|
||||
scst_cmd_get(scst_cmd);
|
||||
|
||||
TRACE_MGMT_DBG("Scheduling abort check for scst_cmd %p", scst_cmd);
|
||||
|
||||
schedule_work(¶ms->iscsi_cmnd_abort_work);
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2516,7 +2537,7 @@ static void execute_task_management(struct iscsi_cmnd *req)
|
||||
|
||||
switch (function) {
|
||||
case ISCSI_FUNCTION_ABORT_TASK:
|
||||
rc = cmnd_abort(req, &status);
|
||||
rc = cmnd_abort_pre_checks(req, &status);
|
||||
if (rc == 0) {
|
||||
params.fn = SCST_ABORT_TASK;
|
||||
params.tag = (__force u32)req_hdr->rtt;
|
||||
@@ -2532,7 +2553,6 @@ static void execute_task_management(struct iscsi_cmnd *req)
|
||||
}
|
||||
break;
|
||||
case ISCSI_FUNCTION_ABORT_TASK_SET:
|
||||
task_set_abort(req);
|
||||
params.fn = SCST_ABORT_TASK_SET;
|
||||
params.lun = (uint8_t *)&req_hdr->lun;
|
||||
params.lun_len = sizeof(req_hdr->lun);
|
||||
@@ -2544,7 +2564,6 @@ static void execute_task_management(struct iscsi_cmnd *req)
|
||||
status = ISCSI_RESPONSE_FUNCTION_REJECTED;
|
||||
break;
|
||||
case ISCSI_FUNCTION_CLEAR_TASK_SET:
|
||||
task_set_abort(req);
|
||||
params.fn = SCST_CLEAR_TASK_SET;
|
||||
params.lun = (uint8_t *)&req_hdr->lun;
|
||||
params.lun_len = sizeof(req_hdr->lun);
|
||||
@@ -2568,7 +2587,6 @@ static void execute_task_management(struct iscsi_cmnd *req)
|
||||
break;
|
||||
case ISCSI_FUNCTION_TARGET_COLD_RESET:
|
||||
case ISCSI_FUNCTION_TARGET_WARM_RESET:
|
||||
target_abort(req, 1);
|
||||
params.fn = SCST_TARGET_RESET;
|
||||
params.cmd_sn = req_hdr->cmd_sn;
|
||||
params.cmd_sn_set = 1;
|
||||
@@ -2577,7 +2595,6 @@ static void execute_task_management(struct iscsi_cmnd *req)
|
||||
status = ISCSI_RESPONSE_FUNCTION_REJECTED;
|
||||
break;
|
||||
case ISCSI_FUNCTION_LOGICAL_UNIT_RESET:
|
||||
target_abort(req, 0);
|
||||
params.fn = SCST_LUN_RESET;
|
||||
params.lun = (uint8_t *)&req_hdr->lun;
|
||||
params.lun_len = sizeof(req_hdr->lun);
|
||||
@@ -2961,9 +2978,9 @@ static void iscsi_push_cmnd(struct iscsi_cmnd *cmnd)
|
||||
|
||||
if (unlikely(before(cmd_sn, session->exp_cmd_sn))) {
|
||||
TRACE_MGMT_DBG("Ignoring out of expected range cmd_sn "
|
||||
"(sn %u, exp_sn %u, op %x, CDB op %x)", cmd_sn,
|
||||
session->exp_cmd_sn, cmnd_opcode(cmnd),
|
||||
cmnd_scsicode(cmnd));
|
||||
"(sn %u, exp_sn %u, cmd %p, op %x, CDB op %x)",
|
||||
cmd_sn, session->exp_cmd_sn, cmnd,
|
||||
cmnd_opcode(cmnd), cmnd_scsicode(cmnd));
|
||||
drop = 1;
|
||||
}
|
||||
|
||||
@@ -3827,6 +3844,7 @@ struct scst_tgt_template iscsi_template = {
|
||||
.pre_exec = iscsi_pre_exec,
|
||||
.task_mgmt_affected_cmds_done = iscsi_task_mgmt_affected_cmds_done,
|
||||
.task_mgmt_fn_done = iscsi_task_mgmt_fn_done,
|
||||
.on_abort_cmd = iscsi_on_abort_cmd,
|
||||
.report_aen = iscsi_report_aen,
|
||||
.get_initiator_port_transport_id = iscsi_get_initiator_port_transport_id,
|
||||
.get_scsi_transport_version = iscsi_get_scsi_transport_version,
|
||||
@@ -4016,12 +4034,19 @@ static int __init iscsi_init(void)
|
||||
sg_init_table(&dummy_sg, 1);
|
||||
sg_set_page(&dummy_sg, dummy_page, PAGE_SIZE, 0);
|
||||
|
||||
iscsi_cmnd_abort_mempool = mempool_create_kmalloc_pool(2500,
|
||||
sizeof(struct iscsi_cmnd_abort_params));
|
||||
if (iscsi_cmnd_abort_mempool == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto out_free_dummy;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
|
||||
err = net_set_get_put_page_callbacks(iscsi_get_page_callback,
|
||||
iscsi_put_page_callback);
|
||||
if (err != 0) {
|
||||
PRINT_INFO("Unable to set page callbackes: %d", err);
|
||||
goto out_free_dummy;
|
||||
goto out_destroy_mempool;
|
||||
}
|
||||
#else
|
||||
#ifndef GENERATING_UPSTREAM_PATCH
|
||||
@@ -4092,6 +4117,9 @@ out_callb:
|
||||
#if defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
|
||||
net_set_get_put_page_callbacks(NULL, NULL);
|
||||
|
||||
out_destroy_mempool:
|
||||
mempool_destroy(iscsi_cmnd_abort_mempool);
|
||||
|
||||
out_free_dummy:
|
||||
#endif
|
||||
__free_pages(dummy_page, 0);
|
||||
@@ -4119,6 +4147,8 @@ static void __exit iscsi_exit(void)
|
||||
net_set_get_put_page_callbacks(NULL, NULL);
|
||||
#endif
|
||||
|
||||
mempool_destroy(iscsi_cmnd_abort_mempool);
|
||||
|
||||
__free_pages(dummy_page, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
+16
-19
@@ -326,23 +326,6 @@ struct iscsi_pdu {
|
||||
typedef void (iscsi_show_info_t)(struct seq_file *seq,
|
||||
struct iscsi_target *target);
|
||||
|
||||
/* Read data states */
|
||||
enum rx_state {
|
||||
RX_INIT_BHS, /* Must be zero for better "switch" optimization. */
|
||||
RX_BHS,
|
||||
RX_CMD_START,
|
||||
RX_DATA,
|
||||
RX_END,
|
||||
|
||||
RX_CMD_CONTINUE,
|
||||
RX_INIT_HDIGEST,
|
||||
RX_CHECK_HDIGEST,
|
||||
RX_INIT_DDIGEST,
|
||||
RX_CHECK_DDIGEST,
|
||||
RX_AHS,
|
||||
RX_PADDING,
|
||||
};
|
||||
|
||||
/** Commands' states **/
|
||||
|
||||
/* New command and SCST processes it */
|
||||
@@ -393,6 +376,13 @@ struct iscsi_cmnd {
|
||||
unsigned int force_cleanup_done:1;
|
||||
unsigned int dec_active_cmds:1;
|
||||
unsigned int ddigest_checked:1;
|
||||
/*
|
||||
* Used to prevent release of original req while its related DATA OUT
|
||||
* cmd is receiving data, i.e. stays between data_out_start() and
|
||||
* data_out_end(). Ref counting can't be used for that, because
|
||||
* req_cmnd_release() supposed to be called only once.
|
||||
*/
|
||||
unsigned int data_out_in_data_receiving:1;
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
unsigned int on_rx_digest_list:1;
|
||||
unsigned int release_called:1;
|
||||
@@ -672,7 +662,7 @@ static inline void iscsi_cmnd_set_length(struct iscsi_pdu *pdu)
|
||||
extern struct scst_tgt_template iscsi_template;
|
||||
|
||||
/*
|
||||
* Skip this command if result is not 0. Must be called under
|
||||
* Skip this command if result is true. Must be called under
|
||||
* corresponding lock.
|
||||
*/
|
||||
static inline bool cmnd_get_check(struct iscsi_cmnd *cmnd)
|
||||
@@ -771,8 +761,15 @@ static inline void cmd_del_from_rx_ddigest_list(struct iscsi_cmnd *cmnd)
|
||||
|
||||
static inline unsigned long iscsi_get_timeout(struct iscsi_cmnd *req)
|
||||
{
|
||||
return (cmnd_opcode(req) == ISCSI_OP_NOP_OUT) ?
|
||||
unsigned long res;
|
||||
|
||||
res = (cmnd_opcode(req) == ISCSI_OP_NOP_OUT) ?
|
||||
req->conn->nop_in_timeout : req->conn->data_rsp_timeout;
|
||||
|
||||
if (unlikely(test_bit(ISCSI_CMD_ABORTED, &req->prelim_compl_flags)))
|
||||
res = min_t(unsigned long, res, ISCSI_TM_DATA_WAIT_TIMEOUT);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline unsigned long iscsi_get_timeout_time(struct iscsi_cmnd *req)
|
||||
|
||||
+20
-11
@@ -19,13 +19,29 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <asm/ioctls.h>
|
||||
#include <linux/delay.h>
|
||||
#include <net/tcp.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "digest.h"
|
||||
|
||||
/* Read data states */
|
||||
enum rx_state {
|
||||
RX_INIT_BHS, /* Must be zero for better "switch" optimization. */
|
||||
RX_BHS,
|
||||
RX_CMD_START,
|
||||
RX_DATA,
|
||||
RX_END,
|
||||
|
||||
RX_CMD_CONTINUE,
|
||||
RX_INIT_HDIGEST,
|
||||
RX_CHECK_HDIGEST,
|
||||
RX_INIT_DDIGEST,
|
||||
RX_CHECK_DDIGEST,
|
||||
RX_AHS,
|
||||
RX_PADDING,
|
||||
};
|
||||
|
||||
enum tx_state {
|
||||
TX_INIT = 0, /* Must be zero for better "switch" optimization. */
|
||||
TX_BHS_DATA,
|
||||
@@ -839,17 +855,10 @@ static int process_read_io(struct iscsi_conn *conn, int *closed)
|
||||
res = do_recv(conn);
|
||||
if (res == 0) {
|
||||
/*
|
||||
* Clear aborted status if this command was
|
||||
* accidentally aborted with other commands of
|
||||
* this connection. This command not yet
|
||||
* received on the aborted time, so shouldn't be
|
||||
* affected by the abort.
|
||||
* This command not yet received on the aborted
|
||||
* time, so shouldn't be affected by any abort.
|
||||
*/
|
||||
if (cmnd->prelim_compl_flags != 0)
|
||||
TRACE_MGMT_DBG("Unabort not yet "
|
||||
"received cmnd %p (flags %lx)",
|
||||
cmnd, cmnd->prelim_compl_flags);
|
||||
cmnd->prelim_compl_flags = 0;
|
||||
EXTRACHECKS_BUG_ON(cmnd->prelim_compl_flags != 0);
|
||||
|
||||
iscsi_cmnd_get_length(&cmnd->pdu);
|
||||
|
||||
|
||||
@@ -0,0 +1,390 @@
|
||||
diff -upkr linux-2.6.39/include/linux/mm_types.h linux-2.6.39/include/linux/mm_types.h
|
||||
--- linux-2.6.39/include/linux/mm_types.h 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/include/linux/mm_types.h 2011-05-19 10:46:24.669812999 -0400
|
||||
@@ -100,6 +100,18 @@ struct page {
|
||||
*/
|
||||
void *shadow;
|
||||
#endif
|
||||
+
|
||||
+#if defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
|
||||
+ /*
|
||||
+ * Used to implement support for notification on zero-copy TCP transfer
|
||||
+ * completion. It might look as not good to have this field here and
|
||||
+ * it's better to have it in struct sk_buff, but it would make the code
|
||||
+ * much more complicated and fragile, since all skb then would have to
|
||||
+ * contain only pages with the same value in this field.
|
||||
+ */
|
||||
+ void *net_priv;
|
||||
+#endif
|
||||
+
|
||||
};
|
||||
|
||||
/*
|
||||
diff -upkr linux-2.6.39/include/linux/net.h linux-2.6.39/include/linux/net.h
|
||||
--- linux-2.6.39/include/linux/net.h 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/include/linux/net.h 2011-05-19 10:46:24.669812999 -0400
|
||||
@@ -60,6 +60,7 @@ typedef enum {
|
||||
#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
|
||||
#include <linux/kmemcheck.h>
|
||||
#include <linux/rcupdate.h>
|
||||
+#include <linux/mm.h>
|
||||
|
||||
struct poll_table_struct;
|
||||
struct pipe_inode_info;
|
||||
@@ -294,5 +295,44 @@ extern int kernel_sock_shutdown(struct s
|
||||
extern struct ratelimit_state net_ratelimit_state;
|
||||
#endif
|
||||
|
||||
+#if defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
|
||||
+/* Support for notification on zero-copy TCP transfer completion */
|
||||
+typedef void (*net_get_page_callback_t)(struct page *page);
|
||||
+typedef void (*net_put_page_callback_t)(struct page *page);
|
||||
+
|
||||
+extern net_get_page_callback_t net_get_page_callback;
|
||||
+extern net_put_page_callback_t net_put_page_callback;
|
||||
+
|
||||
+extern int net_set_get_put_page_callbacks(
|
||||
+ net_get_page_callback_t get_callback,
|
||||
+ net_put_page_callback_t put_callback);
|
||||
+
|
||||
+/*
|
||||
+ * See comment for net_set_get_put_page_callbacks() why those functions
|
||||
+ * don't need any protection.
|
||||
+ */
|
||||
+static inline void net_get_page(struct page *page)
|
||||
+{
|
||||
+ if (page->net_priv != 0)
|
||||
+ net_get_page_callback(page);
|
||||
+ get_page(page);
|
||||
+}
|
||||
+static inline void net_put_page(struct page *page)
|
||||
+{
|
||||
+ if (page->net_priv != 0)
|
||||
+ net_put_page_callback(page);
|
||||
+ put_page(page);
|
||||
+}
|
||||
+#else
|
||||
+static inline void net_get_page(struct page *page)
|
||||
+{
|
||||
+ get_page(page);
|
||||
+}
|
||||
+static inline void net_put_page(struct page *page)
|
||||
+{
|
||||
+ put_page(page);
|
||||
+}
|
||||
+#endif /* CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION */
|
||||
+
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_NET_H */
|
||||
diff -upkr linux-2.6.39/net/core/dev.c linux-2.6.39/net/core/dev.c
|
||||
--- linux-2.6.39/net/core/dev.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/core/dev.c 2011-05-19 10:46:24.669812999 -0400
|
||||
@@ -3418,7 +3418,7 @@ pull:
|
||||
skb_shinfo(skb)->frags[0].size -= grow;
|
||||
|
||||
if (unlikely(!skb_shinfo(skb)->frags[0].size)) {
|
||||
- put_page(skb_shinfo(skb)->frags[0].page);
|
||||
+ net_put_page(skb_shinfo(skb)->frags[0].page);
|
||||
memmove(skb_shinfo(skb)->frags,
|
||||
skb_shinfo(skb)->frags + 1,
|
||||
--skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
|
||||
diff -upkr linux-2.6.39/net/core/skbuff.c linux-2.6.39/net/core/skbuff.c
|
||||
--- linux-2.6.39/net/core/skbuff.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/core/skbuff.c 2011-05-19 10:46:24.669812999 -0400
|
||||
@@ -76,13 +76,13 @@ static struct kmem_cache *skbuff_fclone_
|
||||
static void sock_pipe_buf_release(struct pipe_inode_info *pipe,
|
||||
struct pipe_buffer *buf)
|
||||
{
|
||||
- put_page(buf->page);
|
||||
+ net_put_page(buf->page);
|
||||
}
|
||||
|
||||
static void sock_pipe_buf_get(struct pipe_inode_info *pipe,
|
||||
struct pipe_buffer *buf)
|
||||
{
|
||||
- get_page(buf->page);
|
||||
+ net_get_page(buf->page);
|
||||
}
|
||||
|
||||
static int sock_pipe_buf_steal(struct pipe_inode_info *pipe,
|
||||
@@ -325,7 +325,7 @@ static void skb_release_data(struct sk_b
|
||||
if (skb_shinfo(skb)->nr_frags) {
|
||||
int i;
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
|
||||
- put_page(skb_shinfo(skb)->frags[i].page);
|
||||
+ net_put_page(skb_shinfo(skb)->frags[i].page);
|
||||
}
|
||||
|
||||
if (skb_has_frag_list(skb))
|
||||
@@ -732,7 +732,7 @@ struct sk_buff *pskb_copy(struct sk_buff
|
||||
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i];
|
||||
- get_page(skb_shinfo(n)->frags[i].page);
|
||||
+ net_get_page(skb_shinfo(n)->frags[i].page);
|
||||
}
|
||||
skb_shinfo(n)->nr_frags = i;
|
||||
}
|
||||
@@ -819,7 +819,7 @@ int pskb_expand_head(struct sk_buff *skb
|
||||
kfree(skb->head);
|
||||
} else {
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
|
||||
- get_page(skb_shinfo(skb)->frags[i].page);
|
||||
+ net_get_page(skb_shinfo(skb)->frags[i].page);
|
||||
|
||||
if (skb_has_frag_list(skb))
|
||||
skb_clone_fraglist(skb);
|
||||
@@ -1097,7 +1097,7 @@ drop_pages:
|
||||
skb_shinfo(skb)->nr_frags = i;
|
||||
|
||||
for (; i < nfrags; i++)
|
||||
- put_page(skb_shinfo(skb)->frags[i].page);
|
||||
+ net_put_page(skb_shinfo(skb)->frags[i].page);
|
||||
|
||||
if (skb_has_frag_list(skb))
|
||||
skb_drop_fraglist(skb);
|
||||
@@ -1266,7 +1266,7 @@ pull_pages:
|
||||
k = 0;
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
if (skb_shinfo(skb)->frags[i].size <= eat) {
|
||||
- put_page(skb_shinfo(skb)->frags[i].page);
|
||||
+ net_put_page(skb_shinfo(skb)->frags[i].page);
|
||||
eat -= skb_shinfo(skb)->frags[i].size;
|
||||
} else {
|
||||
skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i];
|
||||
@@ -1367,7 +1367,7 @@ EXPORT_SYMBOL(skb_copy_bits);
|
||||
*/
|
||||
static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
|
||||
{
|
||||
- put_page(spd->pages[i]);
|
||||
+ net_put_page(spd->pages[i]);
|
||||
}
|
||||
|
||||
static inline struct page *linear_to_page(struct page *page, unsigned int *len,
|
||||
@@ -1391,7 +1391,7 @@ new_page:
|
||||
off = sk->sk_sndmsg_off;
|
||||
mlen = PAGE_SIZE - off;
|
||||
if (mlen < 64 && mlen < *len) {
|
||||
- put_page(p);
|
||||
+ net_put_page(p);
|
||||
goto new_page;
|
||||
}
|
||||
|
||||
@@ -1401,7 +1401,7 @@ new_page:
|
||||
memcpy(page_address(p) + off, page_address(page) + *offset, *len);
|
||||
sk->sk_sndmsg_off += *len;
|
||||
*offset = off;
|
||||
- get_page(p);
|
||||
+ net_get_page(p);
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -1423,7 +1423,7 @@ static inline int spd_fill_page(struct s
|
||||
if (!page)
|
||||
return 1;
|
||||
} else
|
||||
- get_page(page);
|
||||
+ net_get_page(page);
|
||||
|
||||
spd->pages[spd->nr_pages] = page;
|
||||
spd->partial[spd->nr_pages].len = *len;
|
||||
@@ -2056,7 +2056,7 @@ static inline void skb_split_no_header(s
|
||||
* where splitting is expensive.
|
||||
* 2. Split is accurately. We make this.
|
||||
*/
|
||||
- get_page(skb_shinfo(skb)->frags[i].page);
|
||||
+ net_get_page(skb_shinfo(skb)->frags[i].page);
|
||||
skb_shinfo(skb1)->frags[0].page_offset += len - pos;
|
||||
skb_shinfo(skb1)->frags[0].size -= len - pos;
|
||||
skb_shinfo(skb)->frags[i].size = len - pos;
|
||||
@@ -2178,7 +2178,7 @@ int skb_shift(struct sk_buff *tgt, struc
|
||||
to++;
|
||||
|
||||
} else {
|
||||
- get_page(fragfrom->page);
|
||||
+ net_get_page(fragfrom->page);
|
||||
fragto->page = fragfrom->page;
|
||||
fragto->page_offset = fragfrom->page_offset;
|
||||
fragto->size = todo;
|
||||
@@ -2200,7 +2200,7 @@ int skb_shift(struct sk_buff *tgt, struc
|
||||
fragto = &skb_shinfo(tgt)->frags[merge];
|
||||
|
||||
fragto->size += fragfrom->size;
|
||||
- put_page(fragfrom->page);
|
||||
+ net_put_page(fragfrom->page);
|
||||
}
|
||||
|
||||
/* Reposition in the original skb */
|
||||
@@ -2598,7 +2598,7 @@ struct sk_buff *skb_segment(struct sk_bu
|
||||
|
||||
while (pos < offset + len && i < nfrags) {
|
||||
*frag = skb_shinfo(skb)->frags[i];
|
||||
- get_page(frag->page);
|
||||
+ net_get_page(frag->page);
|
||||
size = frag->size;
|
||||
|
||||
if (pos < offset) {
|
||||
diff -upkr linux-2.6.39/net/ipv4/ip_output.c linux-2.6.39/net/ipv4/ip_output.c
|
||||
--- linux-2.6.39/net/ipv4/ip_output.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/ipv4/ip_output.c 2011-05-19 10:47:39.565813000 -0400
|
||||
@@ -985,7 +985,7 @@ alloc_new_skb:
|
||||
err = -EMSGSIZE;
|
||||
goto error;
|
||||
}
|
||||
- get_page(page);
|
||||
+ net_get_page(page);
|
||||
skb_fill_page_desc(skb, i, page, off, 0);
|
||||
frag = &skb_shinfo(skb)->frags[i];
|
||||
}
|
||||
@@ -1220,7 +1220,7 @@ ssize_t ip_append_page(struct sock *sk,
|
||||
if (skb_can_coalesce(skb, i, page, offset)) {
|
||||
skb_shinfo(skb)->frags[i-1].size += len;
|
||||
} else if (i < MAX_SKB_FRAGS) {
|
||||
- get_page(page);
|
||||
+ net_get_page(page);
|
||||
skb_fill_page_desc(skb, i, page, offset, len);
|
||||
} else {
|
||||
err = -EMSGSIZE;
|
||||
diff -upkr linux-2.6.39/net/ipv4/Makefile linux-2.6.39/net/ipv4/Makefile
|
||||
--- linux-2.6.39/net/ipv4/Makefile 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/ipv4/Makefile 2011-05-19 10:46:24.669812999 -0400
|
||||
@@ -48,6 +48,7 @@ obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o
|
||||
obj-$(CONFIG_TCP_CONG_YEAH) += tcp_yeah.o
|
||||
obj-$(CONFIG_TCP_CONG_ILLINOIS) += tcp_illinois.o
|
||||
obj-$(CONFIG_NETLABEL) += cipso_ipv4.o
|
||||
+obj-$(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION) += tcp_zero_copy.o
|
||||
|
||||
obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
|
||||
xfrm4_output.o
|
||||
diff -upkr linux-2.6.39/net/ipv4/tcp.c linux-2.6.39/net/ipv4/tcp.c
|
||||
--- linux-2.6.39/net/ipv4/tcp.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/ipv4/tcp.c 2011-05-19 10:46:24.673813002 -0400
|
||||
@@ -815,7 +815,7 @@ new_segment:
|
||||
if (can_coalesce) {
|
||||
skb_shinfo(skb)->frags[i - 1].size += copy;
|
||||
} else {
|
||||
- get_page(page);
|
||||
+ net_get_page(page);
|
||||
skb_fill_page_desc(skb, i, page, offset, copy);
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ new_segment:
|
||||
goto new_segment;
|
||||
} else if (page) {
|
||||
if (off == PAGE_SIZE) {
|
||||
- put_page(page);
|
||||
+ net_put_page(page);
|
||||
TCP_PAGE(sk) = page = NULL;
|
||||
off = 0;
|
||||
}
|
||||
@@ -1062,9 +1062,9 @@ new_segment:
|
||||
} else {
|
||||
skb_fill_page_desc(skb, i, page, off, copy);
|
||||
if (TCP_PAGE(sk)) {
|
||||
- get_page(page);
|
||||
+ net_get_page(page);
|
||||
} else if (off + copy < PAGE_SIZE) {
|
||||
- get_page(page);
|
||||
+ net_get_page(page);
|
||||
TCP_PAGE(sk) = page;
|
||||
}
|
||||
}
|
||||
diff -upkr linux-2.6.39/net/ipv4/tcp_output.c linux-2.6.39/net/ipv4/tcp_output.c
|
||||
--- linux-2.6.39/net/ipv4/tcp_output.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/ipv4/tcp_output.c 2011-05-19 10:46:24.673813002 -0400
|
||||
@@ -1095,7 +1095,7 @@ static void __pskb_trim_head(struct sk_b
|
||||
k = 0;
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
if (skb_shinfo(skb)->frags[i].size <= eat) {
|
||||
- put_page(skb_shinfo(skb)->frags[i].page);
|
||||
+ net_put_page(skb_shinfo(skb)->frags[i].page);
|
||||
eat -= skb_shinfo(skb)->frags[i].size;
|
||||
} else {
|
||||
skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i];
|
||||
diff -upkr linux-2.6.39/net/ipv4/tcp_zero_copy.c linux-2.6.39/net/ipv4/tcp_zero_copy.c
|
||||
--- linux-2.6.39/net/ipv4/tcp_zero_copy.c 2011-05-19 10:44:53.685813002 -0400
|
||||
+++ linux-2.6.39/net/ipv4/tcp_zero_copy.c 2011-05-19 10:46:24.673813002 -0400
|
||||
@@ -0,0 +1,49 @@
|
||||
+/*
|
||||
+ * Support routines for TCP zero copy transmit
|
||||
+ *
|
||||
+ * Created by Vladislav Bolkhovitin
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * version 2 as published by the Free Software Foundation.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/skbuff.h>
|
||||
+
|
||||
+net_get_page_callback_t net_get_page_callback __read_mostly;
|
||||
+EXPORT_SYMBOL(net_get_page_callback);
|
||||
+
|
||||
+net_put_page_callback_t net_put_page_callback __read_mostly;
|
||||
+EXPORT_SYMBOL(net_put_page_callback);
|
||||
+
|
||||
+/*
|
||||
+ * Caller of this function must ensure that at the moment when it's called
|
||||
+ * there are no pages in the system with net_priv field set to non-zero
|
||||
+ * value. Hence, this function, as well as net_get_page() and net_put_page(),
|
||||
+ * don't need any protection.
|
||||
+ */
|
||||
+int net_set_get_put_page_callbacks(
|
||||
+ net_get_page_callback_t get_callback,
|
||||
+ net_put_page_callback_t put_callback)
|
||||
+{
|
||||
+ int res = 0;
|
||||
+
|
||||
+ if ((net_get_page_callback != NULL) && (get_callback != NULL) &&
|
||||
+ (net_get_page_callback != get_callback)) {
|
||||
+ res = -EBUSY;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if ((net_put_page_callback != NULL) && (put_callback != NULL) &&
|
||||
+ (net_put_page_callback != put_callback)) {
|
||||
+ res = -EBUSY;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ net_get_page_callback = get_callback;
|
||||
+ net_put_page_callback = put_callback;
|
||||
+
|
||||
+out:
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(net_set_get_put_page_callbacks);
|
||||
diff -upkr linux-2.6.39/net/ipv6/ip6_output.c linux-2.6.39/net/ipv6/ip6_output.c
|
||||
--- linux-2.6.39/net/ipv6/ip6_output.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/ipv6/ip6_output.c 2011-05-19 10:46:24.673813002 -0400
|
||||
@@ -1444,7 +1444,7 @@ alloc_new_skb:
|
||||
err = -EMSGSIZE;
|
||||
goto error;
|
||||
}
|
||||
- get_page(page);
|
||||
+ net_get_page(page);
|
||||
skb_fill_page_desc(skb, i, page, sk->sk_sndmsg_off, 0);
|
||||
frag = &skb_shinfo(skb)->frags[i];
|
||||
}
|
||||
diff -upkr linux-2.6.39/net/Kconfig linux-2.6.39/net/Kconfig
|
||||
--- linux-2.6.39/net/Kconfig 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/net/Kconfig 2011-05-19 10:46:24.673813002 -0400
|
||||
@@ -72,6 +72,18 @@ config INET
|
||||
|
||||
Short answer: say Y.
|
||||
|
||||
+config TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION
|
||||
+ bool "TCP/IP zero-copy transfer completion notification"
|
||||
+ depends on INET
|
||||
+ default SCST_ISCSI
|
||||
+ ---help---
|
||||
+ Adds support for sending a notification upon completion of a
|
||||
+ zero-copy TCP/IP transfer. This can speed up certain TCP/IP
|
||||
+ software. Currently this is only used by the iSCSI target driver
|
||||
+ iSCSI-SCST.
|
||||
+
|
||||
+ If unsure, say N.
|
||||
+
|
||||
if INET
|
||||
source "net/ipv4/Kconfig"
|
||||
source "net/ipv6/Kconfig"
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
ABT_DETAILS="x86_64, Fedora 10"
|
||||
ABT_JOBS=3
|
||||
ABT_KERNELS="2.6.38.2 2.6.37.6 2.6.36.4 2.6.35.12 2.6.35.12-u-nc 2.6.34.8-nc 2.6.33.9-nc 2.6.32.36-nc 2.6.31.14-nc 2.6.30.10-nc 2.6.29.6-nc 2.6.28.10-nc 2.6.27.58-nc 2.6.26.8-nc 2.6.25.20-nc 2.6.24.7-nc 2.6.23.17-nc"
|
||||
ABT_KERNELS="2.6.38.6 2.6.37.6 2.6.36.4 2.6.35.13 2.6.35.13-u-nc 2.6.34.9-nc 2.6.33.13-nc 2.6.32.40-nc 2.6.31.14-nc 2.6.30.10-nc 2.6.29.6-nc 2.6.28.10-nc 2.6.27.59-nc 2.6.26.8-nc 2.6.25.20-nc 2.6.24.7-nc 2.6.23.17-nc"
|
||||
|
||||
@@ -108,44 +108,44 @@ extraclean: clean
|
||||
|
||||
debug2release:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
release2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
debug2perf:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
perf2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
disable_proc:
|
||||
sed -i.aa s/"^#define CONFIG_SCST_PROC"/"\/* #define CONFIG_SCST_PROC *\/"/ ../qla_attr.c
|
||||
@cmp ../qla_attr.c ../qla_attr.c.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../qla_attr.c.aa; echo "sed failed"; false; fi
|
||||
@cmp ../qla_attr.c ../qla_attr.c.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../qla_attr.c.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm ../qla_attr.c.aa
|
||||
|
||||
enable_proc:
|
||||
sed -i.aa s/"\/\* #define CONFIG_SCST_PROC \*\/"/"#define CONFIG_SCST_PROC"/ ../qla_attr.c
|
||||
@cmp ../qla_attr.c ../qla_attr.c.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../qla_attr.c.aa; echo "sed failed"; false; fi
|
||||
@cmp ../qla_attr.c ../qla_attr.c.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../qla_attr.c.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm ../qla_attr.c.aa
|
||||
|
||||
.PHONY: all tgt install uninstall clean extraclean debug2perf debug2release perf2debug release2debug disable_proc enable_proc
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
ccflags-y += -Idrivers/scsi/qla2xxx
|
||||
|
||||
qla2x00tgt-y := qla2x00t.o
|
||||
|
||||
obj-$(CONFIG_SCST_QLA_TGT_ADDON) += qla2x00tgt.o
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <linux/version.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
#include <scsi/scsi_tcq.h>
|
||||
|
||||
@@ -414,15 +414,18 @@ function compile_kernel {
|
||||
local subdir="$2"
|
||||
|
||||
echo "Compiling the patched kernel ..."
|
||||
(
|
||||
cd "${outputdir}/linux-$1" \
|
||||
&& make -s prepare \
|
||||
&& make -s scripts \
|
||||
&& LC_ALL=C make -k M="${subdir}"
|
||||
) &> "${outputfile}"
|
||||
local errors=$(grep -c ' error:' "${outputfile}")
|
||||
local warnings=$(grep -c ' warning:' "${outputfile}")
|
||||
echo "${errors} errors / ${warnings} warnings."
|
||||
if (cd "${outputdir}/linux-$1" \
|
||||
&& make -s prepare \
|
||||
&& make -s scripts \
|
||||
&& LC_ALL=C make -k M="${subdir}"
|
||||
) &> "${outputfile}"
|
||||
then
|
||||
local errors=$(grep -c ' error:' "${outputfile}")
|
||||
local warnings=$(grep -c ' warning:' "${outputfile}")
|
||||
echo "${errors} errors / ${warnings} warnings."
|
||||
else
|
||||
echo FAILED
|
||||
fi
|
||||
cat "${outputfile}" | grep -E 'warning:|error:' | sort | uniq -c
|
||||
return 0
|
||||
}
|
||||
|
||||
+42
-18
@@ -173,32 +173,26 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
|
||||
/* Cmd is going to be sent for execution */
|
||||
#define SCST_CMD_STATE_SEND_FOR_EXEC 5
|
||||
|
||||
/* Cmd is being checked if it should be executed locally */
|
||||
#define SCST_CMD_STATE_LOCAL_EXEC 6
|
||||
|
||||
/* Cmd is ready for execution */
|
||||
#define SCST_CMD_STATE_REAL_EXEC 7
|
||||
|
||||
/* Internal post-exec checks */
|
||||
#define SCST_CMD_STATE_PRE_DEV_DONE 8
|
||||
#define SCST_CMD_STATE_PRE_DEV_DONE 6
|
||||
|
||||
/* Internal MODE SELECT pages related checks */
|
||||
#define SCST_CMD_STATE_MODE_SELECT_CHECKS 9
|
||||
#define SCST_CMD_STATE_MODE_SELECT_CHECKS 7
|
||||
|
||||
/* Dev handler's dev_done() is going to be called */
|
||||
#define SCST_CMD_STATE_DEV_DONE 10
|
||||
#define SCST_CMD_STATE_DEV_DONE 8
|
||||
|
||||
/* Checks before target driver's xmit_response() is called */
|
||||
#define SCST_CMD_STATE_PRE_XMIT_RESP 11
|
||||
#define SCST_CMD_STATE_PRE_XMIT_RESP 9
|
||||
|
||||
/* Target driver's xmit_response() is going to be called */
|
||||
#define SCST_CMD_STATE_XMIT_RESP 12
|
||||
#define SCST_CMD_STATE_XMIT_RESP 10
|
||||
|
||||
/* Cmd finished */
|
||||
#define SCST_CMD_STATE_FINISHED 13
|
||||
#define SCST_CMD_STATE_FINISHED 11
|
||||
|
||||
/* Internal cmd finished */
|
||||
#define SCST_CMD_STATE_FINISHED_INTERNAL 14
|
||||
#define SCST_CMD_STATE_FINISHED_INTERNAL 12
|
||||
|
||||
#define SCST_CMD_STATE_LAST_ACTIVE (SCST_CMD_STATE_FINISHED_INTERNAL+100)
|
||||
|
||||
@@ -214,11 +208,23 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
|
||||
/* Waiting for data from the initiator (until scst_rx_data() called) */
|
||||
#define SCST_CMD_STATE_DATA_WAIT (SCST_CMD_STATE_LAST_ACTIVE+4)
|
||||
|
||||
/*
|
||||
* Cmd is ready for exec (after check if its device is blocked or should
|
||||
* be blocked)
|
||||
*/
|
||||
#define SCST_CMD_STATE_START_EXEC (SCST_CMD_STATE_LAST_ACTIVE+5)
|
||||
|
||||
/* Cmd is being checked if it should be executed locally */
|
||||
#define SCST_CMD_STATE_LOCAL_EXEC (SCST_CMD_STATE_LAST_ACTIVE+6)
|
||||
|
||||
/* Cmd is ready for execution */
|
||||
#define SCST_CMD_STATE_REAL_EXEC (SCST_CMD_STATE_LAST_ACTIVE+7)
|
||||
|
||||
/* Waiting for CDB's execution finish */
|
||||
#define SCST_CMD_STATE_REAL_EXECUTING (SCST_CMD_STATE_LAST_ACTIVE+5)
|
||||
#define SCST_CMD_STATE_REAL_EXECUTING (SCST_CMD_STATE_LAST_ACTIVE+8)
|
||||
|
||||
/* Waiting for response's transmission finish */
|
||||
#define SCST_CMD_STATE_XMIT_WAIT (SCST_CMD_STATE_LAST_ACTIVE+6)
|
||||
#define SCST_CMD_STATE_XMIT_WAIT (SCST_CMD_STATE_LAST_ACTIVE+9)
|
||||
|
||||
/*************************************************************
|
||||
* Can be returned instead of cmd's state by dev handlers'
|
||||
@@ -536,7 +542,7 @@ enum scst_exec_context {
|
||||
/*************************************************************
|
||||
** Kernel cache creation helper
|
||||
*************************************************************/
|
||||
#ifndef KMEM_CACHE
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
|
||||
#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
|
||||
sizeof(struct __struct), __alignof__(struct __struct),\
|
||||
(__flags), NULL, NULL)
|
||||
@@ -810,6 +816,15 @@ struct scst_tgt_template {
|
||||
*/
|
||||
void (*task_mgmt_fn_done) (struct scst_mgmt_cmd *mgmt_cmd);
|
||||
|
||||
/*
|
||||
* Called to notify target driver that the command is being aborted.
|
||||
* If target driver wants to redirect processing to some outside
|
||||
* processing, it should get it using scst_cmd_get().
|
||||
*
|
||||
* OPTIONAL
|
||||
*/
|
||||
void (*on_abort_cmd) (struct scst_cmd *cmd);
|
||||
|
||||
/*
|
||||
* This function should detect the target adapters that
|
||||
* are present in the system. The function should return a value
|
||||
@@ -1232,7 +1247,13 @@ struct scst_dev_type {
|
||||
* - SCST_DEV_TM_NOT_COMPLETED - regular standard actions for the
|
||||
* command should be done
|
||||
*
|
||||
* Called without any locks held from a thread context.
|
||||
* Can be called under many internal SCST locks, including under
|
||||
* disabled IRQs, so dev handler should be careful with locking and,
|
||||
* if necessary, pass processing somewhere outside (in a work, e.g.)
|
||||
*
|
||||
* But at the moment it's called under disabled IRQs only for
|
||||
* SCST_ABORT_TASK, however dev handler using it should add a BUG_ON
|
||||
* trap to catch if it's changed in future.
|
||||
*
|
||||
* OPTIONAL
|
||||
*/
|
||||
@@ -1862,7 +1883,10 @@ struct scst_cmd {
|
||||
/* Set if cmd is done */
|
||||
unsigned int done:1;
|
||||
|
||||
/* Set if cmd is finished */
|
||||
/*
|
||||
* Set if cmd is finished. Used under sess_list_lock to sync
|
||||
* between scst_finish_cmd() and scst_abort_cmd()
|
||||
*/
|
||||
unsigned int finished:1;
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_TM
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/drivers/Kconfig b/drivers/Kconfig
|
||||
index a2b902f..92e3d67 100644
|
||||
--- a/drivers/Kconfig
|
||||
+++ b/drivers/Kconfig
|
||||
@@ -22,6 +22,8 @@ source "drivers/ide/Kconfig"
|
||||
|
||||
source "drivers/scsi/Kconfig"
|
||||
|
||||
+source "drivers/scst/Kconfig"
|
||||
+
|
||||
source "drivers/ata/Kconfig"
|
||||
|
||||
source "drivers/md/Kconfig"
|
||||
@@ -0,0 +1,14 @@
|
||||
ccflags-y += -Wno-unused-parameter
|
||||
|
||||
obj-m := scst_cdrom.o scst_changer.o scst_disk.o scst_modisk.o scst_tape.o \
|
||||
scst_vdisk.o scst_raid.o scst_processor.o scst_user.o
|
||||
|
||||
obj-$(CONFIG_SCST_DISK) += scst_disk.o
|
||||
obj-$(CONFIG_SCST_TAPE) += scst_tape.o
|
||||
obj-$(CONFIG_SCST_CDROM) += scst_cdrom.o
|
||||
obj-$(CONFIG_SCST_MODISK) += scst_modisk.o
|
||||
obj-$(CONFIG_SCST_CHANGER) += scst_changer.o
|
||||
obj-$(CONFIG_SCST_RAID) += scst_raid.o
|
||||
obj-$(CONFIG_SCST_PROCESSOR) += scst_processor.o
|
||||
obj-$(CONFIG_SCST_VDISK) += scst_vdisk.o
|
||||
obj-$(CONFIG_SCST_USER) += scst_user.o
|
||||
@@ -0,0 +1,11 @@
|
||||
diff --git a/drivers/Makefile b/drivers/Makefile
|
||||
index b423bb1..f780114 100644
|
||||
--- a/drivers/Makefile
|
||||
+++ b/drivers/Makefile
|
||||
@@ -115,5 +115,6 @@ obj-$(CONFIG_VLYNQ) += vlynq/
|
||||
obj-$(CONFIG_STAGING) += staging/
|
||||
obj-y += platform/
|
||||
obj-y += ieee802154/
|
||||
+obj-$(CONFIG_SCST) += scst/
|
||||
#common clk code
|
||||
obj-y += clk/
|
||||
@@ -0,0 +1,13 @@
|
||||
ccflags-y += -Wno-unused-parameter
|
||||
|
||||
scst-y += scst_main.o
|
||||
scst-y += scst_pres.o
|
||||
scst-y += scst_targ.o
|
||||
scst-y += scst_lib.o
|
||||
scst-y += scst_sysfs.o
|
||||
scst-y += scst_mem.o
|
||||
scst-y += scst_tg.o
|
||||
scst-y += scst_debug.o
|
||||
|
||||
obj-$(CONFIG_SCST) += scst.o dev_handlers/ fcst/ iscsi-scst/ qla2xxx-target/ \
|
||||
srpt/ scst_local/
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
--- linux-2.6.30/block/blk-map.c 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/block/blk-map.c 2010-11-26 17:35:41.027689874 +0300
|
||||
--- linux-2.6.30/block/blk-map.c 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/block/blk-map.c 2011-05-17 21:03:29.661813000 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -272,6 +273,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -272,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -336,7 +338,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+ bio = bio->bi_next;
|
||||
+ b->bi_end_io(b, err);
|
||||
+ }
|
||||
+ rq->bio = NULL;
|
||||
+ rq->bio = 0;
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.30/include/linux/blkdev.h linux-2.6.30/include/linux/blkdev.h
|
||||
--- linux-2.6.30/include/linux/blkdev.h 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/include/linux/blkdev.h 2009-08-12 19:48:06.000000000 +0400
|
||||
--- linux-2.6.30/include/linux/blkdev.h 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/include/linux/blkdev.h 2009-08-12 11:48:06.000000000 -0400
|
||||
@@ -704,6 +704,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.30/include/linux/blkdev.h linux-2.6.30/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.30/include/linux/scatterlist.h linux-2.6.30/include/linux/scatterlist.h
|
||||
--- linux-2.6.30/include/linux/scatterlist.h 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/include/linux/scatterlist.h 2009-08-12 19:50:02.000000000 +0400
|
||||
--- linux-2.6.30/include/linux/scatterlist.h 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/include/linux/scatterlist.h 2009-08-12 11:50:02.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.30/include/linux/scatterlist.h linux-2.6.30/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.30/lib/scatterlist.c linux-2.6.30/lib/scatterlist.c
|
||||
--- linux-2.6.30/lib/scatterlist.c 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/lib/scatterlist.c 2009-08-12 19:56:04.000000000 +0400
|
||||
--- linux-2.6.30/lib/scatterlist.c 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/lib/scatterlist.c 2009-08-12 11:56:04.000000000 -0400
|
||||
@@ -485,3 +485,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.30/lib/scatterlist.c linux-2.6.30/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
--- linux-2.6.31/block/blk-map.c 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/block/blk-map.c 2010-11-26 17:39:55.415689756 +0300
|
||||
--- linux-2.6.31/block/blk-map.c 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/block/blk-map.c 2011-05-17 21:05:32.669812993 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +272,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +272,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.31/include/linux/blkdev.h linux-2.6.31/include/linux/blkdev.h
|
||||
--- linux-2.6.31/include/linux/blkdev.h 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/include/linux/blkdev.h 2009-09-23 14:17:33.000000000 +0400
|
||||
--- linux-2.6.31/include/linux/blkdev.h 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/include/linux/blkdev.h 2009-09-23 06:17:33.000000000 -0400
|
||||
@@ -699,6 +699,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.31/include/linux/blkdev.h linux-2.6.31/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.31/include/linux/scatterlist.h linux-2.6.31/include/linux/scatterlist.h
|
||||
--- linux-2.6.31/include/linux/scatterlist.h 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/include/linux/scatterlist.h 2009-09-23 14:17:33.000000000 +0400
|
||||
--- linux-2.6.31/include/linux/scatterlist.h 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/include/linux/scatterlist.h 2009-09-23 06:17:33.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.31/include/linux/scatterlist.h linux-2.6.31/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.31/lib/scatterlist.c linux-2.6.31/lib/scatterlist.c
|
||||
--- linux-2.6.31/lib/scatterlist.c 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/lib/scatterlist.c 2009-09-23 14:17:33.000000000 +0400
|
||||
--- linux-2.6.31/lib/scatterlist.c 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/lib/scatterlist.c 2009-09-23 06:17:33.000000000 -0400
|
||||
@@ -493,3 +493,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.31/lib/scatterlist.c linux-2.6.31/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
--- linux-2.6.32/block/blk-map.c 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/block/blk-map.c 2010-11-26 17:48:24.811689511 +0300
|
||||
--- linux-2.6.32/block/blk-map.c 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/block/blk-map.c 2011-05-17 20:56:18.341812997 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +272,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +272,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.32/include/linux/blkdev.h linux-2.6.32/include/linux/blkdev.h
|
||||
--- linux-2.6.32/include/linux/blkdev.h 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/include/linux/blkdev.h 2009-12-16 15:21:35.000000000 +0300
|
||||
--- linux-2.6.32/include/linux/blkdev.h 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/include/linux/blkdev.h 2009-12-16 07:21:35.000000000 -0500
|
||||
@@ -708,6 +708,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.32/include/linux/blkdev.h linux-2.6.32/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.32/include/linux/scatterlist.h linux-2.6.32/include/linux/scatterlist.h
|
||||
--- linux-2.6.32/include/linux/scatterlist.h 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/include/linux/scatterlist.h 2009-12-16 15:21:35.000000000 +0300
|
||||
--- linux-2.6.32/include/linux/scatterlist.h 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/include/linux/scatterlist.h 2009-12-16 07:21:35.000000000 -0500
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.32/include/linux/scatterlist.h linux-2.6.32/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.32/lib/scatterlist.c linux-2.6.32/lib/scatterlist.c
|
||||
--- linux-2.6.32/lib/scatterlist.c 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/lib/scatterlist.c 2009-12-16 15:21:35.000000000 +0300
|
||||
--- linux-2.6.32/lib/scatterlist.c 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/lib/scatterlist.c 2009-12-16 07:21:35.000000000 -0500
|
||||
@@ -493,3 +493,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.32/lib/scatterlist.c linux-2.6.32/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
--- linux-2.6.33/block/blk-map.c 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/block/blk-map.c 2010-11-26 17:50:39.511689888 +0300
|
||||
--- linux-2.6.33/block/blk-map.c 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/block/blk-map.c 2011-05-17 21:09:00.317812998 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +272,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +272,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.33/include/linux/blkdev.h linux-2.6.33/include/linux/blkdev.h
|
||||
--- linux-2.6.33/include/linux/blkdev.h 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/include/linux/blkdev.h 2010-03-01 15:41:59.000000000 +0300
|
||||
--- linux-2.6.33/include/linux/blkdev.h 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/include/linux/blkdev.h 2010-03-01 07:41:59.000000000 -0500
|
||||
@@ -710,6 +710,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.33/include/linux/blkdev.h linux-2.6.33/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.33/include/linux/scatterlist.h linux-2.6.33/include/linux/scatterlist.h
|
||||
--- linux-2.6.33/include/linux/scatterlist.h 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/include/linux/scatterlist.h 2010-03-01 15:41:59.000000000 +0300
|
||||
--- linux-2.6.33/include/linux/scatterlist.h 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/include/linux/scatterlist.h 2010-03-01 07:41:59.000000000 -0500
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.33/include/linux/scatterlist.h linux-2.6.33/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.33/lib/scatterlist.c linux-2.6.33/lib/scatterlist.c
|
||||
--- linux-2.6.33/lib/scatterlist.c 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/lib/scatterlist.c 2010-03-01 15:41:59.000000000 +0300
|
||||
--- linux-2.6.33/lib/scatterlist.c 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/lib/scatterlist.c 2010-03-01 07:41:59.000000000 -0500
|
||||
@@ -493,3 +493,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.33/lib/scatterlist.c linux-2.6.33/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
--- linux-2.6.34/block/blk-map.c 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/block/blk-map.c 2010-11-26 17:58:41.579690663 +0300
|
||||
--- linux-2.6.34/block/blk-map.c 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/block/blk-map.c 2011-05-17 21:10:43.745812995 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +273,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -347,8 +349,8 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.34/include/linux/blkdev.h linux-2.6.34/include/linux/blkdev.h
|
||||
--- linux-2.6.34/include/linux/blkdev.h 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/include/linux/blkdev.h 2010-05-24 14:51:22.000000000 +0400
|
||||
--- linux-2.6.34/include/linux/blkdev.h 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/include/linux/blkdev.h 2010-05-24 06:51:22.000000000 -0400
|
||||
@@ -713,6 +713,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -369,8 +371,8 @@ diff -upkr linux-2.6.34/include/linux/blkdev.h linux-2.6.34/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.34/include/linux/scatterlist.h linux-2.6.34/include/linux/scatterlist.h
|
||||
--- linux-2.6.34/include/linux/scatterlist.h 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/include/linux/scatterlist.h 2010-05-24 14:51:22.000000000 +0400
|
||||
--- linux-2.6.34/include/linux/scatterlist.h 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/include/linux/scatterlist.h 2010-05-24 06:51:22.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -391,8 +393,8 @@ diff -upkr linux-2.6.34/include/linux/scatterlist.h linux-2.6.34/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.34/lib/scatterlist.c linux-2.6.34/lib/scatterlist.c
|
||||
--- linux-2.6.34/lib/scatterlist.c 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/lib/scatterlist.c 2010-05-24 14:51:22.000000000 +0400
|
||||
--- linux-2.6.34/lib/scatterlist.c 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/lib/scatterlist.c 2010-05-24 06:51:22.000000000 -0400
|
||||
@@ -494,3 +494,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -526,4 +528,3 @@ diff -upkr linux-2.6.34/lib/scatterlist.c linux-2.6.34/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
--- linux-2.6.35/block/blk-map.c 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/block/blk-map.c 2010-11-26 18:03:58.107693773 +0300
|
||||
--- linux-2.6.35/block/blk-map.c 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/block/blk-map.c 2011-05-17 21:12:23.125813000 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +273,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -347,8 +349,8 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.35/include/linux/blkdev.h linux-2.6.35/include/linux/blkdev.h
|
||||
--- linux-2.6.35/include/linux/blkdev.h 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/include/linux/blkdev.h 2010-08-04 12:21:59.737128732 +0400
|
||||
--- linux-2.6.35/include/linux/blkdev.h 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/include/linux/blkdev.h 2010-08-04 04:21:59.737128732 -0400
|
||||
@@ -717,6 +717,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -369,8 +371,8 @@ diff -upkr linux-2.6.35/include/linux/blkdev.h linux-2.6.35/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.35/include/linux/scatterlist.h linux-2.6.35/include/linux/scatterlist.h
|
||||
--- linux-2.6.35/include/linux/scatterlist.h 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/include/linux/scatterlist.h 2010-08-04 12:21:59.741129485 +0400
|
||||
--- linux-2.6.35/include/linux/scatterlist.h 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/include/linux/scatterlist.h 2010-08-04 04:21:59.741129485 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -391,8 +393,8 @@ diff -upkr linux-2.6.35/include/linux/scatterlist.h linux-2.6.35/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.35/lib/scatterlist.c linux-2.6.35/lib/scatterlist.c
|
||||
--- linux-2.6.35/lib/scatterlist.c 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/lib/scatterlist.c 2010-08-04 12:21:59.741129485 +0400
|
||||
--- linux-2.6.35/lib/scatterlist.c 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/lib/scatterlist.c 2010-08-04 04:21:59.741129485 -0400
|
||||
@@ -494,3 +494,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -526,4 +528,3 @@ diff -upkr linux-2.6.35/lib/scatterlist.c linux-2.6.35/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
--- linux-2.6.36/block/blk-map.c 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/block/blk-map.c 2010-11-26 17:52:19.467689539 +0300
|
||||
--- linux-2.6.36/block/blk-map.c 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/block/blk-map.c 2011-05-17 21:13:42.301812997 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +273,339 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -349,8 +351,8 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.36/include/linux/blkdev.h linux-2.6.36/include/linux/blkdev.h
|
||||
--- linux-2.6.36/include/linux/blkdev.h 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/include/linux/blkdev.h 2010-10-26 12:00:15.899759399 +0400
|
||||
--- linux-2.6.36/include/linux/blkdev.h 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/include/linux/blkdev.h 2010-10-26 04:00:15.899759399 -0400
|
||||
@@ -629,6 +629,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -371,8 +373,8 @@ diff -upkr linux-2.6.36/include/linux/blkdev.h linux-2.6.36/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.36/include/linux/scatterlist.h linux-2.6.36/include/linux/scatterlist.h
|
||||
--- linux-2.6.36/include/linux/scatterlist.h 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/include/linux/scatterlist.h 2010-10-26 12:00:15.899759399 +0400
|
||||
--- linux-2.6.36/include/linux/scatterlist.h 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/include/linux/scatterlist.h 2010-10-26 04:00:15.899759399 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -393,8 +395,8 @@ diff -upkr linux-2.6.36/include/linux/scatterlist.h linux-2.6.36/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.36/lib/scatterlist.c linux-2.6.36/lib/scatterlist.c
|
||||
--- linux-2.6.36/lib/scatterlist.c 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/lib/scatterlist.c 2010-10-26 12:00:15.899759399 +0400
|
||||
--- linux-2.6.36/lib/scatterlist.c 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/lib/scatterlist.c 2010-10-26 04:00:15.899759399 -0400
|
||||
@@ -517,3 +517,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -528,4 +530,3 @@ diff -upkr linux-2.6.36/lib/scatterlist.c linux-2.6.36/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
--- linux-2.6.37/block/blk-map.c 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/block/blk-map.c 2011-01-08 16:45:54.350430208 +0300
|
||||
--- linux-2.6.37/block/blk-map.c 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/block/blk-map.c 2011-05-17 21:15:14.329812999 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -274,6 +276,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -274,6 +276,339 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -349,8 +351,8 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.37/include/linux/blkdev.h linux-2.6.37/include/linux/blkdev.h
|
||||
--- linux-2.6.37/include/linux/blkdev.h 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/include/linux/blkdev.h 2011-01-08 16:45:54.350430208 +0300
|
||||
--- linux-2.6.37/include/linux/blkdev.h 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/include/linux/blkdev.h 2011-01-08 08:45:54.350430208 -0500
|
||||
@@ -592,6 +592,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -371,8 +373,8 @@ diff -upkr linux-2.6.37/include/linux/blkdev.h linux-2.6.37/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.37/include/linux/scatterlist.h linux-2.6.37/include/linux/scatterlist.h
|
||||
--- linux-2.6.37/include/linux/scatterlist.h 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/include/linux/scatterlist.h 2011-01-08 16:45:54.354431761 +0300
|
||||
--- linux-2.6.37/include/linux/scatterlist.h 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/include/linux/scatterlist.h 2011-01-08 08:45:54.354431761 -0500
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -393,8 +395,8 @@ diff -upkr linux-2.6.37/include/linux/scatterlist.h linux-2.6.37/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.37/lib/scatterlist.c linux-2.6.37/lib/scatterlist.c
|
||||
--- linux-2.6.37/lib/scatterlist.c 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/lib/scatterlist.c 2011-01-08 16:45:54.401930472 +0300
|
||||
--- linux-2.6.37/lib/scatterlist.c 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/lib/scatterlist.c 2011-01-08 08:45:54.401930472 -0500
|
||||
@@ -517,3 +517,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -528,4 +530,3 @@ diff -upkr linux-2.6.37/lib/scatterlist.c linux-2.6.37/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
--- linux-2.6.38/block/blk-map.c 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/block/blk-map.c 2011-03-18 17:46:41.853627967 +0300
|
||||
--- linux-2.6.38/block/blk-map.c 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/block/blk-map.c 2011-05-11 22:07:37.589813000 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -274,6 +276,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -274,6 +276,339 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -349,8 +351,8 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.38/include/linux/blkdev.h linux-2.6.38/include/linux/blkdev.h
|
||||
--- linux-2.6.38/include/linux/blkdev.h 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/include/linux/blkdev.h 2011-03-18 17:19:00.442412966 +0300
|
||||
--- linux-2.6.38/include/linux/blkdev.h 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/include/linux/blkdev.h 2011-03-18 10:19:00.000000000 -0400
|
||||
@@ -593,6 +593,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -371,8 +373,8 @@ diff -upkr linux-2.6.38/include/linux/blkdev.h linux-2.6.38/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.38/include/linux/scatterlist.h linux-2.6.38/include/linux/scatterlist.h
|
||||
--- linux-2.6.38/include/linux/scatterlist.h 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/include/linux/scatterlist.h 2011-03-18 17:19:00.446410968 +0300
|
||||
--- linux-2.6.38/include/linux/scatterlist.h 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/include/linux/scatterlist.h 2011-03-18 10:19:00.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -393,8 +395,8 @@ diff -upkr linux-2.6.38/include/linux/scatterlist.h linux-2.6.38/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.38/lib/scatterlist.c linux-2.6.38/lib/scatterlist.c
|
||||
--- linux-2.6.38/lib/scatterlist.c 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/lib/scatterlist.c 2011-03-18 17:46:41.853627967 +0300
|
||||
--- linux-2.6.38/lib/scatterlist.c 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/lib/scatterlist.c 2011-03-18 10:46:41.000000000 -0400
|
||||
@@ -517,3 +517,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,532 @@
|
||||
diff -upkr linux-2.6.39/block/blk-map.c linux-2.6.39/block/blk-map.c
|
||||
--- linux-2.6.39/block/blk-map.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/block/blk-map.c 2011-05-19 10:49:02.753812997 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/blkdev.h>
|
||||
+#include <linux/scatterlist.h>
|
||||
+#include <linux/slab.h>
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -274,6 +276,339 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
+struct blk_kern_sg_work {
|
||||
+ atomic_t bios_inflight;
|
||||
+ struct sg_table sg_table;
|
||||
+ struct scatterlist *src_sgl;
|
||||
+};
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+static void blk_bio_map_kern_endio(struct bio *bio, int err)
|
||||
+{
|
||||
+ struct blk_kern_sg_work *bw = bio->bi_private;
|
||||
+
|
||||
+ if (bw != NULL) {
|
||||
+ /* Decrement the bios in processing and, if zero, free */
|
||||
+ BUG_ON(atomic_read(&bw->bios_inflight) <= 0);
|
||||
+ if (atomic_dec_and_test(&bw->bios_inflight)) {
|
||||
+ if ((bio_data_dir(bio) == READ) && (err == 0)) {
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ local_irq_save(flags); /* to protect KMs */
|
||||
+ sg_copy(bw->src_sgl, bw->sg_table.sgl, 0, 0,
|
||||
+ KM_BIO_DST_IRQ, KM_BIO_SRC_IRQ);
|
||||
+ local_irq_restore(flags);
|
||||
+ }
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ bio_put(bio);
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+static int blk_rq_copy_kern_sg(struct request *rq, struct scatterlist *sgl,
|
||||
+ int nents, struct blk_kern_sg_work **pbw,
|
||||
+ gfp_t gfp, gfp_t page_gfp)
|
||||
+{
|
||||
+ int res = 0, i;
|
||||
+ struct scatterlist *sg;
|
||||
+ struct scatterlist *new_sgl;
|
||||
+ int new_sgl_nents;
|
||||
+ size_t len = 0, to_copy;
|
||||
+ struct blk_kern_sg_work *bw;
|
||||
+
|
||||
+ bw = kzalloc(sizeof(*bw), gfp);
|
||||
+ if (bw == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ bw->src_sgl = sgl;
|
||||
+
|
||||
+ for_each_sg(sgl, sg, nents, i)
|
||||
+ len += sg->length;
|
||||
+ to_copy = len;
|
||||
+
|
||||
+ new_sgl_nents = PFN_UP(len);
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg;
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
+
|
||||
+ len -= PAGE_SIZE;
|
||||
+ }
|
||||
+
|
||||
+ if (rq_data_dir(rq) == WRITE) {
|
||||
+ /*
|
||||
+ * We need to limit amount of copied data to to_copy, because
|
||||
+ * sgl might have the last element in sgl not marked as last in
|
||||
+ * SG chaining.
|
||||
+ */
|
||||
+ sg_copy(new_sgl, sgl, 0, to_copy,
|
||||
+ KM_USER0, KM_USER1);
|
||||
+ }
|
||||
+
|
||||
+ *pbw = bw;
|
||||
+ /*
|
||||
+ * REQ_COPY_USER name is misleading. It should be something like
|
||||
+ * REQ_HAS_TAIL_SPACE_FOR_PADDING.
|
||||
+ */
|
||||
+ rq->cmd_flags |= REQ_COPY_USER;
|
||||
+
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
+
|
||||
+static int __blk_rq_map_kern_sg(struct request *rq, struct scatterlist *sgl,
|
||||
+ int nents, struct blk_kern_sg_work *bw, gfp_t gfp)
|
||||
+{
|
||||
+ int res;
|
||||
+ struct request_queue *q = rq->q;
|
||||
+ int rw = rq_data_dir(rq);
|
||||
+ int max_nr_vecs, i;
|
||||
+ size_t tot_len;
|
||||
+ bool need_new_bio;
|
||||
+ struct scatterlist *sg, *prev_sg = NULL;
|
||||
+ struct bio *bio = NULL, *hbio = NULL, *tbio = NULL;
|
||||
+ int bios;
|
||||
+
|
||||
+ if (unlikely((sgl == NULL) || (sgl->length == 0) || (nents <= 0))) {
|
||||
+ WARN_ON(1);
|
||||
+ res = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Let's keep each bio allocation inside a single page to decrease
|
||||
+ * probability of failure.
|
||||
+ */
|
||||
+ max_nr_vecs = min_t(size_t,
|
||||
+ ((PAGE_SIZE - sizeof(struct bio)) / sizeof(struct bio_vec)),
|
||||
+ BIO_MAX_PAGES);
|
||||
+
|
||||
+ need_new_bio = true;
|
||||
+ tot_len = 0;
|
||||
+ bios = 0;
|
||||
+ for_each_sg(sgl, sg, nents, i) {
|
||||
+ struct page *page = sg_page(sg);
|
||||
+ void *page_addr = page_address(page);
|
||||
+ size_t len = sg->length, l;
|
||||
+ size_t offset = sg->offset;
|
||||
+
|
||||
+ tot_len += len;
|
||||
+ prev_sg = sg;
|
||||
+
|
||||
+ /*
|
||||
+ * Each segment must be aligned on DMA boundary and
|
||||
+ * not on stack. The last one may have unaligned
|
||||
+ * length as long as the total length is aligned to
|
||||
+ * DMA padding alignment.
|
||||
+ */
|
||||
+ if (i == nents - 1)
|
||||
+ l = 0;
|
||||
+ else
|
||||
+ l = len;
|
||||
+ if (((sg->offset | l) & queue_dma_alignment(q)) ||
|
||||
+ (page_addr && object_is_on_stack(page_addr + sg->offset))) {
|
||||
+ res = -EINVAL;
|
||||
+ goto out_free_bios;
|
||||
+ }
|
||||
+
|
||||
+ while (len > 0) {
|
||||
+ size_t bytes;
|
||||
+ int rc;
|
||||
+
|
||||
+ if (need_new_bio) {
|
||||
+ bio = bio_kmalloc(gfp, max_nr_vecs);
|
||||
+ if (bio == NULL) {
|
||||
+ res = -ENOMEM;
|
||||
+ goto out_free_bios;
|
||||
+ }
|
||||
+
|
||||
+ if (rw == WRITE)
|
||||
+ bio->bi_rw |= REQ_WRITE;
|
||||
+
|
||||
+ bios++;
|
||||
+ bio->bi_private = bw;
|
||||
+ bio->bi_end_io = blk_bio_map_kern_endio;
|
||||
+
|
||||
+ if (hbio == NULL)
|
||||
+ hbio = tbio = bio;
|
||||
+ else
|
||||
+ tbio = tbio->bi_next = bio;
|
||||
+ }
|
||||
+
|
||||
+ bytes = min_t(size_t, len, PAGE_SIZE - offset);
|
||||
+
|
||||
+ rc = bio_add_pc_page(q, bio, page, bytes, offset);
|
||||
+ if (rc < bytes) {
|
||||
+ if (unlikely(need_new_bio || (rc < 0))) {
|
||||
+ if (rc < 0)
|
||||
+ res = rc;
|
||||
+ else
|
||||
+ res = -EIO;
|
||||
+ goto out_free_bios;
|
||||
+ } else {
|
||||
+ need_new_bio = true;
|
||||
+ len -= rc;
|
||||
+ offset += rc;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ need_new_bio = false;
|
||||
+ offset = 0;
|
||||
+ len -= bytes;
|
||||
+ page = nth_page(page, 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (hbio == NULL) {
|
||||
+ res = -EINVAL;
|
||||
+ goto out_free_bios;
|
||||
+ }
|
||||
+
|
||||
+ /* Total length must be aligned on DMA padding alignment */
|
||||
+ if ((tot_len & q->dma_pad_mask) &&
|
||||
+ !(rq->cmd_flags & REQ_COPY_USER)) {
|
||||
+ res = -EINVAL;
|
||||
+ goto out_free_bios;
|
||||
+ }
|
||||
+
|
||||
+ if (bw != NULL)
|
||||
+ atomic_set(&bw->bios_inflight, bios);
|
||||
+
|
||||
+ while (hbio != NULL) {
|
||||
+ bio = hbio;
|
||||
+ hbio = hbio->bi_next;
|
||||
+ bio->bi_next = NULL;
|
||||
+
|
||||
+ blk_queue_bounce(q, &bio);
|
||||
+
|
||||
+ res = blk_rq_append_bio(q, rq, bio);
|
||||
+ if (unlikely(res != 0)) {
|
||||
+ bio->bi_next = hbio;
|
||||
+ hbio = bio;
|
||||
+ /* We can have one or more bios bounced */
|
||||
+ goto out_unmap_bios;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ res = 0;
|
||||
+
|
||||
+ rq->buffer = NULL;
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+out_unmap_bios:
|
||||
+ blk_rq_unmap_kern_sg(rq, res);
|
||||
+
|
||||
+out_free_bios:
|
||||
+ while (hbio != NULL) {
|
||||
+ bio = hbio;
|
||||
+ hbio = hbio->bi_next;
|
||||
+ bio_put(bio);
|
||||
+ }
|
||||
+ goto out;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * blk_rq_map_kern_sg - map kernel data to a request, for REQ_TYPE_BLOCK_PC
|
||||
+ * @rq: request to fill
|
||||
+ * @sgl: area to map
|
||||
+ * @nents: number of elements in @sgl
|
||||
+ * @gfp: memory allocation flags
|
||||
+ *
|
||||
+ * Description:
|
||||
+ * Data will be mapped directly if possible. Otherwise a bounce
|
||||
+ * buffer will be used.
|
||||
+ */
|
||||
+int blk_rq_map_kern_sg(struct request *rq, struct scatterlist *sgl,
|
||||
+ int nents, gfp_t gfp)
|
||||
+{
|
||||
+ int res;
|
||||
+
|
||||
+ res = __blk_rq_map_kern_sg(rq, sgl, nents, NULL, gfp);
|
||||
+ if (unlikely(res != 0)) {
|
||||
+ struct blk_kern_sg_work *bw = NULL;
|
||||
+
|
||||
+ res = blk_rq_copy_kern_sg(rq, sgl, nents, &bw,
|
||||
+ gfp, rq->q->bounce_gfp | gfp);
|
||||
+ if (unlikely(res != 0))
|
||||
+ goto out;
|
||||
+
|
||||
+ res = __blk_rq_map_kern_sg(rq, bw->sg_table.sgl,
|
||||
+ bw->sg_table.nents, bw, gfp);
|
||||
+ if (res != 0) {
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ rq->buffer = NULL;
|
||||
+
|
||||
+out:
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(blk_rq_map_kern_sg);
|
||||
+
|
||||
+/**
|
||||
+ * blk_rq_unmap_kern_sg - unmap a request with kernel sg
|
||||
+ * @rq: request to unmap
|
||||
+ * @err: non-zero error code
|
||||
+ *
|
||||
+ * Description:
|
||||
+ * Unmap a rq previously mapped by blk_rq_map_kern_sg(). Must be called
|
||||
+ * only in case of an error!
|
||||
+ */
|
||||
+void blk_rq_unmap_kern_sg(struct request *rq, int err)
|
||||
+{
|
||||
+ struct bio *bio = rq->bio;
|
||||
+
|
||||
+ while (bio) {
|
||||
+ struct bio *b = bio;
|
||||
+ bio = bio->bi_next;
|
||||
+ b->bi_end_io(b, err);
|
||||
+ }
|
||||
+ rq->bio = NULL;
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+EXPORT_SYMBOL(blk_rq_unmap_kern_sg);
|
||||
+
|
||||
/**
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.39/include/linux/blkdev.h linux-2.6.39/include/linux/blkdev.h
|
||||
--- linux-2.6.39/include/linux/blkdev.h 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/include/linux/blkdev.h 2011-05-19 10:49:02.753812997 -0400
|
||||
@@ -592,6 +592,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
|
||||
+#define SCSI_EXEC_REQ_FIFO_DEFINED
|
||||
+
|
||||
#ifdef CONFIG_BOUNCE
|
||||
extern int init_emergency_isa_pool(void);
|
||||
extern void blk_queue_bounce(struct request_queue *q, struct bio **bio);
|
||||
@@ -707,6 +709,9 @@ extern int blk_rq_map_kern(struct reques
|
||||
extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
|
||||
struct rq_map_data *, struct sg_iovec *, int,
|
||||
unsigned int, gfp_t);
|
||||
+extern int blk_rq_map_kern_sg(struct request *rq, struct scatterlist *sgl,
|
||||
+ int nents, gfp_t gfp);
|
||||
+extern void blk_rq_unmap_kern_sg(struct request *rq, int err);
|
||||
extern int blk_execute_rq(struct request_queue *, struct gendisk *,
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.39/include/linux/scatterlist.h linux-2.6.39/include/linux/scatterlist.h
|
||||
--- linux-2.6.39/include/linux/scatterlist.h 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/include/linux/scatterlist.h 2011-05-19 10:49:02.753812997 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/scatterlist.h>
|
||||
+#include <asm/kmap_types.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
#include <asm/io.h>
|
||||
@@ -218,6 +219,10 @@ size_t sg_copy_from_buffer(struct scatte
|
||||
size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
|
||||
void *buf, size_t buflen);
|
||||
|
||||
+int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg,
|
||||
+ int nents_to_copy, size_t copy_len,
|
||||
+ enum km_type d_km_type, enum km_type s_km_type);
|
||||
+
|
||||
/*
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.39/lib/scatterlist.c linux-2.6.39/lib/scatterlist.c
|
||||
--- linux-2.6.39/lib/scatterlist.c 2011-05-19 00:06:34.000000000 -0400
|
||||
+++ linux-2.6.39/lib/scatterlist.c 2011-05-19 10:49:02.753812997 -0400
|
||||
@@ -517,3 +517,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
EXPORT_SYMBOL(sg_copy_to_buffer);
|
||||
+
|
||||
+/*
|
||||
+ * Can switch to the next dst_sg element, so, to copy to strictly only
|
||||
+ * one dst_sg element, it must be either last in the chain, or
|
||||
+ * copy_len == dst_sg->length.
|
||||
+ */
|
||||
+static int sg_copy_elem(struct scatterlist **pdst_sg, size_t *pdst_len,
|
||||
+ size_t *pdst_offs, struct scatterlist *src_sg,
|
||||
+ size_t copy_len,
|
||||
+ enum km_type d_km_type, enum km_type s_km_type)
|
||||
+{
|
||||
+ int res = 0;
|
||||
+ struct scatterlist *dst_sg;
|
||||
+ size_t src_len, dst_len, src_offs, dst_offs;
|
||||
+ struct page *src_page, *dst_page;
|
||||
+
|
||||
+ dst_sg = *pdst_sg;
|
||||
+ dst_len = *pdst_len;
|
||||
+ dst_offs = *pdst_offs;
|
||||
+ dst_page = sg_page(dst_sg);
|
||||
+
|
||||
+ src_page = sg_page(src_sg);
|
||||
+ src_len = src_sg->length;
|
||||
+ src_offs = src_sg->offset;
|
||||
+
|
||||
+ do {
|
||||
+ void *saddr, *daddr;
|
||||
+ size_t n;
|
||||
+
|
||||
+ saddr = kmap_atomic(src_page +
|
||||
+ (src_offs >> PAGE_SHIFT), s_km_type) +
|
||||
+ (src_offs & ~PAGE_MASK);
|
||||
+ daddr = kmap_atomic(dst_page +
|
||||
+ (dst_offs >> PAGE_SHIFT), d_km_type) +
|
||||
+ (dst_offs & ~PAGE_MASK);
|
||||
+
|
||||
+ if (((src_offs & ~PAGE_MASK) == 0) &&
|
||||
+ ((dst_offs & ~PAGE_MASK) == 0) &&
|
||||
+ (src_len >= PAGE_SIZE) && (dst_len >= PAGE_SIZE) &&
|
||||
+ (copy_len >= PAGE_SIZE)) {
|
||||
+ copy_page(daddr, saddr);
|
||||
+ n = PAGE_SIZE;
|
||||
+ } else {
|
||||
+ n = min_t(size_t, PAGE_SIZE - (dst_offs & ~PAGE_MASK),
|
||||
+ PAGE_SIZE - (src_offs & ~PAGE_MASK));
|
||||
+ n = min(n, src_len);
|
||||
+ n = min(n, dst_len);
|
||||
+ n = min_t(size_t, n, copy_len);
|
||||
+ memcpy(daddr, saddr, n);
|
||||
+ }
|
||||
+ dst_offs += n;
|
||||
+ src_offs += n;
|
||||
+
|
||||
+ kunmap_atomic(saddr, s_km_type);
|
||||
+ kunmap_atomic(daddr, d_km_type);
|
||||
+
|
||||
+ res += n;
|
||||
+ copy_len -= n;
|
||||
+ if (copy_len == 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ src_len -= n;
|
||||
+ dst_len -= n;
|
||||
+ if (dst_len == 0) {
|
||||
+ dst_sg = sg_next(dst_sg);
|
||||
+ if (dst_sg == NULL)
|
||||
+ goto out;
|
||||
+ dst_page = sg_page(dst_sg);
|
||||
+ dst_len = dst_sg->length;
|
||||
+ dst_offs = dst_sg->offset;
|
||||
+ }
|
||||
+ } while (src_len > 0);
|
||||
+
|
||||
+out:
|
||||
+ *pdst_sg = dst_sg;
|
||||
+ *pdst_len = dst_len;
|
||||
+ *pdst_offs = dst_offs;
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * sg_copy - copy one SG vector to another
|
||||
+ * @dst_sg: destination SG
|
||||
+ * @src_sg: source SG
|
||||
+ * @nents_to_copy: maximum number of entries to copy
|
||||
+ * @copy_len: maximum amount of data to copy. If 0, then copy all.
|
||||
+ * @d_km_type: kmap_atomic type for the destination SG
|
||||
+ * @s_km_type: kmap_atomic type for the source SG
|
||||
+ *
|
||||
+ * Description:
|
||||
+ * Data from the source SG vector will be copied to the destination SG
|
||||
+ * vector. End of the vectors will be determined by sg_next() returning
|
||||
+ * NULL. Returns number of bytes copied.
|
||||
+ */
|
||||
+int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg,
|
||||
+ int nents_to_copy, size_t copy_len,
|
||||
+ enum km_type d_km_type, enum km_type s_km_type)
|
||||
+{
|
||||
+ int res = 0;
|
||||
+ size_t dst_len, dst_offs;
|
||||
+
|
||||
+ if (copy_len == 0)
|
||||
+ copy_len = 0x7FFFFFFF; /* copy all */
|
||||
+
|
||||
+ if (nents_to_copy == 0)
|
||||
+ nents_to_copy = 0x7FFFFFFF; /* copy all */
|
||||
+
|
||||
+ dst_len = dst_sg->length;
|
||||
+ dst_offs = dst_sg->offset;
|
||||
+
|
||||
+ do {
|
||||
+ int copied = sg_copy_elem(&dst_sg, &dst_len, &dst_offs,
|
||||
+ src_sg, copy_len, d_km_type, s_km_type);
|
||||
+ copy_len -= copied;
|
||||
+ res += copied;
|
||||
+ if ((copy_len == 0) || (dst_sg == NULL))
|
||||
+ goto out;
|
||||
+
|
||||
+ nents_to_copy--;
|
||||
+ if (nents_to_copy == 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ src_sg = sg_next(src_sg);
|
||||
+ } while (src_sg != NULL);
|
||||
+
|
||||
+out:
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
+16
-16
@@ -162,58 +162,58 @@ extraclean: clean
|
||||
|
||||
debug2release:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
cd $(DEV_HANDLERS_DIR) && $(MAKE) $@
|
||||
|
||||
release2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
cd $(DEV_HANDLERS_DIR) && $(MAKE) $@
|
||||
|
||||
debug2perf:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
cd $(DEV_HANDLERS_DIR) && $(MAKE) $@
|
||||
|
||||
perf2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
cd $(DEV_HANDLERS_DIR) && $(MAKE) $@
|
||||
|
||||
disable_proc:
|
||||
sed -i.aa s/"^#define CONFIG_SCST_PROC"/"\/* #define CONFIG_SCST_PROC *\/"/ ../include/scst.h
|
||||
@cmp ../include/scst.h ../include/scst.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../include/scst.h.aa; echo "sed failed"; false; fi
|
||||
@cmp ../include/scst.h ../include/scst.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../include/scst.h.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm ../include/scst.h.aa
|
||||
sed -i.aa s/"^scst-y += scst_proc.o"/"#scst\-y += scst_proc.o"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#scst\-y += scst_sysfs.o"/"scst\-y += scst_sysfs.o"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
enable_proc:
|
||||
sed -i.aa s/"\/\* #define CONFIG_SCST_PROC \*\/"/"#define CONFIG_SCST_PROC"/ ../include/scst.h
|
||||
@cmp ../include/scst.h ../include/scst.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../include/scst.h.aa; echo "sed failed"; false; fi
|
||||
@cmp ../include/scst.h ../include/scst.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../include/scst.h.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm ../include/scst.h.aa
|
||||
sed -i.aa s/"#scst\-y += scst_proc.o"/"scst\-y += scst_proc.o"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^scst\-y += scst_sysfs.o"/"#scst\-y += scst_sysfs.o"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
.PHONY: all install uninstall clean extraclean debug2release release2debug debug2perf perf2debug disable_proc enable_proc
|
||||
|
||||
@@ -90,34 +90,34 @@ extraclean: clean
|
||||
|
||||
debug2release:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
release2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
debug2perf:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
perf2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
.PHONY: all install uninstall clean extraclean debug2release release2debug debug2perf perf2debug
|
||||
|
||||
@@ -2408,6 +2408,7 @@ again:
|
||||
return;
|
||||
}
|
||||
|
||||
/* Can be called under some spinlock and IRQs off */
|
||||
static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd,
|
||||
struct scst_tgt_dev *tgt_dev)
|
||||
{
|
||||
@@ -2458,7 +2459,12 @@ static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd,
|
||||
dev_user_abort_ready_commands(dev);
|
||||
|
||||
/* We can't afford missing TM command due to memory shortage */
|
||||
ucmd = dev_user_alloc_ucmd(dev, GFP_KERNEL|__GFP_NOFAIL);
|
||||
ucmd = dev_user_alloc_ucmd(dev, GFP_ATOMIC|__GFP_NOFAIL);
|
||||
if (ucmd == NULL) {
|
||||
PRINT_CRIT_ERROR("Unable to allocate TM %d message "
|
||||
"(dev %s)", mcmd->fn, dev->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ucmd->user_cmd_payload_len =
|
||||
offsetof(struct scst_user_get_cmd, tm_cmd) +
|
||||
@@ -2488,6 +2494,7 @@ static int dev_user_task_mgmt_fn(struct scst_mgmt_cmd *mcmd,
|
||||
|
||||
dev_user_add_to_ready(ucmd);
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
return SCST_DEV_TM_NOT_COMPLETED;
|
||||
}
|
||||
@@ -2676,12 +2683,15 @@ static void dev_user_detach_tgt(struct scst_tgt_dev *tgt_dev)
|
||||
TRACE_ENTRY();
|
||||
|
||||
/*
|
||||
* We can't miss TM command due to memory shortage, because it might
|
||||
* We can't miss detach command due to memory shortage, because it might
|
||||
* lead to a memory leak in the user space handler.
|
||||
*/
|
||||
ucmd = dev_user_alloc_ucmd(dev, GFP_KERNEL|__GFP_NOFAIL);
|
||||
if (ucmd == NULL)
|
||||
if (ucmd == NULL) {
|
||||
PRINT_CRIT_ERROR("Unable to allocate DETACH_SESS message "
|
||||
"(dev %s)", dev->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
TRACE_MGMT_DBG("Preparing DETACH_SESS %p (h %d, sess_h %llx)", ucmd,
|
||||
ucmd->h, ucmd->user_cmd.sess.sess_h);
|
||||
|
||||
@@ -1377,13 +1377,6 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
|
||||
uint8_t *buf;
|
||||
struct scst_vdisk_dev *virt_dev = cmd->dev->dh_priv;
|
||||
|
||||
/* ToDo: Performance Boost:
|
||||
* 1. remove kzalloc, buf
|
||||
* 2. do all checks before touching *address
|
||||
* 3. zero *address
|
||||
* 4. write directly to *address
|
||||
*/
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
buf = kzalloc(INQ_BUF_SZ, GFP_KERNEL);
|
||||
@@ -2859,6 +2852,9 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr,
|
||||
struct scst_blockio_work *blockio_work;
|
||||
int bios = 0;
|
||||
gfp_t gfp_mask = (cmd->noio_mem_alloc ? GFP_NOIO : GFP_KERNEL);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
|
||||
struct blk_plug plug;
|
||||
#endif
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
@@ -2964,6 +2960,10 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr,
|
||||
/* +1 to prevent erroneous too early command completion */
|
||||
atomic_set(&blockio_work->bios_inflight, bios+1);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
|
||||
blk_start_plug(&plug);
|
||||
#endif
|
||||
|
||||
while (hbio) {
|
||||
bio = hbio;
|
||||
hbio = hbio->bi_next;
|
||||
@@ -2971,8 +2971,12 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr,
|
||||
submit_bio((write != 0), bio);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
|
||||
blk_finish_plug(&plug);
|
||||
#else
|
||||
if (q && q->unplug_fn)
|
||||
q->unplug_fn(q);
|
||||
#endif
|
||||
|
||||
blockio_check_finish(blockio_work);
|
||||
|
||||
|
||||
@@ -1918,6 +1918,7 @@ static int scst_get_cmd_abnormal_done_state(const struct scst_cmd *cmd)
|
||||
case SCST_CMD_STATE_RDY_TO_XFER:
|
||||
case SCST_CMD_STATE_DATA_WAIT:
|
||||
case SCST_CMD_STATE_TGT_PRE_EXEC:
|
||||
case SCST_CMD_STATE_START_EXEC:
|
||||
case SCST_CMD_STATE_SEND_FOR_EXEC:
|
||||
case SCST_CMD_STATE_LOCAL_EXEC:
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
@@ -1977,6 +1978,7 @@ int scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd)
|
||||
break;
|
||||
case SCST_CMD_STATE_TGT_PRE_EXEC:
|
||||
case SCST_CMD_STATE_SEND_FOR_EXEC:
|
||||
case SCST_CMD_STATE_START_EXEC:
|
||||
case SCST_CMD_STATE_LOCAL_EXEC:
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
case SCST_CMD_STATE_REAL_EXECUTING:
|
||||
|
||||
+56
-3
@@ -567,7 +567,8 @@ out:
|
||||
|
||||
#ifndef CONFIG_SCST_PROC
|
||||
|
||||
/* Abstract vfs_unlink & path_put for different kernel versions */
|
||||
/* Abstract vfs_unlink() for different kernel versions (as possible) */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
static inline void scst_pr_vfs_unlink_and_put(struct nameidata *nd)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
|
||||
@@ -580,7 +581,15 @@ static inline void scst_pr_vfs_unlink_and_put(struct nameidata *nd)
|
||||
path_put(&nd->path);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static inline void scst_pr_vfs_unlink_and_put(struct path *path)
|
||||
{
|
||||
vfs_unlink(path->dentry->d_parent->d_inode, path->dentry);
|
||||
path_put(path);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
static inline void scst_pr_path_put(struct nameidata *nd)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
|
||||
@@ -590,6 +599,7 @@ static inline void scst_pr_path_put(struct nameidata *nd)
|
||||
path_put(&nd->path);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
|
||||
static int scst_pr_vfs_fsync(struct file *file, loff_t loff, loff_t len)
|
||||
@@ -906,13 +916,18 @@ static void scst_pr_remove_device_files(struct scst_tgt_dev *tgt_dev)
|
||||
{
|
||||
int res = 0;
|
||||
struct scst_device *dev = tgt_dev->dev;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
struct nameidata nd;
|
||||
#else
|
||||
struct path path;
|
||||
#endif
|
||||
mm_segment_t old_fs = get_fs();
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
set_fs(KERNEL_DS);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
res = path_lookup(dev->pr_file_name, 0, &nd);
|
||||
if (!res)
|
||||
scst_pr_vfs_unlink_and_put(&nd);
|
||||
@@ -926,6 +941,21 @@ static void scst_pr_remove_device_files(struct scst_tgt_dev *tgt_dev)
|
||||
else
|
||||
TRACE_DBG("Unable to lookup file '%s' - error %d",
|
||||
dev->pr_file_name1, res);
|
||||
#else
|
||||
res = kern_path(dev->pr_file_name, 0, &path);
|
||||
if (!res)
|
||||
scst_pr_vfs_unlink_and_put(&path);
|
||||
else
|
||||
TRACE_DBG("Unable to lookup file '%s' - error %d",
|
||||
dev->pr_file_name, res);
|
||||
|
||||
res = kern_path(dev->pr_file_name1, 0, &path);
|
||||
if (!res)
|
||||
scst_pr_vfs_unlink_and_put(&path);
|
||||
else
|
||||
TRACE_DBG("Unable to lookup file '%s' - error %d",
|
||||
dev->pr_file_name1, res);
|
||||
#endif
|
||||
|
||||
set_fs(old_fs);
|
||||
|
||||
@@ -1104,6 +1134,7 @@ write_error:
|
||||
|
||||
write_error_close:
|
||||
filp_close(file, NULL);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
{
|
||||
struct nameidata nd;
|
||||
int rc;
|
||||
@@ -1115,20 +1146,44 @@ write_error_close:
|
||||
TRACE_PR("Unable to lookup '%s' - error %d",
|
||||
dev->pr_file_name, rc);
|
||||
}
|
||||
#else
|
||||
{
|
||||
struct path path;
|
||||
int rc;
|
||||
|
||||
rc = kern_path(dev->pr_file_name, 0, &path);
|
||||
if (!rc)
|
||||
scst_pr_vfs_unlink_and_put(&path);
|
||||
else
|
||||
TRACE_PR("Unable to lookup '%s' - error %d",
|
||||
dev->pr_file_name, rc);
|
||||
}
|
||||
#endif
|
||||
goto out_set_fs;
|
||||
}
|
||||
|
||||
static int scst_pr_check_pr_path(void)
|
||||
{
|
||||
int res;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
struct nameidata nd;
|
||||
#else
|
||||
struct path path;
|
||||
#endif
|
||||
|
||||
mm_segment_t old_fs = get_fs();
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
set_fs(KERNEL_DS);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
res = path_lookup(SCST_PR_DIR, 0, &nd);
|
||||
scst_pr_path_put(&nd);
|
||||
#else
|
||||
res = kern_path(SCST_PR_DIR, 0, &path);
|
||||
path_put(&path);
|
||||
#endif
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("Unable to find %s (err %d), you should create "
|
||||
"this directory manually or reinstall SCST",
|
||||
@@ -1136,8 +1191,6 @@ static int scst_pr_check_pr_path(void)
|
||||
goto out_setfs;
|
||||
}
|
||||
|
||||
scst_pr_path_put(&nd);
|
||||
|
||||
out_setfs:
|
||||
set_fs(old_fs);
|
||||
|
||||
|
||||
@@ -2098,11 +2098,9 @@ static ssize_t scst_proc_groups_devices_write(struct file *file,
|
||||
list_for_each_entry(a, &acg->acg_dev_list, acg_dev_list_entry) {
|
||||
if (a->dev == dev) {
|
||||
rc = scst_acg_del_lun(acg, a->lun, true);
|
||||
if (rc) {
|
||||
if (rc)
|
||||
res = rc;
|
||||
goto out_free_up;
|
||||
}
|
||||
break;
|
||||
goto out_free_up;
|
||||
}
|
||||
}
|
||||
PRINT_ERROR("Device is not found in group %s", acg->acg_name);
|
||||
|
||||
+53
-20
@@ -508,7 +508,7 @@ int scst_pre_parse(struct scst_cmd *cmd)
|
||||
|
||||
TRACE_DBG("op_name <%s> (cmd %p), direction=%d "
|
||||
"(expected %d, set %s), bufflen=%d, out_bufflen=%d (expected "
|
||||
"len %d, out expected len %d), flags=%d", cmd->op_name, cmd,
|
||||
"len %d, out expected len %d), flags=0x%x", cmd->op_name, cmd,
|
||||
cmd->data_direction, cmd->expected_data_direction,
|
||||
scst_cmd_is_expected_set(cmd) ? "yes" : "no",
|
||||
cmd->bufflen, cmd->out_bufflen, cmd->expected_transfer_len,
|
||||
@@ -828,6 +828,7 @@ set_res:
|
||||
case SCST_CMD_STATE_RDY_TO_XFER:
|
||||
case SCST_CMD_STATE_TGT_PRE_EXEC:
|
||||
case SCST_CMD_STATE_SEND_FOR_EXEC:
|
||||
case SCST_CMD_STATE_START_EXEC:
|
||||
case SCST_CMD_STATE_LOCAL_EXEC:
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
case SCST_CMD_STATE_PRE_DEV_DONE:
|
||||
@@ -1292,7 +1293,7 @@ static int scst_rdy_to_xfer(struct scst_cmd *cmd)
|
||||
"rdy_to_xfer() requested thread "
|
||||
"context, rescheduling", tgtt->name);
|
||||
res = SCST_CMD_STATE_RES_NEED_THREAD;
|
||||
break;
|
||||
goto out;
|
||||
|
||||
default:
|
||||
goto out_error_rc;
|
||||
@@ -2629,9 +2630,11 @@ static inline int scst_real_exec(struct scst_cmd *cmd)
|
||||
res = scst_do_real_exec(cmd);
|
||||
if (likely(res == SCST_EXEC_COMPLETED)) {
|
||||
scst_post_exec_sn(cmd, true);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
if (cmd->dev->scsi_dev != NULL)
|
||||
generic_unplug_device(
|
||||
cmd->dev->scsi_dev->request_queue);
|
||||
#endif
|
||||
} else
|
||||
sBUG();
|
||||
|
||||
@@ -2734,11 +2737,12 @@ static int scst_exec(struct scst_cmd **active_cmd)
|
||||
{
|
||||
struct scst_cmd *cmd = *active_cmd;
|
||||
struct scst_cmd *ref_cmd;
|
||||
struct scst_device *dev = cmd->dev;
|
||||
int res = SCST_CMD_STATE_RES_CONT_NEXT, count;
|
||||
int res = SCST_CMD_STATE_RES_CONT_NEXT, count = 0;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
cmd->state = SCST_CMD_STATE_START_EXEC;
|
||||
|
||||
if (unlikely(scst_check_blocked_dev(cmd)))
|
||||
goto out;
|
||||
|
||||
@@ -2746,7 +2750,6 @@ static int scst_exec(struct scst_cmd **active_cmd)
|
||||
ref_cmd = cmd;
|
||||
__scst_cmd_get(ref_cmd);
|
||||
|
||||
count = 0;
|
||||
while (1) {
|
||||
int rc;
|
||||
|
||||
@@ -2782,12 +2785,15 @@ done:
|
||||
if (cmd == NULL)
|
||||
break;
|
||||
|
||||
cmd->state = SCST_CMD_STATE_START_EXEC;
|
||||
|
||||
if (unlikely(scst_check_blocked_dev(cmd)))
|
||||
break;
|
||||
|
||||
__scst_cmd_put(ref_cmd);
|
||||
ref_cmd = cmd;
|
||||
__scst_cmd_get(ref_cmd);
|
||||
|
||||
}
|
||||
|
||||
*active_cmd = cmd;
|
||||
@@ -2795,14 +2801,17 @@ done:
|
||||
if (count == 0)
|
||||
goto out_put;
|
||||
|
||||
if (dev->scsi_dev != NULL)
|
||||
generic_unplug_device(dev->scsi_dev->request_queue);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||
if (ref_cmd->dev->scsi_dev != NULL)
|
||||
generic_unplug_device(ref_cmd->dev->scsi_dev->request_queue);
|
||||
#endif
|
||||
|
||||
out_put:
|
||||
__scst_cmd_put(ref_cmd);
|
||||
/* !! At this point sess, dev and tgt_dev can be already freed !! */
|
||||
|
||||
out:
|
||||
EXTRACHECKS_BUG_ON(res == SCST_CMD_STATE_RES_NEED_THREAD);
|
||||
TRACE_EXIT_RES(res);
|
||||
return res;
|
||||
}
|
||||
@@ -3299,6 +3308,7 @@ static int scst_dev_done(struct scst_cmd *cmd)
|
||||
case SCST_CMD_STATE_RDY_TO_XFER:
|
||||
case SCST_CMD_STATE_TGT_PRE_EXEC:
|
||||
case SCST_CMD_STATE_SEND_FOR_EXEC:
|
||||
case SCST_CMD_STATE_START_EXEC:
|
||||
case SCST_CMD_STATE_LOCAL_EXEC:
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
case SCST_CMD_STATE_PRE_DEV_DONE:
|
||||
@@ -3317,7 +3327,7 @@ static int scst_dev_done(struct scst_cmd *cmd)
|
||||
"thread context, rescheduling",
|
||||
dev->handler->name);
|
||||
res = SCST_CMD_STATE_RES_NEED_THREAD;
|
||||
break;
|
||||
goto out;
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
default:
|
||||
if (state >= 0) {
|
||||
@@ -3351,6 +3361,7 @@ static int scst_dev_done(struct scst_cmd *cmd)
|
||||
switch (state) {
|
||||
case SCST_CMD_STATE_TGT_PRE_EXEC:
|
||||
case SCST_CMD_STATE_SEND_FOR_EXEC:
|
||||
case SCST_CMD_STATE_START_EXEC:
|
||||
case SCST_CMD_STATE_LOCAL_EXEC:
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
TRACE_DBG("Atomic context and redirect, "
|
||||
@@ -3544,7 +3555,7 @@ static int scst_xmit_response(struct scst_cmd *cmd)
|
||||
"requested thread context, rescheduling",
|
||||
tgtt->name);
|
||||
res = SCST_CMD_STATE_RES_NEED_THREAD;
|
||||
break;
|
||||
goto out;
|
||||
|
||||
default:
|
||||
goto out_error;
|
||||
@@ -3641,10 +3652,13 @@ static int scst_finish_cmd(struct scst_cmd *cmd)
|
||||
|
||||
list_del(&cmd->sess_cmd_list_entry);
|
||||
|
||||
spin_unlock_irq(&sess->sess_list_lock);
|
||||
|
||||
/*
|
||||
* Done under sess_list_lock to sync with scst_abort_cmd() without
|
||||
* using extra barrier.
|
||||
*/
|
||||
cmd->finished = 1;
|
||||
smp_mb(); /* to sync with scst_abort_cmd() */
|
||||
|
||||
spin_unlock_irq(&sess->sess_list_lock);
|
||||
|
||||
if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) {
|
||||
TRACE_MGMT_DBG("Aborted cmd %p finished (cmd_ref %d)",
|
||||
@@ -4115,6 +4129,16 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
break;
|
||||
}
|
||||
res = scst_send_for_exec(&cmd);
|
||||
EXTRACHECKS_BUG_ON(res == SCST_CMD_STATE_RES_NEED_THREAD);
|
||||
/*
|
||||
* !! At this point cmd, sess & tgt_dev can already be
|
||||
* freed !!
|
||||
*/
|
||||
break;
|
||||
|
||||
case SCST_CMD_STATE_START_EXEC:
|
||||
res = scst_exec(&cmd);
|
||||
EXTRACHECKS_BUG_ON(res == SCST_CMD_STATE_RES_NEED_THREAD);
|
||||
/*
|
||||
* !! At this point cmd, sess & tgt_dev can already be
|
||||
* freed !!
|
||||
@@ -4123,6 +4147,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
|
||||
case SCST_CMD_STATE_LOCAL_EXEC:
|
||||
res = scst_local_exec(cmd);
|
||||
EXTRACHECKS_BUG_ON(res == SCST_CMD_STATE_RES_NEED_THREAD);
|
||||
/*
|
||||
* !! At this point cmd, sess & tgt_dev can already be
|
||||
* freed !!
|
||||
@@ -4131,6 +4156,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
res = scst_real_exec(cmd);
|
||||
EXTRACHECKS_BUG_ON(res == SCST_CMD_STATE_RES_NEED_THREAD);
|
||||
/*
|
||||
* !! At this point cmd, sess & tgt_dev can already be
|
||||
* freed !!
|
||||
@@ -4191,6 +4217,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
case SCST_CMD_STATE_RDY_TO_XFER:
|
||||
case SCST_CMD_STATE_TGT_PRE_EXEC:
|
||||
case SCST_CMD_STATE_SEND_FOR_EXEC:
|
||||
case SCST_CMD_STATE_START_EXEC:
|
||||
case SCST_CMD_STATE_LOCAL_EXEC:
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
case SCST_CMD_STATE_DEV_DONE:
|
||||
@@ -4613,7 +4640,6 @@ static int scst_call_dev_task_mgmt_fn(struct scst_mgmt_cmd *mcmd,
|
||||
if (h->task_mgmt_fn) {
|
||||
TRACE_MGMT_DBG("Calling dev handler %s task_mgmt_fn(fn=%d)",
|
||||
h->name, mcmd->fn);
|
||||
EXTRACHECKS_BUG_ON(in_irq() || irqs_disabled());
|
||||
res = h->task_mgmt_fn(mcmd, tgt_dev);
|
||||
TRACE_MGMT_DBG("Dev handler %s task_mgmt_fn() returned %d",
|
||||
h->name, res);
|
||||
@@ -4639,7 +4665,10 @@ static inline int scst_is_strict_mgmt_fn(int mgmt_fn)
|
||||
}
|
||||
}
|
||||
|
||||
/* Might be called under sess_list_lock and IRQ off + BHs also off */
|
||||
/*
|
||||
* Must be called under sess_list_lock to sync with finished flag assignment in
|
||||
* scst_finish_cmd()
|
||||
*/
|
||||
void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd,
|
||||
bool other_ini, bool call_dev_task_mgmt_fn)
|
||||
{
|
||||
@@ -4684,9 +4713,9 @@ void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd,
|
||||
spin_unlock_irqrestore(&other_ini_lock, flags);
|
||||
|
||||
/*
|
||||
* To sync with cmd->finished/done set in
|
||||
* scst_finish_cmd()/scst_pre_xmit_response() and with setting UA for
|
||||
* aborted cmd in scst_set_pending_UA().
|
||||
* To sync with setting cmd->done in scst_pre_xmit_response() (with
|
||||
* scst_finish_cmd() we synced by using sess_list_lock) and with
|
||||
* setting UA for aborted cmd in scst_set_pending_UA().
|
||||
*/
|
||||
smp_mb__after_set_bit();
|
||||
|
||||
@@ -4697,10 +4726,8 @@ void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd,
|
||||
wake_up(&scst_init_cmd_list_waitQ);
|
||||
}
|
||||
|
||||
if (call_dev_task_mgmt_fn && (cmd->tgt_dev != NULL)) {
|
||||
EXTRACHECKS_BUG_ON(irqs_disabled());
|
||||
if (!cmd->finished && call_dev_task_mgmt_fn && (cmd->tgt_dev != NULL))
|
||||
scst_call_dev_task_mgmt_fn(mcmd, cmd->tgt_dev, 1);
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&scst_mcmd_lock, flags);
|
||||
if ((mcmd != NULL) && !cmd->finished) {
|
||||
@@ -4766,6 +4793,9 @@ void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd,
|
||||
/* We don't need to wait for this cmd */
|
||||
mempool_free(mstb, scst_mgmt_stub_mempool);
|
||||
}
|
||||
|
||||
if (cmd->tgtt->on_abort_cmd)
|
||||
cmd->tgtt->on_abort_cmd(cmd);
|
||||
}
|
||||
|
||||
unlock:
|
||||
@@ -5495,7 +5525,10 @@ static int scst_abort_task(struct scst_mgmt_cmd *mcmd)
|
||||
cmd->tgt_sn, (long long unsigned int)mcmd->tag);
|
||||
mcmd->status = SCST_MGMT_STATUS_REJECTED;
|
||||
} else {
|
||||
spin_lock_irq(&cmd->sess->sess_list_lock);
|
||||
scst_abort_cmd(cmd, mcmd, 0, 1);
|
||||
spin_unlock_irq(&cmd->sess->sess_list_lock);
|
||||
|
||||
scst_unblock_aborted_cmds(0);
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -78,7 +78,7 @@ extraclean: clean
|
||||
|
||||
debug2release:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@@ -87,25 +87,25 @@ debug2release:
|
||||
|
||||
release2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
debug2perf:
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
perf2debug:
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
.PHONY: all tgt install uninstall clean extraclean debug2release release2debug debug2perf perf2debug
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
obj-$(CONFIG_SCST_LOCAL) += scst_local.o
|
||||
|
||||
+30
-9
@@ -917,10 +917,22 @@ static int scst_local_send_resp(struct scsi_cmnd *cmnd,
|
||||
* This does the heavy lifting ... we pass all the commands on to the
|
||||
* target driver and have it do its magic ...
|
||||
*/
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
#ifdef CONFIG_SCST_LOCAL_FORCE_DIRECT_PROCESSING
|
||||
static int scst_local_queuecommand(struct Scsi_Host *host,
|
||||
struct scsi_cmnd *SCpnt)
|
||||
#else
|
||||
static int scst_local_queuecommand_lck(struct scsi_cmnd *SCpnt,
|
||||
void (*done)(struct scsi_cmnd *))
|
||||
__acquires(&h->host_lock)
|
||||
__releases(&h->host_lock)
|
||||
#endif
|
||||
#else
|
||||
static int scst_local_queuecommand_lck(struct scsi_cmnd *SCpnt,
|
||||
void (*done)(struct scsi_cmnd *))
|
||||
__acquires(&h->host_lock)
|
||||
__releases(&h->host_lock)
|
||||
#endif
|
||||
{
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25))
|
||||
struct scst_local_tgt_specific *tgt_specific = NULL;
|
||||
@@ -1071,23 +1083,32 @@ static int scst_local_queuecommand_lck(struct scsi_cmnd *SCpnt,
|
||||
|
||||
/*
|
||||
* Although starting from 2.6.37 queuecommand() called with no host_lock
|
||||
* held, in reality without DEF_SCSI_QCMD() this doesn't work and leading
|
||||
* to various problems like commands lost under highload. So, until that fixed
|
||||
* we have to go ahead under host_lock, although absolutely don't need it.
|
||||
*
|
||||
* NOTE! At the moment in scst_estimate_context*() returning DIRECT contexts
|
||||
* disabled, so this option doesn't have any real effect.
|
||||
* held, in fact without DEF_SCSI_QCMD() it doesn't work and leading
|
||||
* to various problems like hangs under highload. Most likely, it is caused
|
||||
* by some not reenrable block layer function(s). So, until that changed, we
|
||||
* have to go ahead with extra context switch. In this regard doesn't matter
|
||||
* much if we under host_lock or not (although we absolutely don't need this
|
||||
* lock), so let's have simpler code with DEF_SCSI_QCMD().
|
||||
*/
|
||||
#ifdef CONFIG_SCST_LOCAL_FORCE_DIRECT_PROCESSING
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
scst_cmd_init_done(scst_cmd, SCST_CONTEXT_DIRECT);
|
||||
#else
|
||||
{
|
||||
/*
|
||||
* NOTE! At the moment in scst_estimate_context*() returning
|
||||
* DIRECT contexts disabled, so this option doesn't have any
|
||||
* real effect.
|
||||
*/
|
||||
struct Scsi_Host *h = SCpnt->device->host;
|
||||
spin_unlock_irq(h->host_lock);
|
||||
scst_cmd_init_done(scst_cmd, scst_estimate_context_atomic());
|
||||
spin_lock_irq(h->host_lock);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/*
|
||||
* Unfortunately, we called with IRQs disabled, so have no choice,
|
||||
* We called with IRQs disabled, so have no choice,
|
||||
* except to pass to the thread context.
|
||||
*/
|
||||
scst_cmd_init_done(scst_cmd, SCST_CONTEXT_THREAD);
|
||||
@@ -1097,7 +1118,8 @@ static int scst_local_queuecommand_lck(struct scsi_cmnd *SCpnt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) && \
|
||||
!defined(CONFIG_SCST_LOCAL_FORCE_DIRECT_PROCESSING)
|
||||
/*
|
||||
* See comment in scst_local_queuecommand_lck() near
|
||||
* CONFIG_SCST_LOCAL_FORCE_DIRECT_PROCESSING
|
||||
@@ -1940,4 +1962,3 @@ static void __exit scst_local_exit(void)
|
||||
|
||||
device_initcall(scst_local_init);
|
||||
module_exit(scst_local_exit);
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ all:
|
||||
cd $(SCSTADMIN_DIR) && $(MAKE) $@
|
||||
|
||||
install:
|
||||
@if ! perl -MExtUtils::MakeMaker -e '' >/dev/null 2>&1; then \
|
||||
echo Error: the Perl module ExtUtils::MakeMaker must be installed \
|
||||
first; false; fi
|
||||
cd $(SCSTADMIN_DIR) && $(MAKE) $@
|
||||
-/usr/lib/lsb/install_initd scst
|
||||
-/usr/lib/lsb/install_initd qla2x00t
|
||||
|
||||
@@ -1658,6 +1658,12 @@ sub checkConfiguration {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined($$tgt{'LUN'}->{'0'})) {
|
||||
print "\t-> WARNING: No LUN 0 defined for driver/target '$driver/$target'. ".
|
||||
"Many initiators require a LUN 0 to be defined.\n\n";
|
||||
$warnings++;
|
||||
}
|
||||
}
|
||||
|
||||
if (defined($$tgt{'GROUP'})) {
|
||||
@@ -1674,6 +1680,12 @@ sub checkConfiguration {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined($$tgt{'GROUP'}->{$group}->{'LUN'}->{'0'})) {
|
||||
print "\t-> WARNING: No LUN 0 defined for driver/target/group '$driver/$target/$group'. ".
|
||||
"Many initiators require a LUN 0 to be defined.\n\n";
|
||||
$warnings++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2082,7 +2094,7 @@ sub applyTargetAssignments {
|
||||
|
||||
if (defined($$attributes{'HW_TARGET'})) {
|
||||
immediateExit("Hardware target '$target' for driver '$driver' does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
filterCreateAttributes($possible, $attributes, FALSE);
|
||||
|
||||
@@ -2290,6 +2302,18 @@ sub addVirtualTarget {
|
||||
my $target = shift;
|
||||
my $attributes = shift;
|
||||
|
||||
# Enable all hardware targets before creating virtual ones
|
||||
my $targets = $SCST->targets($driver);
|
||||
|
||||
foreach my $_target (@{$targets}) {
|
||||
my $attributes = $SCST->targetAttributes($driver, $_target);
|
||||
|
||||
if (defined($$attributes{'hw_target'}) &&
|
||||
!$$attributes{'enabled'}->{'value'}) {
|
||||
enableTarget($driver, $_target);
|
||||
}
|
||||
}
|
||||
|
||||
print "\t-> Creating target '$target' for driver '$driver': ";
|
||||
my $rc = $SCST->addVirtualTarget($driver, $target, $attributes);
|
||||
print "done.\n";
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 8392b64..f5991d9 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -349,7 +349,8 @@ CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
|
||||
|
||||
# Use LINUXINCLUDE when you must reference the include/ directory.
|
||||
# Needed to be compatible with the O= option
|
||||
-LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \
|
||||
+LINUXINCLUDE := $(PRE_CFLAGS) \
|
||||
+ -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \
|
||||
$(if $(KBUILD_SRC), -I$(srctree)/include) \
|
||||
-include include/generated/autoconf.h
|
||||
|
||||
+10
-10
@@ -85,34 +85,34 @@ extraclean: clean
|
||||
|
||||
debug2release:
|
||||
sed -i.aa s/"^CFLAGS += \-DEXTRACHECKS"/"#CFLAGS += \-DEXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#CFLAGS += \-DTRACING"/"CFLAGS += \-DTRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/"#CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
release2debug:
|
||||
sed -i.aa s/"#CFLAGS += \-DEXTRACHECKS"/"CFLAGS += \-DEXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^CFLAGS += \-DTRACING"/"#CFLAGS += \-DTRACING"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/"CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
debug2perf:
|
||||
sed -i.aa s/"^CFLAGS += \-DEXTRACHECKS"/"#CFLAGS += \-DEXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"^CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/"#CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
perf2debug:
|
||||
sed -i.aa s/"#CFLAGS += \-DEXTRACHECKS"/"CFLAGS += \-DEXTRACHECKS"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
sed -i.aa s/"#CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/"CFLAGS += \-DDEBUG -g -fno-inline -fno-inline-functions"/ Makefile
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed"; false; fi
|
||||
@cmp Makefile Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm Makefile.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm Makefile.aa
|
||||
|
||||
.PHONY: all install uninstall clean extraclean debug2release release2debug debug2perf perf2debug
|
||||
|
||||
Reference in New Issue
Block a user