mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-19 21:56:31 +00:00
Regenerated scst_exec_req_fifo patches with fix for memory leak on errors processing path discovered and fixed by Steve Corbin <steve.corbin@virtualcomputer.com>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3459 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
--- linux-2.6.30/block/blk-map.c 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/block/blk-map.c 2010-11-26 17:35:41.027689874 +0300
|
||||
--- linux-2.6.30/block/blk-map.c 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/block/blk-map.c 2011-05-17 21:03:29.661813000 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -272,6 +273,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -272,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -336,7 +338,7 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
+ bio = bio->bi_next;
|
||||
+ b->bi_end_io(b, err);
|
||||
+ }
|
||||
+ rq->bio = NULL;
|
||||
+ rq->bio = 0;
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.30/block/blk-map.c linux-2.6.30/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.30/include/linux/blkdev.h linux-2.6.30/include/linux/blkdev.h
|
||||
--- linux-2.6.30/include/linux/blkdev.h 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/include/linux/blkdev.h 2009-08-12 19:48:06.000000000 +0400
|
||||
--- linux-2.6.30/include/linux/blkdev.h 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/include/linux/blkdev.h 2009-08-12 11:48:06.000000000 -0400
|
||||
@@ -704,6 +704,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.30/include/linux/blkdev.h linux-2.6.30/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.30/include/linux/scatterlist.h linux-2.6.30/include/linux/scatterlist.h
|
||||
--- linux-2.6.30/include/linux/scatterlist.h 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/include/linux/scatterlist.h 2009-08-12 19:50:02.000000000 +0400
|
||||
--- linux-2.6.30/include/linux/scatterlist.h 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/include/linux/scatterlist.h 2009-08-12 11:50:02.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.30/include/linux/scatterlist.h linux-2.6.30/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.30/lib/scatterlist.c linux-2.6.30/lib/scatterlist.c
|
||||
--- linux-2.6.30/lib/scatterlist.c 2009-06-10 07:05:27.000000000 +0400
|
||||
+++ linux-2.6.30/lib/scatterlist.c 2009-08-12 19:56:04.000000000 +0400
|
||||
--- linux-2.6.30/lib/scatterlist.c 2009-06-09 23:05:27.000000000 -0400
|
||||
+++ linux-2.6.30/lib/scatterlist.c 2009-08-12 11:56:04.000000000 -0400
|
||||
@@ -485,3 +485,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.30/lib/scatterlist.c linux-2.6.30/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
--- linux-2.6.31/block/blk-map.c 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/block/blk-map.c 2010-11-26 17:39:55.415689756 +0300
|
||||
--- linux-2.6.31/block/blk-map.c 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/block/blk-map.c 2011-05-17 21:05:32.669812993 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +272,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +272,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.31/block/blk-map.c linux-2.6.31/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.31/include/linux/blkdev.h linux-2.6.31/include/linux/blkdev.h
|
||||
--- linux-2.6.31/include/linux/blkdev.h 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/include/linux/blkdev.h 2009-09-23 14:17:33.000000000 +0400
|
||||
--- linux-2.6.31/include/linux/blkdev.h 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/include/linux/blkdev.h 2009-09-23 06:17:33.000000000 -0400
|
||||
@@ -699,6 +699,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.31/include/linux/blkdev.h linux-2.6.31/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.31/include/linux/scatterlist.h linux-2.6.31/include/linux/scatterlist.h
|
||||
--- linux-2.6.31/include/linux/scatterlist.h 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/include/linux/scatterlist.h 2009-09-23 14:17:33.000000000 +0400
|
||||
--- linux-2.6.31/include/linux/scatterlist.h 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/include/linux/scatterlist.h 2009-09-23 06:17:33.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.31/include/linux/scatterlist.h linux-2.6.31/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.31/lib/scatterlist.c linux-2.6.31/lib/scatterlist.c
|
||||
--- linux-2.6.31/lib/scatterlist.c 2009-09-10 02:13:59.000000000 +0400
|
||||
+++ linux-2.6.31/lib/scatterlist.c 2009-09-23 14:17:33.000000000 +0400
|
||||
--- linux-2.6.31/lib/scatterlist.c 2009-09-09 18:13:59.000000000 -0400
|
||||
+++ linux-2.6.31/lib/scatterlist.c 2009-09-23 06:17:33.000000000 -0400
|
||||
@@ -493,3 +493,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.31/lib/scatterlist.c linux-2.6.31/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
--- linux-2.6.32/block/blk-map.c 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/block/blk-map.c 2010-11-26 17:48:24.811689511 +0300
|
||||
--- linux-2.6.32/block/blk-map.c 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/block/blk-map.c 2011-05-17 20:56:18.341812997 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +272,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +272,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.32/block/blk-map.c linux-2.6.32/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.32/include/linux/blkdev.h linux-2.6.32/include/linux/blkdev.h
|
||||
--- linux-2.6.32/include/linux/blkdev.h 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/include/linux/blkdev.h 2009-12-16 15:21:35.000000000 +0300
|
||||
--- linux-2.6.32/include/linux/blkdev.h 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/include/linux/blkdev.h 2009-12-16 07:21:35.000000000 -0500
|
||||
@@ -708,6 +708,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.32/include/linux/blkdev.h linux-2.6.32/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.32/include/linux/scatterlist.h linux-2.6.32/include/linux/scatterlist.h
|
||||
--- linux-2.6.32/include/linux/scatterlist.h 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/include/linux/scatterlist.h 2009-12-16 15:21:35.000000000 +0300
|
||||
--- linux-2.6.32/include/linux/scatterlist.h 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/include/linux/scatterlist.h 2009-12-16 07:21:35.000000000 -0500
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.32/include/linux/scatterlist.h linux-2.6.32/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.32/lib/scatterlist.c linux-2.6.32/lib/scatterlist.c
|
||||
--- linux-2.6.32/lib/scatterlist.c 2009-12-03 06:51:21.000000000 +0300
|
||||
+++ linux-2.6.32/lib/scatterlist.c 2009-12-16 15:21:35.000000000 +0300
|
||||
--- linux-2.6.32/lib/scatterlist.c 2009-12-02 22:51:21.000000000 -0500
|
||||
+++ linux-2.6.32/lib/scatterlist.c 2009-12-16 07:21:35.000000000 -0500
|
||||
@@ -493,3 +493,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.32/lib/scatterlist.c linux-2.6.32/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
--- linux-2.6.33/block/blk-map.c 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/block/blk-map.c 2010-11-26 17:50:39.511689888 +0300
|
||||
--- linux-2.6.33/block/blk-map.c 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/block/blk-map.c 2011-05-17 21:09:00.317812998 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -9,7 +9,7 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +272,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +272,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -21,7 +21,18 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -75,7 +86,7 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -84,7 +95,7 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -112,17 +123,8 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -346,8 +348,8 @@ diff -upkr linux-2.6.33/block/blk-map.c linux-2.6.33/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.33/include/linux/blkdev.h linux-2.6.33/include/linux/blkdev.h
|
||||
--- linux-2.6.33/include/linux/blkdev.h 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/include/linux/blkdev.h 2010-03-01 15:41:59.000000000 +0300
|
||||
--- linux-2.6.33/include/linux/blkdev.h 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/include/linux/blkdev.h 2010-03-01 07:41:59.000000000 -0500
|
||||
@@ -710,6 +710,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -368,8 +370,8 @@ diff -upkr linux-2.6.33/include/linux/blkdev.h linux-2.6.33/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.33/include/linux/scatterlist.h linux-2.6.33/include/linux/scatterlist.h
|
||||
--- linux-2.6.33/include/linux/scatterlist.h 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/include/linux/scatterlist.h 2010-03-01 15:41:59.000000000 +0300
|
||||
--- linux-2.6.33/include/linux/scatterlist.h 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/include/linux/scatterlist.h 2010-03-01 07:41:59.000000000 -0500
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -390,8 +392,8 @@ diff -upkr linux-2.6.33/include/linux/scatterlist.h linux-2.6.33/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.33/lib/scatterlist.c linux-2.6.33/lib/scatterlist.c
|
||||
--- linux-2.6.33/lib/scatterlist.c 2010-02-24 21:52:17.000000000 +0300
|
||||
+++ linux-2.6.33/lib/scatterlist.c 2010-03-01 15:41:59.000000000 +0300
|
||||
--- linux-2.6.33/lib/scatterlist.c 2010-02-24 13:52:17.000000000 -0500
|
||||
+++ linux-2.6.33/lib/scatterlist.c 2010-03-01 07:41:59.000000000 -0500
|
||||
@@ -493,3 +493,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -525,4 +527,3 @@ diff -upkr linux-2.6.33/lib/scatterlist.c linux-2.6.33/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
--- linux-2.6.34/block/blk-map.c 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/block/blk-map.c 2010-11-26 17:58:41.579690663 +0300
|
||||
--- linux-2.6.34/block/blk-map.c 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/block/blk-map.c 2011-05-17 21:10:43.745812995 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +273,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -347,8 +349,8 @@ diff -upkr linux-2.6.34/block/blk-map.c linux-2.6.34/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.34/include/linux/blkdev.h linux-2.6.34/include/linux/blkdev.h
|
||||
--- linux-2.6.34/include/linux/blkdev.h 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/include/linux/blkdev.h 2010-05-24 14:51:22.000000000 +0400
|
||||
--- linux-2.6.34/include/linux/blkdev.h 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/include/linux/blkdev.h 2010-05-24 06:51:22.000000000 -0400
|
||||
@@ -713,6 +713,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -369,8 +371,8 @@ diff -upkr linux-2.6.34/include/linux/blkdev.h linux-2.6.34/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.34/include/linux/scatterlist.h linux-2.6.34/include/linux/scatterlist.h
|
||||
--- linux-2.6.34/include/linux/scatterlist.h 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/include/linux/scatterlist.h 2010-05-24 14:51:22.000000000 +0400
|
||||
--- linux-2.6.34/include/linux/scatterlist.h 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/include/linux/scatterlist.h 2010-05-24 06:51:22.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -391,8 +393,8 @@ diff -upkr linux-2.6.34/include/linux/scatterlist.h linux-2.6.34/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.34/lib/scatterlist.c linux-2.6.34/lib/scatterlist.c
|
||||
--- linux-2.6.34/lib/scatterlist.c 2010-05-17 01:17:36.000000000 +0400
|
||||
+++ linux-2.6.34/lib/scatterlist.c 2010-05-24 14:51:22.000000000 +0400
|
||||
--- linux-2.6.34/lib/scatterlist.c 2010-05-16 17:17:36.000000000 -0400
|
||||
+++ linux-2.6.34/lib/scatterlist.c 2010-05-24 06:51:22.000000000 -0400
|
||||
@@ -494,3 +494,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -526,4 +528,3 @@ diff -upkr linux-2.6.34/lib/scatterlist.c linux-2.6.34/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
--- linux-2.6.35/block/blk-map.c 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/block/blk-map.c 2010-11-26 18:03:58.107693773 +0300
|
||||
--- linux-2.6.35/block/blk-map.c 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/block/blk-map.c 2011-05-17 21:12:23.125813000 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +273,335 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -347,8 +349,8 @@ diff -upkr linux-2.6.35/block/blk-map.c linux-2.6.35/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.35/include/linux/blkdev.h linux-2.6.35/include/linux/blkdev.h
|
||||
--- linux-2.6.35/include/linux/blkdev.h 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/include/linux/blkdev.h 2010-08-04 12:21:59.737128732 +0400
|
||||
--- linux-2.6.35/include/linux/blkdev.h 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/include/linux/blkdev.h 2010-08-04 04:21:59.737128732 -0400
|
||||
@@ -717,6 +717,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -369,8 +371,8 @@ diff -upkr linux-2.6.35/include/linux/blkdev.h linux-2.6.35/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.35/include/linux/scatterlist.h linux-2.6.35/include/linux/scatterlist.h
|
||||
--- linux-2.6.35/include/linux/scatterlist.h 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/include/linux/scatterlist.h 2010-08-04 12:21:59.741129485 +0400
|
||||
--- linux-2.6.35/include/linux/scatterlist.h 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/include/linux/scatterlist.h 2010-08-04 04:21:59.741129485 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -391,8 +393,8 @@ diff -upkr linux-2.6.35/include/linux/scatterlist.h linux-2.6.35/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.35/lib/scatterlist.c linux-2.6.35/lib/scatterlist.c
|
||||
--- linux-2.6.35/lib/scatterlist.c 2010-08-02 02:11:14.000000000 +0400
|
||||
+++ linux-2.6.35/lib/scatterlist.c 2010-08-04 12:21:59.741129485 +0400
|
||||
--- linux-2.6.35/lib/scatterlist.c 2010-08-01 18:11:14.000000000 -0400
|
||||
+++ linux-2.6.35/lib/scatterlist.c 2010-08-04 04:21:59.741129485 -0400
|
||||
@@ -494,3 +494,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -526,4 +528,3 @@ diff -upkr linux-2.6.35/lib/scatterlist.c linux-2.6.35/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
--- linux-2.6.36/block/blk-map.c 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/block/blk-map.c 2010-11-26 17:52:19.467689539 +0300
|
||||
--- linux-2.6.36/block/blk-map.c 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/block/blk-map.c 2011-05-17 21:13:42.301812997 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -271,6 +273,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -271,6 +273,339 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -349,8 +351,8 @@ diff -upkr linux-2.6.36/block/blk-map.c linux-2.6.36/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.36/include/linux/blkdev.h linux-2.6.36/include/linux/blkdev.h
|
||||
--- linux-2.6.36/include/linux/blkdev.h 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/include/linux/blkdev.h 2010-10-26 12:00:15.899759399 +0400
|
||||
--- linux-2.6.36/include/linux/blkdev.h 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/include/linux/blkdev.h 2010-10-26 04:00:15.899759399 -0400
|
||||
@@ -629,6 +629,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -371,8 +373,8 @@ diff -upkr linux-2.6.36/include/linux/blkdev.h linux-2.6.36/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.36/include/linux/scatterlist.h linux-2.6.36/include/linux/scatterlist.h
|
||||
--- linux-2.6.36/include/linux/scatterlist.h 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/include/linux/scatterlist.h 2010-10-26 12:00:15.899759399 +0400
|
||||
--- linux-2.6.36/include/linux/scatterlist.h 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/include/linux/scatterlist.h 2010-10-26 04:00:15.899759399 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -393,8 +395,8 @@ diff -upkr linux-2.6.36/include/linux/scatterlist.h linux-2.6.36/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.36/lib/scatterlist.c linux-2.6.36/lib/scatterlist.c
|
||||
--- linux-2.6.36/lib/scatterlist.c 2010-10-21 00:30:22.000000000 +0400
|
||||
+++ linux-2.6.36/lib/scatterlist.c 2010-10-26 12:00:15.899759399 +0400
|
||||
--- linux-2.6.36/lib/scatterlist.c 2010-10-20 16:30:22.000000000 -0400
|
||||
+++ linux-2.6.36/lib/scatterlist.c 2010-10-26 04:00:15.899759399 -0400
|
||||
@@ -517,3 +517,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -528,4 +530,3 @@ diff -upkr linux-2.6.36/lib/scatterlist.c linux-2.6.36/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
--- linux-2.6.37/block/blk-map.c 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/block/blk-map.c 2011-01-08 16:45:54.350430208 +0300
|
||||
--- linux-2.6.37/block/blk-map.c 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/block/blk-map.c 2011-05-17 21:15:14.329812999 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -274,6 +276,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -274,6 +276,339 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -349,8 +351,8 @@ diff -upkr linux-2.6.37/block/blk-map.c linux-2.6.37/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.37/include/linux/blkdev.h linux-2.6.37/include/linux/blkdev.h
|
||||
--- linux-2.6.37/include/linux/blkdev.h 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/include/linux/blkdev.h 2011-01-08 16:45:54.350430208 +0300
|
||||
--- linux-2.6.37/include/linux/blkdev.h 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/include/linux/blkdev.h 2011-01-08 08:45:54.350430208 -0500
|
||||
@@ -592,6 +592,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -371,8 +373,8 @@ diff -upkr linux-2.6.37/include/linux/blkdev.h linux-2.6.37/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.37/include/linux/scatterlist.h linux-2.6.37/include/linux/scatterlist.h
|
||||
--- linux-2.6.37/include/linux/scatterlist.h 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/include/linux/scatterlist.h 2011-01-08 16:45:54.354431761 +0300
|
||||
--- linux-2.6.37/include/linux/scatterlist.h 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/include/linux/scatterlist.h 2011-01-08 08:45:54.354431761 -0500
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -393,8 +395,8 @@ diff -upkr linux-2.6.37/include/linux/scatterlist.h linux-2.6.37/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.37/lib/scatterlist.c linux-2.6.37/lib/scatterlist.c
|
||||
--- linux-2.6.37/lib/scatterlist.c 2011-01-05 03:50:19.000000000 +0300
|
||||
+++ linux-2.6.37/lib/scatterlist.c 2011-01-08 16:45:54.401930472 +0300
|
||||
--- linux-2.6.37/lib/scatterlist.c 2011-01-04 19:50:19.000000000 -0500
|
||||
+++ linux-2.6.37/lib/scatterlist.c 2011-01-08 08:45:54.401930472 -0500
|
||||
@@ -517,3 +517,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
@@ -528,4 +530,3 @@ diff -upkr linux-2.6.37/lib/scatterlist.c linux-2.6.37/lib/scatterlist.c
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(sg_copy);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
--- linux-2.6.38/block/blk-map.c 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/block/blk-map.c 2011-03-18 17:46:41.853627967 +0300
|
||||
--- linux-2.6.38/block/blk-map.c 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/block/blk-map.c 2011-05-11 22:07:37.589813000 -0400
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bio.h>
|
||||
@@ -10,7 +10,7 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
#include <scsi/sg.h> /* for struct sg_iovec */
|
||||
|
||||
#include "blk.h"
|
||||
@@ -274,6 +276,337 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
@@ -274,6 +276,339 @@ int blk_rq_unmap_user(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL(blk_rq_unmap_user);
|
||||
|
||||
@@ -22,7 +22,18 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+
|
||||
+static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw)
|
||||
+{
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+ struct sg_table *sgt = &bw->sg_table;
|
||||
+ struct scatterlist *sg;
|
||||
+ int i;
|
||||
+
|
||||
+ for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+
|
||||
+ sg_free_table(sgt);
|
||||
+ kfree(bw);
|
||||
+ return;
|
||||
+}
|
||||
@@ -76,7 +87,7 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+
|
||||
+ res = sg_alloc_table(&bw->sg_table, new_sgl_nents, gfp);
|
||||
+ if (res != 0)
|
||||
+ goto out_free_bw;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ new_sgl = bw->sg_table.sgl;
|
||||
+
|
||||
@@ -85,7 +96,7 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+
|
||||
+ pg = alloc_page(page_gfp);
|
||||
+ if (pg == NULL)
|
||||
+ goto err_free_new_sgl;
|
||||
+ goto err_free;
|
||||
+
|
||||
+ sg_assign_page(sg, pg);
|
||||
+ sg->length = min_t(size_t, PAGE_SIZE, len);
|
||||
@@ -113,17 +124,8 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
+out:
|
||||
+ return res;
|
||||
+
|
||||
+err_free_new_sgl:
|
||||
+ for_each_sg(new_sgl, sg, new_sgl_nents, i) {
|
||||
+ struct page *pg = sg_page(sg);
|
||||
+ if (pg == NULL)
|
||||
+ break;
|
||||
+ __free_page(pg);
|
||||
+ }
|
||||
+ sg_free_table(&bw->sg_table);
|
||||
+
|
||||
+out_free_bw:
|
||||
+ kfree(bw);
|
||||
+err_free:
|
||||
+ blk_free_kern_sg_work(bw);
|
||||
+ res = -ENOMEM;
|
||||
+ goto out;
|
||||
+}
|
||||
@@ -349,8 +351,8 @@ diff -upkr linux-2.6.38/block/blk-map.c linux-2.6.38/block/blk-map.c
|
||||
* blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
|
||||
* @q: request queue where request should be inserted
|
||||
diff -upkr linux-2.6.38/include/linux/blkdev.h linux-2.6.38/include/linux/blkdev.h
|
||||
--- linux-2.6.38/include/linux/blkdev.h 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/include/linux/blkdev.h 2011-03-18 17:19:00.442412966 +0300
|
||||
--- linux-2.6.38/include/linux/blkdev.h 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/include/linux/blkdev.h 2011-03-18 10:19:00.000000000 -0400
|
||||
@@ -593,6 +593,8 @@ extern unsigned long blk_max_low_pfn, bl
|
||||
#define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
|
||||
#define BLK_MIN_SG_TIMEOUT (7 * HZ)
|
||||
@@ -371,8 +373,8 @@ diff -upkr linux-2.6.38/include/linux/blkdev.h linux-2.6.38/include/linux/blkdev
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
|
||||
diff -upkr linux-2.6.38/include/linux/scatterlist.h linux-2.6.38/include/linux/scatterlist.h
|
||||
--- linux-2.6.38/include/linux/scatterlist.h 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/include/linux/scatterlist.h 2011-03-18 17:19:00.446410968 +0300
|
||||
--- linux-2.6.38/include/linux/scatterlist.h 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/include/linux/scatterlist.h 2011-03-18 10:19:00.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
@@ -393,8 +395,8 @@ diff -upkr linux-2.6.38/include/linux/scatterlist.h linux-2.6.38/include/linux/s
|
||||
* Maximum number of entries that will be allocated in one piece, if
|
||||
* a list larger than this is required then chaining will be utilized.
|
||||
diff -upkr linux-2.6.38/lib/scatterlist.c linux-2.6.38/lib/scatterlist.c
|
||||
--- linux-2.6.38/lib/scatterlist.c 2011-03-15 04:20:32.000000000 +0300
|
||||
+++ linux-2.6.38/lib/scatterlist.c 2011-03-18 17:46:41.853627967 +0300
|
||||
--- linux-2.6.38/lib/scatterlist.c 2011-03-14 21:20:32.000000000 -0400
|
||||
+++ linux-2.6.38/lib/scatterlist.c 2011-03-18 10:46:41.000000000 -0400
|
||||
@@ -517,3 +517,132 @@ size_t sg_copy_to_buffer(struct scatterl
|
||||
return sg_copy_buffer(sgl, nents, buf, buflen, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user