Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2019-03-09 15:15:07 -08:00
28 changed files with 32 additions and 2142 deletions

View File

@@ -72,6 +72,8 @@ static int __init ft_module_init(void)
static void __exit ft_module_exit(void)
{
rcu_barrier();
blocking_notifier_chain_unregister(&fc_lport_notifier_head,
&ft_notifier);
fc_fc4_deregister_provider(FC_TYPE_FCP, &ft_prov);

View File

@@ -20,7 +20,8 @@
############################################################################
# Usage:
# * Specify the kernel version code as follows: -v kernel_version=...
# * Specify the kernel version code and optionally the RHEL version as follows:
# -v kernel_version=... -vRHEL_MAJOR=... -vRHEL_MINOR=...
# * Provide the patch to be processed to stdin.
#
# The output of this script will be a patch that is specialized for the
@@ -64,31 +65,39 @@ function evaluate(stmnt, pattern, arg, op, result) {
}
gsub("defined\\(REGISTER_MAD_AGENT_HAS_FLAGS_ARG\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) || " \
"RHEL_RELEASE_CODE -0 >= 6 * 256 + 10)", stmnt)
gsub("SOCK_RECVMSG_HAS_FOUR_ARGS",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))", stmnt)
gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt)
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(IB_CREATE_CQ_HAS_INIT_ATTR\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(CREATE_SEND_MAD_HAS_BASE_ARG\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(IB_CM_LISTEN_TAKES_FOURTH_ARG\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0))", stmnt)
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(IB_CLIENT_REMOVE_TAKES_TWO_ARGS\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(IB_QUERY_GID_HAS_ATTR_ARG\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("RDMA_CREATE_ID_TAKES_NET_ARG",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("HAVE_DEV_ATTR_MAX_SEND_SGE",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))", stmnt)
@@ -108,17 +117,25 @@ function evaluate(stmnt, pattern, arg, op, result) {
gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt)
gsub("defined\\(HAVE_IB_EVENT_GID_CHANGE\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) || " \
"RHEL_RELEASE_CODE -0 >= 6 * 256 + 10)", stmnt)
gsub("defined\\(HAVE_IB_QUERY_DEVICE\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))", stmnt)
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(MAD_HANDLER_TAKES_SEND_BUF\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(HAVE_IB_SET_CPI_RESP_TIME\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(IB_PD_HAS_LOCAL_DMA_LKEY\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
gsub("defined\\(HAVE_IB_DMA_MAP_OPS\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt)

View File

@@ -1,77 +0,0 @@
--- linux-2.6.12-rc6/drivers/scsi/scsi_lib.c_scst 2005-06-15 16:15:01.000000000 +0400
+++ linux-2.6.12-rc6/drivers/scsi/scsi_lib.c 2005-06-23 20:28:20.802971272 +0400
@@ -235,6 +235,61 @@ void scsi_do_req(struct scsi_request *sr
}
EXPORT_SYMBOL(scsi_do_req);
+/*
+ * Function: scsi_do_req_fifo
+ *
+ * Purpose: Queue a SCSI request
+ *
+ * Arguments: sreq - command descriptor.
+ * cmnd - actual SCSI command to be performed.
+ * buffer - data buffer.
+ * bufflen - size of data buffer.
+ * done - completion function to be run.
+ * timeout - how long to let it run before timeout.
+ * retries - number of retries we allow.
+ *
+ * Lock status: No locks held upon entry.
+ *
+ * Returns: Nothing.
+ *
+ * Notes: This function is used for queueing requests in FIFO order.
+ * It is a copy of scsi_do_req() with only changed the last
+ * parameter of scsi_insert_special_req(). Not sure, if it
+ * breaks quiesce, but, anyway, I don't see another way to
+ * queue requests in FIFO order, which is necessary for SCST.
+ */
+void scsi_do_req_fifo(struct scsi_request *sreq, const void *cmnd,
+ void *buffer, unsigned bufflen,
+ void (*done)(struct scsi_cmnd *),
+ int timeout, int retries)
+{
+ /*
+ * If the upper level driver is reusing these things, then
+ * we should release the low-level block now. Another one will
+ * be allocated later when this request is getting queued.
+ */
+ __scsi_release_request(sreq);
+
+ /*
+ * Our own function scsi_done (which marks the host as not busy,
+ * disables the timeout counter, etc) will be called by us or by the
+ * scsi_hosts[host].queuecommand() function needs to also call
+ * the completion function for the high level driver.
+ */
+ memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd));
+ sreq->sr_bufflen = bufflen;
+ sreq->sr_buffer = buffer;
+ sreq->sr_allowed = retries;
+ sreq->sr_done = done;
+ sreq->sr_timeout_per_command = timeout;
+
+ if (sreq->sr_cmd_len == 0)
+ sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]);
+
+ scsi_insert_special_req(sreq, 0);
+}
+EXPORT_SYMBOL(scsi_do_req_fifo);
+
static void scsi_wait_done(struct scsi_cmnd *cmd)
{
struct request *req = cmd->request;
--- linux-2.6.12-rc6/include/scsi/scsi_request.h_scst 2005-06-23 20:08:59.475519880 +0400
+++ linux-2.6.12-rc6/include/scsi/scsi_request.h 2005-06-23 20:08:26.881474928 +0400
@@ -54,6 +54,10 @@ extern void scsi_do_req(struct scsi_requ
void *buffer, unsigned bufflen,
void (*done) (struct scsi_cmnd *),
int timeout, int retries);
+extern void scsi_do_req_fifo(struct scsi_request *, const void *cmnd,
+ void *buffer, unsigned bufflen,
+ void (*done) (struct scsi_cmnd *),
+ int timeout, int retries);
struct scsi_mode_data {
__u32 length;

View File

@@ -1,13 +0,0 @@
diff --git a/mm/readahead.c b/mm/readahead.c
index 133b6d5..fd3df66 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -473,5 +473,8 @@ page_cache_async_readahead(struct address_space *mapping,
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,13 +0,0 @@
diff --git a/mm/readahead.c b/mm/readahead.c
index 133b6d5..fd3df66 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -479,5 +479,8 @@ page_cache_async_readahead(struct address_space *mapping,
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,13 +0,0 @@
diff --git a/mm/readahead.c b/mm/readahead.c
index 133b6d5..fd3df66 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -479,5 +479,8 @@ page_cache_async_readahead(struct address_space *mapping,
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,13 +0,0 @@
diff --git a/mm/readahead.c b/mm/readahead.c
index 133b6d5..fd3df66 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -479,5 +479,8 @@ page_cache_async_readahead(struct address_space *mapping,
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,13 +0,0 @@
diff --git a/mm/readahead.c b/mm/readahead.c
index 133b6d5..fd3df66 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -479,5 +479,8 @@ page_cache_async_readahead(struct address_space *mapping,
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,12 +0,0 @@
diff -upkr linux-2.6.30.1/mm/readahead.c linux-2.6.30.1/mm/readahead.c
--- linux-2.6.30.1/mm/readahead.c 2009-07-01 13:52:31.000000000 +0400
+++ linux-2.6.30.1/mm/readahead.c 2009-07-01 15:55:08.000000000 +0400
@@ -565,5 +565,8 @@ page_cache_async_readahead(struct addres
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,12 +0,0 @@
diff -upkr linux-2.6.31/mm/readahead.c linux-2.6.31/mm/readahead.c
--- linux-2.6.31/mm/readahead.c 2009-09-10 02:13:59.000000000 +0400
+++ linux-2.6.31/mm/readahead.c 2009-09-23 14:17:26.000000000 +0400
@@ -547,5 +547,8 @@ page_cache_async_readahead(struct addres
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,12 +0,0 @@
diff -upkr linux-2.6.32.1/mm/readahead.c linux-2.6.32.1/mm/readahead.c
--- linux-2.6.32.1/mm/readahead.c 2009-12-03 06:51:21.000000000 +0300
+++ linux-2.6.32.1/mm/readahead.c 2009-12-16 15:21:00.000000000 +0300
@@ -547,5 +547,8 @@ page_cache_async_readahead(struct addres
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);

View File

@@ -1,231 +0,0 @@
--- linux.orig/mm/readahead.c
+++ linux/mm/readahead.c
@@ -337,6 +337,59 @@ static unsigned long get_next_ra_size(st
*/
/*
+ * Count contiguously cached pages from @offset-1 to @offset-@max,
+ * this count is a conservative estimation of
+ * - length of the sequential read sequence, or
+ * - thrashing threshold in memory tight systems
+ */
+static pgoff_t count_history_pages(struct address_space *mapping,
+ struct file_ra_state *ra,
+ pgoff_t offset, unsigned long max)
+{
+ pgoff_t head;
+
+ rcu_read_lock();
+ head = radix_tree_prev_hole(&mapping->page_tree, offset - 1, max);
+ rcu_read_unlock();
+
+ return offset - 1 - head;
+}
+
+/*
+ * page cache context based read-ahead
+ */
+static int try_context_readahead(struct address_space *mapping,
+ struct file_ra_state *ra,
+ pgoff_t offset,
+ unsigned long req_size,
+ unsigned long max)
+{
+ pgoff_t size;
+
+ size = count_history_pages(mapping, ra, offset, max);
+
+ /*
+ * no history pages:
+ * it could be a random read
+ */
+ if (!size)
+ return 0;
+
+ /*
+ * starts from beginning of file:
+ * it is a strong indication of long-run stream (or whole-file-read)
+ */
+ if (size >= offset)
+ size *= 2;
+
+ ra->start = offset;
+ ra->size = get_init_ra_size(size + req_size, max);
+ ra->async_size = ra->size;
+
+ return 1;
+}
+
+/*
* A minimal readahead algorithm for trivial sequential/random reads.
*/
static unsigned long
@@ -345,34 +398,26 @@ ondemand_readahead(struct address_space
bool hit_readahead_marker, pgoff_t offset,
unsigned long req_size)
{
- int max = ra->ra_pages; /* max readahead pages */
- pgoff_t prev_offset;
- int sequential;
+ unsigned long max = max_sane_readahead(ra->ra_pages);
+
+ /*
+ * start of file
+ */
+ if (!offset)
+ goto initial_readahead;
/*
* It's the expected callback offset, assume sequential access.
* Ramp up sizes, and push forward the readahead window.
*/
- if (offset && (offset == (ra->start + ra->size - ra->async_size) ||
- offset == (ra->start + ra->size))) {
+ if ((offset == (ra->start + ra->size - ra->async_size) ||
+ offset == (ra->start + ra->size))) {
ra->start += ra->size;
ra->size = get_next_ra_size(ra, max);
ra->async_size = ra->size;
goto readit;
}
- prev_offset = ra->prev_pos >> PAGE_CACHE_SHIFT;
- sequential = offset - prev_offset <= 1UL || req_size > max;
-
- /*
- * Standalone, small read.
- * Read as is, and do not pollute the readahead state.
- */
- if (!hit_readahead_marker && !sequential) {
- return __do_page_cache_readahead(mapping, filp,
- offset, req_size, 0);
- }
-
/*
* Hit a marked page without valid readahead state.
* E.g. interleaved reads.
@@ -383,7 +428,7 @@ ondemand_readahead(struct address_space
pgoff_t start;
rcu_read_lock();
- start = radix_tree_next_hole(&mapping->page_tree, offset,max+1);
+ start = radix_tree_next_hole(&mapping->page_tree, offset+1, max);
rcu_read_unlock();
if (!start || start - offset > max)
@@ -391,23 +436,53 @@ ondemand_readahead(struct address_space
ra->start = start;
ra->size = start - offset; /* old async_size */
+ ra->size += req_size;
ra->size = get_next_ra_size(ra, max);
ra->async_size = ra->size;
goto readit;
}
/*
- * It may be one of
- * - first read on start of file
- * - sequential cache miss
- * - oversize random read
- * Start readahead for it.
+ * oversize read
+ */
+ if (req_size > max)
+ goto initial_readahead;
+
+ /*
+ * sequential cache miss
*/
+ if (offset - (ra->prev_pos >> PAGE_CACHE_SHIFT) <= 1UL)
+ goto initial_readahead;
+
+ /*
+ * Query the page cache and look for the traces(cached history pages)
+ * that a sequential stream would leave behind.
+ */
+ if (try_context_readahead(mapping, ra, offset, req_size, max))
+ goto readit;
+
+ /*
+ * standalone, small random read
+ * Read as is, and do not pollute the readahead state.
+ */
+ return __do_page_cache_readahead(mapping, filp, offset, req_size, 0);
+
+initial_readahead:
ra->start = offset;
ra->size = get_init_ra_size(req_size, max);
ra->async_size = ra->size > req_size ? ra->size - req_size : ra->size;
readit:
+ /*
+ * Will this read hit the readahead marker made by itself?
+ * If so, trigger the readahead marker hit now, and merge
+ * the resulted next readahead window into the current one.
+ */
+ if (offset == ra->start && ra->size == ra->async_size) {
+ ra->async_size = get_next_ra_size(ra, max);
+ ra->size += ra->async_size;
+ }
+
return ra_submit(ra, mapping, filp);
}
--- linux.orig/lib/radix-tree.c
+++ linux/lib/radix-tree.c
@@ -666,6 +666,43 @@ unsigned long radix_tree_next_hole(struc
}
EXPORT_SYMBOL(radix_tree_next_hole);
+/**
+ * radix_tree_prev_hole - find the prev hole (not-present entry)
+ * @root: tree root
+ * @index: index key
+ * @max_scan: maximum range to search
+ *
+ * Search backwards in the range [max(index-max_scan+1, 0), index]
+ * for the first hole.
+ *
+ * Returns: the index of the hole if found, otherwise returns an index
+ * outside of the set specified (in which case 'index - return >= max_scan'
+ * will be true). In rare cases of wrap-around, LONG_MAX will be returned.
+ *
+ * radix_tree_next_hole may be called under rcu_read_lock. However, like
+ * radix_tree_gang_lookup, this will not atomically search a snapshot of
+ * the tree at a single point in time. For example, if a hole is created
+ * at index 10, then subsequently a hole is created at index 5,
+ * radix_tree_prev_hole covering both indexes may return 5 if called under
+ * rcu_read_lock.
+ */
+unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
+ unsigned long index, unsigned long max_scan)
+{
+ unsigned long i;
+
+ for (i = 0; i < max_scan; i++) {
+ if (!radix_tree_lookup(root, index))
+ break;
+ index--;
+ if (index == LONG_MAX)
+ break;
+ }
+
+ return index;
+}
+EXPORT_SYMBOL(radix_tree_prev_hole);
+
static unsigned int
__lookup(struct radix_tree_node *slot, void ***results, unsigned long index,
unsigned int max_items, unsigned long *next_index)
--- linux.orig/include/linux/radix-tree.h
+++ linux/include/linux/radix-tree.h
@@ -167,6 +167,8 @@ radix_tree_gang_lookup_slot(struct radix
unsigned long first_index, unsigned int max_items);
unsigned long radix_tree_next_hole(struct radix_tree_root *root,
unsigned long index, unsigned long max_scan);
+unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
+ unsigned long index, unsigned long max_scan);
int radix_tree_preload(gfp_t gfp_mask);
void radix_tree_init(void);
void *radix_tree_tag_set(struct radix_tree_root *root,

View File

@@ -1,231 +0,0 @@
--- linux.orig/mm/readahead.c
+++ linux/mm/readahead.c
@@ -348,6 +348,59 @@ static unsigned long get_next_ra_size(st
*/
/*
+ * Count contiguously cached pages from @offset-1 to @offset-@max,
+ * this count is a conservative estimation of
+ * - length of the sequential read sequence, or
+ * - thrashing threshold in memory tight systems
+ */
+static pgoff_t count_history_pages(struct address_space *mapping,
+ struct file_ra_state *ra,
+ pgoff_t offset, unsigned long max)
+{
+ pgoff_t head;
+
+ rcu_read_lock();
+ head = radix_tree_prev_hole(&mapping->page_tree, offset - 1, max);
+ rcu_read_unlock();
+
+ return offset - 1 - head;
+}
+
+/*
+ * page cache context based read-ahead
+ */
+static int try_context_readahead(struct address_space *mapping,
+ struct file_ra_state *ra,
+ pgoff_t offset,
+ unsigned long req_size,
+ unsigned long max)
+{
+ pgoff_t size;
+
+ size = count_history_pages(mapping, ra, offset, max);
+
+ /*
+ * no history pages:
+ * it could be a random read
+ */
+ if (!size)
+ return 0;
+
+ /*
+ * starts from beginning of file:
+ * it is a strong indication of long-run stream (or whole-file-read)
+ */
+ if (size >= offset)
+ size *= 2;
+
+ ra->start = offset;
+ ra->size = get_init_ra_size(size + req_size, max);
+ ra->async_size = ra->size;
+
+ return 1;
+}
+
+/*
* A minimal readahead algorithm for trivial sequential/random reads.
*/
static unsigned long
@@ -356,34 +409,26 @@ ondemand_readahead(struct address_space
bool hit_readahead_marker, pgoff_t offset,
unsigned long req_size)
{
- int max = ra->ra_pages; /* max readahead pages */
- pgoff_t prev_offset;
- int sequential;
+ unsigned long max = max_sane_readahead(ra->ra_pages);
+
+ /*
+ * start of file
+ */
+ if (!offset)
+ goto initial_readahead;
/*
* It's the expected callback offset, assume sequential access.
* Ramp up sizes, and push forward the readahead window.
*/
- if (offset && (offset == (ra->start + ra->size - ra->async_size) ||
- offset == (ra->start + ra->size))) {
+ if ((offset == (ra->start + ra->size - ra->async_size) ||
+ offset == (ra->start + ra->size))) {
ra->start += ra->size;
ra->size = get_next_ra_size(ra, max);
ra->async_size = ra->size;
goto readit;
}
- prev_offset = ra->prev_pos >> PAGE_CACHE_SHIFT;
- sequential = offset - prev_offset <= 1UL || req_size > max;
-
- /*
- * Standalone, small read.
- * Read as is, and do not pollute the readahead state.
- */
- if (!hit_readahead_marker && !sequential) {
- return __do_page_cache_readahead(mapping, filp,
- offset, req_size, 0);
- }
-
/*
* Hit a marked page without valid readahead state.
* E.g. interleaved reads.
@@ -394,7 +439,7 @@ ondemand_readahead(struct address_space
pgoff_t start;
rcu_read_lock();
- start = radix_tree_next_hole(&mapping->page_tree, offset,max+1);
+ start = radix_tree_next_hole(&mapping->page_tree, offset+1, max);
rcu_read_unlock();
if (!start || start - offset > max)
@@ -402,23 +447,53 @@ ondemand_readahead(struct address_space
ra->start = start;
ra->size = start - offset; /* old async_size */
+ ra->size += req_size;
ra->size = get_next_ra_size(ra, max);
ra->async_size = ra->size;
goto readit;
}
/*
- * It may be one of
- * - first read on start of file
- * - sequential cache miss
- * - oversize random read
- * Start readahead for it.
+ * oversize read
+ */
+ if (req_size > max)
+ goto initial_readahead;
+
+ /*
+ * sequential cache miss
*/
+ if (offset - (ra->prev_pos >> PAGE_CACHE_SHIFT) <= 1UL)
+ goto initial_readahead;
+
+ /*
+ * Query the page cache and look for the traces(cached history pages)
+ * that a sequential stream would leave behind.
+ */
+ if (try_context_readahead(mapping, ra, offset, req_size, max))
+ goto readit;
+
+ /*
+ * standalone, small random read
+ * Read as is, and do not pollute the readahead state.
+ */
+ return __do_page_cache_readahead(mapping, filp, offset, req_size, 0);
+
+initial_readahead:
ra->start = offset;
ra->size = get_init_ra_size(req_size, max);
ra->async_size = ra->size > req_size ? ra->size - req_size : ra->size;
readit:
+ /*
+ * Will this read hit the readahead marker made by itself?
+ * If so, trigger the readahead marker hit now, and merge
+ * the resulted next readahead window into the current one.
+ */
+ if (offset == ra->start && ra->size == ra->async_size) {
+ ra->async_size = get_next_ra_size(ra, max);
+ ra->size += ra->async_size;
+ }
+
return ra_submit(ra, mapping, filp);
}
--- linux.orig/lib/radix-tree.c
+++ linux/lib/radix-tree.c
@@ -666,6 +666,43 @@ unsigned long radix_tree_next_hole(struc
}
EXPORT_SYMBOL(radix_tree_next_hole);
+/**
+ * radix_tree_prev_hole - find the prev hole (not-present entry)
+ * @root: tree root
+ * @index: index key
+ * @max_scan: maximum range to search
+ *
+ * Search backwards in the range [max(index-max_scan+1, 0), index]
+ * for the first hole.
+ *
+ * Returns: the index of the hole if found, otherwise returns an index
+ * outside of the set specified (in which case 'index - return >= max_scan'
+ * will be true). In rare cases of wrap-around, LONG_MAX will be returned.
+ *
+ * radix_tree_next_hole may be called under rcu_read_lock. However, like
+ * radix_tree_gang_lookup, this will not atomically search a snapshot of
+ * the tree at a single point in time. For example, if a hole is created
+ * at index 10, then subsequently a hole is created at index 5,
+ * radix_tree_prev_hole covering both indexes may return 5 if called under
+ * rcu_read_lock.
+ */
+unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
+ unsigned long index, unsigned long max_scan)
+{
+ unsigned long i;
+
+ for (i = 0; i < max_scan; i++) {
+ if (!radix_tree_lookup(root, index))
+ break;
+ index--;
+ if (index == LONG_MAX)
+ break;
+ }
+
+ return index;
+}
+EXPORT_SYMBOL(radix_tree_prev_hole);
+
static unsigned int
__lookup(struct radix_tree_node *slot, void ***results, unsigned long index,
unsigned int max_items, unsigned long *next_index)
--- linux.orig/include/linux/radix-tree.h
+++ linux/include/linux/radix-tree.h
@@ -167,6 +167,8 @@ radix_tree_gang_lookup_slot(struct radix
unsigned long first_index, unsigned int max_items);
unsigned long radix_tree_next_hole(struct radix_tree_root *root,
unsigned long index, unsigned long max_scan);
+unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
+ unsigned long index, unsigned long max_scan);
int radix_tree_preload(gfp_t gfp_mask);
void radix_tree_init(void);
void *radix_tree_tag_set(struct radix_tree_root *root,

View File

@@ -1,109 +0,0 @@
diff -upr linux-2.6.18/drivers/scsi/scsi_lib.c linux-2.6.18/drivers/scsi/scsi_lib.c
--- linux-2.6.18/drivers/scsi/scsi_lib.c 2006-09-20 07:42:06.000000000 +0400
+++ linux-2.6.18/drivers/scsi/scsi_lib.c 2007-07-04 21:15:32.000000000 +0400
@@ -367,7 +367,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -378,11 +378,14 @@ free_bios:
* @timeout: request timeout in seconds
* @retries: number of times to retry request
* @flags: or into request flags
+ * @at_head: insert request at head or tail of queue
**/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -427,8 +430,53 @@ free_sense:
kfree(sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.18/include/scsi/scsi_device.h linux-2.6.18/include/scsi/scsi_device.h
--- linux-2.6.18/include/scsi/scsi_device.h 2006-09-20 07:42:06.000000000 +0400
+++ linux-2.6.18/include/scsi/scsi_device.h 2007-07-04 21:15:32.000000000 +0400
@@ -335,6 +335,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline void scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,109 +0,0 @@
diff -upr linux-2.6.18/drivers/scsi/scsi_lib.c linux-2.6.18/drivers/scsi/scsi_lib.c
--- linux-2.6.18/drivers/scsi/scsi_lib.c 2006-09-20 07:42:06.000000000 +0400
+++ linux-2.6.18/drivers/scsi/scsi_lib.c 2007-07-04 21:15:32.000000000 +0400
@@ -367,7 +367,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -378,11 +378,14 @@ free_bios:
* @timeout: request timeout in seconds
* @retries: number of times to retry request
* @flags: or into request flags
+ * @at_head: insert request at head or tail of queue
**/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -427,8 +430,53 @@ free_sense:
kfree(sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.18/include/scsi/scsi_device.h linux-2.6.18/include/scsi/scsi_device.h
--- linux-2.6.18/include/scsi/scsi_device.h 2006-09-20 07:42:06.000000000 +0400
+++ linux-2.6.18/include/scsi/scsi_device.h 2007-07-04 21:15:32.000000000 +0400
@@ -335,6 +335,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline void scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,78 +0,0 @@
diff -upr linux-2.6.15.6/drivers/scsi/scsi_lib.c linux-2.6.15.6/drivers/scsi/scsi_lib.c
--- linux-2.6.15.6/drivers/scsi/scsi_lib.c 2006-03-05 22:07:54.000000000 +0300
+++ linux-2.6.15.6/drivers/scsi/scsi_lib.c 2007-07-05 13:11:43.000000000 +0400
@@ -254,6 +254,61 @@ void scsi_do_req(struct scsi_request *sr
}
EXPORT_SYMBOL(scsi_do_req);
+/*
+ * Function: scsi_do_req_fifo
+ *
+ * Purpose: Queue a SCSI request
+ *
+ * Arguments: sreq - command descriptor.
+ * cmnd - actual SCSI command to be performed.
+ * buffer - data buffer.
+ * bufflen - size of data buffer.
+ * done - completion function to be run.
+ * timeout - how long to let it run before timeout.
+ * retries - number of retries we allow.
+ *
+ * Lock status: No locks held upon entry.
+ *
+ * Returns: Nothing.
+ *
+ * Notes: This function is used for queueing requests in FIFO order.
+ * It is a copy of scsi_do_req() with only changed the last
+ * parameter of scsi_insert_special_req(). Not sure, if it
+ * breaks quiesce, but, anyway, I don't see another way to
+ * queue requests in FIFO order, which is necessary for SCST.
+ */
+void scsi_do_req_fifo(struct scsi_request *sreq, const void *cmnd,
+ void *buffer, unsigned bufflen,
+ void (*done)(struct scsi_cmnd *),
+ int timeout, int retries)
+{
+ /*
+ * If the upper level driver is reusing these things, then
+ * we should release the low-level block now. Another one will
+ * be allocated later when this request is getting queued.
+ */
+ __scsi_release_request(sreq);
+
+ /*
+ * Our own function scsi_done (which marks the host as not busy,
+ * disables the timeout counter, etc) will be called by us or by the
+ * scsi_hosts[host].queuecommand() function needs to also call
+ * the completion function for the high level driver.
+ */
+ memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd));
+ sreq->sr_bufflen = bufflen;
+ sreq->sr_buffer = buffer;
+ sreq->sr_allowed = retries;
+ sreq->sr_done = done;
+ sreq->sr_timeout_per_command = timeout;
+
+ if (sreq->sr_cmd_len == 0)
+ sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]);
+
+ scsi_insert_special_req(sreq, 0);
+}
+EXPORT_SYMBOL(scsi_do_req_fifo);
+
/**
* scsi_execute - insert request and wait for the result
* @sdev: scsi device
diff -upr linux-2.6.15.6/include/scsi/scsi_request.h linux-2.6.15.6/include/scsi/scsi_request.h
--- linux-2.6.15.6/include/scsi/scsi_request.h 2006-03-05 22:07:54.000000000 +0300
+++ linux-2.6.15.6/include/scsi/scsi_request.h 2007-07-05 13:15:52.000000000 +0400
@@ -51,4 +51,9 @@ extern void scsi_do_req(struct scsi_requ
void *buffer, unsigned bufflen,
void (*done) (struct scsi_cmnd *),
int timeout, int retries);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern void scsi_do_req_fifo(struct scsi_request *, const void *cmnd,
+ void *buffer, unsigned bufflen,
+ void (*done) (struct scsi_cmnd *),
+ int timeout, int retries);
#endif /* _SCSI_SCSI_REQUEST_H */

View File

@@ -1,80 +0,0 @@
diff -upr linux-2.6.16.29/drivers/scsi/scsi_lib.c linux-2.6.16.29/drivers/scsi/scsi_lib.c
--- linux-2.6.16.29/drivers/scsi/scsi_lib.c 2006-09-12 22:02:10.000000000 +0400
+++ linux-2.6.16.29/drivers/scsi/scsi_lib.c 2007-07-05 12:59:24.000000000 +0400
@@ -227,6 +227,63 @@ void scsi_do_req(struct scsi_request *sr
}
EXPORT_SYMBOL(scsi_do_req);
+/*
+ * Function: scsi_do_req_fifo
+ *
+ * Purpose: Queue a SCSI request
+ *
+ * Arguments: sreq - command descriptor.
+ * cmnd - actual SCSI command to be performed.
+ * buffer - data buffer.
+ * bufflen - size of data buffer.
+ * done - completion function to be run.
+ * timeout - how long to let it run before timeout.
+ * retries - number of retries we allow.
+ *
+ * Lock status: No locks held upon entry.
+ *
+ * Returns: Nothing.
+ *
+ * Notes: This function is used for queueing requests in FIFO order.
+ * It is a copy of scsi_do_req() with only changed the last
+ * parameter of scsi_insert_special_req(). Not sure, if it
+ * breaks quiesce, but, anyway, I don't see another way to
+ * queue requests in FIFO order, which is necessary for SCST.
+ */
+void scsi_do_req_fifo(struct scsi_request *sreq, const void *cmnd,
+ void *buffer, unsigned bufflen,
+ void (*done)(struct scsi_cmnd *),
+ int timeout, int retries)
+{
+ /*
+ * If the upper level driver is reusing these things, then
+ * we should release the low-level block now. Another one will
+ * be allocated later when this request is getting queued.
+ */
+ __scsi_release_request(sreq);
+
+ /*
+ * Our own function scsi_done (which marks the host as not busy,
+ * disables the timeout counter, etc) will be called by us or by the
+ * scsi_hosts[host].queuecommand() function needs to also call
+ * the completion function for the high level driver.
+ */
+ memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd));
+ sreq->sr_bufflen = bufflen;
+ sreq->sr_buffer = buffer;
+ sreq->sr_allowed = retries;
+ sreq->sr_done = done;
+ sreq->sr_timeout_per_command = timeout;
+
+ if (sreq->sr_cmd_len == 0)
+ sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]);
+
+ sreq->sr_request->flags &= ~REQ_DONTPREP;
+ blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request,
+ 1, sreq);
+}
+EXPORT_SYMBOL(scsi_do_req_fifo);
+
/**
* scsi_execute - insert request and wait for the result
* @sdev: scsi device
diff -upr linux-2.6.16.29/include/scsi/scsi_request.h linux-2.6.16.29/include/scsi/scsi_request.h
--- linux-2.6.16.29/include/scsi/scsi_request.h 2006-09-12 22:02:10.000000000 +0400
+++ linux-2.6.16.29/include/scsi/scsi_request.h 2007-07-05 13:01:04.000000000 +0400
@@ -51,4 +51,9 @@ extern void scsi_do_req(struct scsi_requ
void *buffer, unsigned bufflen,
void (*done) (struct scsi_cmnd *),
int timeout, int retries);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern void scsi_do_req_fifo(struct scsi_request *, const void *cmnd,
+ void *buffer, unsigned bufflen,
+ void (*done) (struct scsi_cmnd *),
+ int timeout, int retries);
#endif /* _SCSI_SCSI_REQUEST_H */

View File

@@ -1,109 +0,0 @@
diff -upr linux-2.6.18.1/drivers/scsi/scsi_lib.c linux-2.6.18.1/drivers/scsi/scsi_lib.c
--- linux-2.6.18.1/drivers/scsi/scsi_lib.c 2006-09-20 07:42:06.000000000 +0400
+++ linux-2.6.18.1/drivers/scsi/scsi_lib.c 2007-07-04 21:15:32.000000000 +0400
@@ -367,7 +367,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -378,11 +378,14 @@ free_bios:
* @timeout: request timeout in seconds
* @retries: number of times to retry request
* @flags: or into request flags
+ * @at_head: insert request at head or tail of queue
**/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -427,8 +430,53 @@ free_sense:
kfree(sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.18.1/include/scsi/scsi_device.h linux-2.6.18.1/include/scsi/scsi_device.h
--- linux-2.6.18.1/include/scsi/scsi_device.h 2006-09-20 07:42:06.000000000 +0400
+++ linux-2.6.18.1/include/scsi/scsi_device.h 2007-07-04 21:15:32.000000000 +0400
@@ -297,6 +297,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline void scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,109 +0,0 @@
diff -upr linux-2.6.21.1/drivers/scsi/scsi_lib.c linux-2.6.21.1/drivers/scsi/scsi_lib.c
--- linux-2.6.21.1/drivers/scsi/scsi_lib.c 2007-04-28 01:49:26.000000000 +0400
+++ linux-2.6.21.1/drivers/scsi/scsi_lib.c 2007-06-20 13:19:50.000000000 +0400
@@ -366,7 +366,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -377,11 +377,14 @@ free_bios:
* @timeout: request timeout in seconds
* @retries: number of times to retry request
* @flags: or into request flags
+ * @at_head: insert request at head or tail of queue
**/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -427,8 +430,53 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.21.1/include/scsi/scsi_device.h linux-2.6.21.1/include/scsi/scsi_device.h
--- linux-2.6.21.1/include/scsi/scsi_device.h 2007-04-28 01:49:26.000000000 +0400
+++ linux-2.6.21.1/include/scsi/scsi_device.h 2007-06-20 13:25:07.000000000 +0400
@@ -298,6 +298,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,109 +0,0 @@
diff -upr linux-2.6.22/drivers/scsi/scsi_lib.c linux-2.6.22/drivers/scsi/scsi_lib.c
--- linux-2.6.22/drivers/scsi/scsi_lib.c 2007-07-09 03:32:17.000000000 +0400
+++ linux-2.6.22/drivers/scsi/scsi_lib.c 2007-07-18 13:34:54.000000000 +0400
@@ -366,7 +366,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -377,11 +377,14 @@ free_bios:
* @timeout: request timeout in seconds
* @retries: number of times to retry request
* @flags: or into request flags
+ * @at_head: insert request at head or tail of queue
**/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -427,8 +430,53 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.22/include/scsi/scsi_device.h linux-2.6.22/include/scsi/scsi_device.h
--- linux-2.6.22/include/scsi/scsi_device.h 2007-07-09 03:32:17.000000000 +0400
+++ linux-2.6.22/include/scsi/scsi_device.h 2007-07-18 13:34:54.000000000 +0400
@@ -303,6 +303,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,109 +0,0 @@
diff -upr linux-2.6.23/drivers/scsi/scsi_lib.c linux-2.6.23/drivers/scsi/scsi_lib.c
--- linux-2.6.23/drivers/scsi/scsi_lib.c 2007-10-10 00:31:38.000000000 +0400
+++ linux-2.6.23/drivers/scsi/scsi_lib.c 2007-10-10 12:37:27.000000000 +0400
@@ -366,7 +366,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -377,11 +377,14 @@ free_bios:
* @timeout: request timeout in seconds
* @retries: number of times to retry request
* @flags: or into request flags
+ * @at_head: insert request at head or tail of queue
**/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -427,8 +430,53 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.23/include/scsi/scsi_device.h linux-2.6.23/include/scsi/scsi_device.h
--- linux-2.6.23/include/scsi/scsi_device.h 2007-10-10 00:31:38.000000000 +0400
+++ linux-2.6.23/include/scsi/scsi_device.h 2007-10-10 12:37:27.000000000 +0400
@@ -303,6 +303,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,109 +0,0 @@
diff -upkr linux-2.6.24/drivers/scsi/scsi_lib.c linux-2.6.24/drivers/scsi/scsi_lib.c
--- linux-2.6.24/drivers/scsi/scsi_lib.c 2008-01-25 01:58:37.000000000 +0300
+++ linux-2.6.24/drivers/scsi/scsi_lib.c 2008-01-28 11:10:30.000000000 +0300
@@ -361,7 +361,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -372,11 +372,14 @@ free_bios:
* @timeout: request timeout in seconds
* @retries: number of times to retry request
* @flags: or into request flags
+ * @at_head: insert request at head or tail of queue
**/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -413,7 +416,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -422,8 +425,53 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upkr linux-2.6.24/include/scsi/scsi_device.h linux-2.6.24/include/scsi/scsi_device.h
--- linux-2.6.24/include/scsi/scsi_device.h 2008-01-25 01:58:37.000000000 +0300
+++ linux-2.6.24/include/scsi/scsi_device.h 2008-01-28 11:10:30.000000000 +0300
@@ -331,6 +331,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,109 +0,0 @@
diff -upkr linux-2.6.25/drivers/scsi/scsi_lib.c linux-2.6.25/drivers/scsi/scsi_lib.c
--- linux-2.6.25/drivers/scsi/scsi_lib.c 2008-04-17 06:49:44.000000000 +0400
+++ linux-2.6.25/drivers/scsi/scsi_lib.c 2008-04-18 14:19:27.000000000 +0400
@@ -363,7 +363,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -376,11 +376,14 @@ free_bios:
* @privdata: data passed to done()
* @done: callback function when done
* @gfp: memory allocation flags
+ * @at_head: insert request at head or tail of queue
*/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -417,7 +420,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -426,8 +429,53 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer, unsigned bufflen,
+ int use_sg, int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upkr linux-2.6.25/include/scsi/scsi_device.h linux-2.6.25/include/scsi/scsi_device.h
--- linux-2.6.25/include/scsi/scsi_device.h 2008-04-17 06:49:44.000000000 +0400
+++ linux-2.6.25/include/scsi/scsi_device.h 2008-04-18 13:31:09.000000000 +0400
@@ -332,6 +332,13 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len, int data_direction,
+ void *buffer, unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,112 +0,0 @@
diff -upr linux-2.6.26/drivers/scsi/scsi_lib.c linux-2.6.26/drivers/scsi/scsi_lib.c
--- linux-2.6.26/drivers/scsi/scsi_lib.c 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.26/drivers/scsi/scsi_lib.c 2008-07-31 21:20:00.000000000 +0400
@@ -372,7 +372,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -385,11 +385,14 @@ free_bios:
* @privdata: data passed to done()
* @done: callback function when done
* @gfp: memory allocation flags
+ * @at_head: insert request at head or tail of queue
*/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -426,7 +429,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -435,8 +438,55 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout,
+ int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout, int retries,
+ void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.26/include/scsi/scsi_device.h linux-2.6.26/include/scsi/scsi_device.h
--- linux-2.6.26/include/scsi/scsi_device.h 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.26/include/scsi/scsi_device.h 2008-07-31 21:20:39.000000000 +0400
@@ -333,6 +333,14 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len,
+ int data_direction, void *buffer,
+ unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,112 +0,0 @@
diff -upr linux-2.6.27/drivers/scsi/scsi_lib.c linux-2.6.27/drivers/scsi/scsi_lib.c
--- linux-2.6.27/drivers/scsi/scsi_lib.c 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.27/drivers/scsi/scsi_lib.c 2008-07-31 21:20:00.000000000 +0400
@@ -372,7 +372,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -385,11 +385,14 @@ free_bios:
* @privdata: data passed to done()
* @done: callback function when done
* @gfp: memory allocation flags
+ * @at_head: insert request at head or tail of queue
*/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -426,7 +429,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -435,8 +438,55 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout,
+ int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout, int retries,
+ void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.27/include/scsi/scsi_device.h linux-2.6.27/include/scsi/scsi_device.h
--- linux-2.6.27/include/scsi/scsi_device.h 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.27/include/scsi/scsi_device.h 2008-07-31 21:20:39.000000000 +0400
@@ -365,6 +365,14 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len,
+ int data_direction, void *buffer,
+ unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,112 +0,0 @@
diff -upr linux-2.6.28/drivers/scsi/scsi_lib.c linux-2.6.28/drivers/scsi/scsi_lib.c
--- linux-2.6.28/drivers/scsi/scsi_lib.c 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.28/drivers/scsi/scsi_lib.c 2008-07-31 21:20:00.000000000 +0400
@@ -380,7 +380,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -393,11 +393,14 @@ free_bios:
* @privdata: data passed to done()
* @done: callback function when done
* @gfp: memory allocation flags
+ * @at_head: insert request at head or tail of queue
*/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -434,7 +439,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -443,8 +446,55 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout,
+ int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout, int retries,
+ void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.28/include/scsi/scsi_device.h linux-2.6.28/include/scsi/scsi_device.h
--- linux-2.6.28/include/scsi/scsi_device.h 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.28/include/scsi/scsi_device.h 2008-07-31 21:20:39.000000000 +0400
@@ -377,6 +377,14 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len,
+ int data_direction, void *buffer,
+ unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,112 +0,0 @@
diff -upr linux-2.6.29/drivers/scsi/scsi_lib.c linux-2.6.29/drivers/scsi/scsi_lib.c
--- linux-2.6.29/drivers/scsi/scsi_lib.c 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.29/drivers/scsi/scsi_lib.c 2008-07-31 21:20:00.000000000 +0400
@@ -402,7 +402,7 @@ free_bios:
}
/**
- * scsi_execute_async - insert request
+ * __scsi_execute_async - insert request
* @sdev: scsi device
* @cmd: scsi command
* @cmd_len: length of scsi cdb
@@ -415,11 +415,14 @@ free_bios:
* @privdata: data passed to done()
* @done: callback function when done
* @gfp: memory allocation flags
+ * @at_head: insert request at head or tail of queue
*/
-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+static inline int __scsi_execute_async(struct scsi_device *sdev,
+ const unsigned char *cmd,
int cmd_len, int data_direction, void *buffer, unsigned bufflen,
int use_sg, int timeout, int retries, void *privdata,
- void (*done)(void *, char *, int, int), gfp_t gfp)
+ void (*done)(void *, char *, int, int), gfp_t gfp,
+ int at_head)
{
struct request *req;
struct scsi_io_context *sioc;
@@ -456,7 +461,7 @@ int scsi_execute_async(struct scsi_devic
sioc->data = privdata;
sioc->done = done;
- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
+ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
return 0;
free_req:
@@ -465,8 +468,55 @@ free_sense:
kmem_cache_free(scsi_io_context_cache, sioc);
return DRIVER_ERROR << 24;
}
+
+/**
+ * scsi_execute_async - insert request
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout,
+ int retries, void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
+}
EXPORT_SYMBOL_GPL(scsi_execute_async);
+/**
+ * scsi_execute_async_fifo - insert request at tail, in FIFO order
+ * @sdev: scsi device
+ * @cmd: scsi command
+ * @cmd_len: length of scsi cdb
+ * @data_direction: data direction
+ * @buffer: data buffer (this can be a kernel buffer or scatterlist)
+ * @bufflen: len of buffer
+ * @use_sg: if buffer is a scatterlist this is the number of elements
+ * @timeout: request timeout in seconds
+ * @retries: number of times to retry request
+ * @flags: or into request flags
+ **/
+int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
+ int cmd_len, int data_direction, void *buffer,
+ unsigned bufflen, int use_sg, int timeout, int retries,
+ void *privdata,
+ void (*done)(void *, char *, int, int), gfp_t gfp)
+{
+ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
+ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
+}
+EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
+
/*
* Function: scsi_init_cmd_errh()
*
diff -upr linux-2.6.29/include/scsi/scsi_device.h linux-2.6.29/include/scsi/scsi_device.h
--- linux-2.6.29/include/scsi/scsi_device.h 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.29/include/scsi/scsi_device.h 2008-07-31 21:20:39.000000000 +0400
@@ -376,6 +376,14 @@ extern int scsi_execute_async(struct scs
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int),
gfp_t gfp);
+#define SCSI_EXEC_REQ_FIFO_DEFINED
+extern int scsi_execute_async_fifo(struct scsi_device *sdev,
+ const unsigned char *cmd, int cmd_len,
+ int data_direction, void *buffer,
+ unsigned bufflen, int use_sg,
+ int timeout, int retries, void *privdata,
+ void (*done)(void *, char *, int, int),
+ gfp_t gfp);
static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
{

View File

@@ -1,11 +0,0 @@
--- linux-2.6.24-24.53/mm/readahead.c 2008-02-11 06:51:11.000000000 +0100
+++ linux-2.6.24-24.53.copy/mm/readahead.c 2009-06-09 21:59:13.640647726 +0200
@@ -472,5 +472,8 @@ page_cache_async_readahead(struct addres
/* do read-ahead */
ondemand_readahead(mapping, ra, filp, true, offset, req_size);
+
+ if (PageUptodate(page))
+ blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
EXPORT_SYMBOL_GPL(page_cache_async_readahead);