From 93faefd26e86a5fa7c5462f6e819b66c4c73ef8f Mon Sep 17 00:00:00 2001 From: Nils Faerber Date: Tue, 11 Jan 2011 16:45:25 +0100 Subject: [PATCH] Further revert --- include/linux/blkdev.h | 5 -- include/linux/scatterlist.h | 5 -- lib/scatterlist.c | 129 ------------------------------------ 3 files changed, 139 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index b22758f7825..36ab42c9bb9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -592,8 +592,6 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn; #define BLK_DEFAULT_SG_TIMEOUT (60 * HZ) #define BLK_MIN_SG_TIMEOUT (7 * HZ) -#define SCSI_EXEC_REQ_FIFO_DEFINED - #ifdef CONFIG_BOUNCE extern int init_emergency_isa_pool(void); extern void blk_queue_bounce(struct request_queue *q, struct bio **bio); @@ -711,9 +709,6 @@ extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, uns extern int blk_rq_map_user_iov(struct request_queue *, struct request *, struct rq_map_data *, struct sg_iovec *, int, unsigned int, gfp_t); -extern int blk_rq_map_kern_sg(struct request *rq, struct scatterlist *sgl, - int nents, gfp_t gfp); -extern void blk_rq_unmap_kern_sg(struct request *rq, int err); extern int blk_execute_rq(struct request_queue *, struct gendisk *, struct request *, int); extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 01779961c40..9aaf5bfdad1 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -219,10 +218,6 @@ size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, size_t buflen); -int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg, - int nents_to_copy, size_t copy_len, - enum km_type d_km_type, enum km_type s_km_type); - /* * Maximum number of entries that will be allocated in one piece, if * a list larger than this is required then chaining will be utilized. diff --git a/lib/scatterlist.c b/lib/scatterlist.c index caf58c49d88..4ceb05d772a 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -517,132 +517,3 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, return sg_copy_buffer(sgl, nents, buf, buflen, 1); } EXPORT_SYMBOL(sg_copy_to_buffer); - -/* - * Can switch to the next dst_sg element, so, to copy to strictly only - * one dst_sg element, it must be either last in the chain, or - * copy_len == dst_sg->length. - */ -static int sg_copy_elem(struct scatterlist **pdst_sg, size_t *pdst_len, - size_t *pdst_offs, struct scatterlist *src_sg, - size_t copy_len, - enum km_type d_km_type, enum km_type s_km_type) -{ - int res = 0; - struct scatterlist *dst_sg; - size_t src_len, dst_len, src_offs, dst_offs; - struct page *src_page, *dst_page; - - dst_sg = *pdst_sg; - dst_len = *pdst_len; - dst_offs = *pdst_offs; - dst_page = sg_page(dst_sg); - - src_page = sg_page(src_sg); - src_len = src_sg->length; - src_offs = src_sg->offset; - - do { - void *saddr, *daddr; - size_t n; - - saddr = kmap_atomic(src_page + - (src_offs >> PAGE_SHIFT), s_km_type) + - (src_offs & ~PAGE_MASK); - daddr = kmap_atomic(dst_page + - (dst_offs >> PAGE_SHIFT), d_km_type) + - (dst_offs & ~PAGE_MASK); - - if (((src_offs & ~PAGE_MASK) == 0) && - ((dst_offs & ~PAGE_MASK) == 0) && - (src_len >= PAGE_SIZE) && (dst_len >= PAGE_SIZE) && - (copy_len >= PAGE_SIZE)) { - copy_page(daddr, saddr); - n = PAGE_SIZE; - } else { - n = min_t(size_t, PAGE_SIZE - (dst_offs & ~PAGE_MASK), - PAGE_SIZE - (src_offs & ~PAGE_MASK)); - n = min(n, src_len); - n = min(n, dst_len); - n = min_t(size_t, n, copy_len); - memcpy(daddr, saddr, n); - } - dst_offs += n; - src_offs += n; - - kunmap_atomic(saddr, s_km_type); - kunmap_atomic(daddr, d_km_type); - - res += n; - copy_len -= n; - if (copy_len == 0) - goto out; - - src_len -= n; - dst_len -= n; - if (dst_len == 0) { - dst_sg = sg_next(dst_sg); - if (dst_sg == NULL) - goto out; - dst_page = sg_page(dst_sg); - dst_len = dst_sg->length; - dst_offs = dst_sg->offset; - } - } while (src_len > 0); - -out: - *pdst_sg = dst_sg; - *pdst_len = dst_len; - *pdst_offs = dst_offs; - return res; -} - -/** - * sg_copy - copy one SG vector to another - * @dst_sg: destination SG - * @src_sg: source SG - * @nents_to_copy: maximum number of entries to copy - * @copy_len: maximum amount of data to copy. If 0, then copy all. - * @d_km_type: kmap_atomic type for the destination SG - * @s_km_type: kmap_atomic type for the source SG - * - * Description: - * Data from the source SG vector will be copied to the destination SG - * vector. End of the vectors will be determined by sg_next() returning - * NULL. Returns number of bytes copied. - */ -int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg, - int nents_to_copy, size_t copy_len, - enum km_type d_km_type, enum km_type s_km_type) -{ - int res = 0; - size_t dst_len, dst_offs; - - if (copy_len == 0) - copy_len = 0x7FFFFFFF; /* copy all */ - - if (nents_to_copy == 0) - nents_to_copy = 0x7FFFFFFF; /* copy all */ - - dst_len = dst_sg->length; - dst_offs = dst_sg->offset; - - do { - int copied = sg_copy_elem(&dst_sg, &dst_len, &dst_offs, - src_sg, copy_len, d_km_type, s_km_type); - copy_len -= copied; - res += copied; - if ((copy_len == 0) || (dst_sg == NULL)) - goto out; - - nents_to_copy--; - if (nents_to_copy == 0) - goto out; - - src_sg = sg_next(src_sg); - } while (src_sg != NULL); - -out: - return res; -} -EXPORT_SYMBOL(sg_copy); -- 2.39.2