diff --git a/scst/kernel/scst_exec_req_fifo-2.6.30.patch b/scst/kernel/scst_exec_req_fifo-2.6.30.patch index 5a7411563..9b9cb78e1 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.30.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.30.patch @@ -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 #include @@ -9,7 +9,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.31.patch b/scst/kernel/scst_exec_req_fifo-2.6.31.patch index a5e1e33e5..0d9c06e6d 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.31.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.31.patch @@ -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 #include @@ -9,7 +9,7 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.32.patch b/scst/kernel/scst_exec_req_fifo-2.6.32.patch index 7ae1b56a2..bc0171019 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.32.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.32.patch @@ -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 #include @@ -9,7 +9,7 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.33.patch b/scst/kernel/scst_exec_req_fifo-2.6.33.patch index 777fca559..fee571fce 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.33.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.33.patch @@ -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 #include @@ -9,7 +9,7 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.34.patch b/scst/kernel/scst_exec_req_fifo-2.6.34.patch index b43333a7f..c7021f573 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.34.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.34.patch @@ -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 #include @@ -10,7 +10,7 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.35.patch b/scst/kernel/scst_exec_req_fifo-2.6.35.patch index 8040dd1fb..b10ae1b5a 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.35.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.35.patch @@ -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 #include @@ -10,7 +10,7 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.36.patch b/scst/kernel/scst_exec_req_fifo-2.6.36.patch index 2f80b963c..d90bdcb8e 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.36.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.36.patch @@ -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 #include @@ -10,7 +10,7 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.37.patch b/scst/kernel/scst_exec_req_fifo-2.6.37.patch index 8f906f883..ab94c18ae 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.37.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.37.patch @@ -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 #include @@ -10,7 +10,7 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c #include /* 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 @@ -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); - diff --git a/scst/kernel/scst_exec_req_fifo-2.6.38.patch b/scst/kernel/scst_exec_req_fifo-2.6.38.patch index fcf22a06a..4561ba2e9 100644 --- a/scst/kernel/scst_exec_req_fifo-2.6.38.patch +++ b/scst/kernel/scst_exec_req_fifo-2.6.38.patch @@ -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 #include @@ -10,7 +10,7 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c #include /* 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 @@ -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); }