From 8d32ad63a1cb554a66e3c578b6f9dfc43732782b Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sat, 16 Feb 2013 04:03:58 +0000 Subject: [PATCH] Performance micro-optimization: use sg_next_inline() instead of sg_next() Now we have sg_next_inline(), so let's use it everywhere. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4761 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 6 ------ scst/src/scst_lib.c | 4 ++-- srpt/src/ib_srpt.c | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/scst/include/scst.h b/scst/include/scst.h index 1c9bca356..f3c6f062c 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -3737,12 +3737,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page, sg->length = len; } -static inline struct scatterlist *sg_next(struct scatterlist *sg) -{ - sg++; - return sg; -} - #ifndef for_each_sg /* See also commit 96b418c960af0d5c7185ff5c4af9376eb37ac9d3 */ #define for_each_sg(sglist, sg, nr, __i) \ diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index fd34772de..e04dbd1fb 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -5768,7 +5768,7 @@ static int sg_copy_elem(struct scatterlist **pdst_sg, size_t *pdst_len, src_len -= n; dst_len -= n; if (dst_len == 0) { - dst_sg = sg_next(dst_sg); + dst_sg = sg_next_inline(dst_sg); if (dst_sg == NULL) goto out; dst_page = sg_page(dst_sg); @@ -5834,7 +5834,7 @@ static int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg, if (nents_to_copy == 0) goto out; - src_sg = sg_next(src_sg); + src_sg = sg_next_inline(src_sg); } while (src_sg != NULL); out: diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index a5e0affd2..553a355ff 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3001,7 +3001,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, if (tsize > 0) { ++j; if (j < count) { - cur_sg = sg_next(cur_sg); + cur_sg = sg_next_inline(cur_sg); dma_len = sg_dma_len(cur_sg); } } @@ -3056,7 +3056,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, if (tsize > 0) { ++j; if (j < count) { - cur_sg = sg_next(cur_sg); + cur_sg = sg_next_inline(cur_sg); dma_len = sg_dma_len(cur_sg); dma_addr = sg_dma_address(cur_sg);