• Home
  • Raw
  • Download

Lines Matching refs:sg

23 struct scatterlist *sg_next(struct scatterlist *sg)  in sg_next()  argument
25 if (sg_is_last(sg)) in sg_next()
28 sg++; in sg_next()
29 if (unlikely(sg_is_chain(sg))) in sg_next()
30 sg = sg_chain_ptr(sg); in sg_next()
32 return sg; in sg_next()
45 int sg_nents(struct scatterlist *sg) in sg_nents() argument
48 for (nents = 0; sg; sg = sg_next(sg)) in sg_nents()
68 int sg_nents_for_len(struct scatterlist *sg, u64 len) in sg_nents_for_len() argument
76 for (nents = 0, total = 0; sg; sg = sg_next(sg)) { in sg_nents_for_len()
78 total += sg->length; in sg_nents_for_len()
103 struct scatterlist *sg, *ret = NULL; in sg_last() local
106 for_each_sg(sgl, sg, nents, i) in sg_last()
107 ret = sg; in sg_last()
138 void sg_init_one(struct scatterlist *sg, const void *buf, unsigned int buflen) in sg_init_one() argument
140 sg_init_table(sg, 1); in sg_init_one()
141 sg_set_buf(sg, buf, buflen); in sg_init_one()
169 static void sg_kfree(struct scatterlist *sg, unsigned int nents) in sg_kfree() argument
172 kmemleak_free(sg); in sg_kfree()
173 free_page((unsigned long) sg); in sg_kfree()
175 kfree(sg); in sg_kfree()
271 struct scatterlist *sg, *prv; in __sg_alloc_table() local
299 sg = first_chunk; in __sg_alloc_table()
302 sg = alloc_fn(alloc_size, gfp_mask); in __sg_alloc_table()
304 if (unlikely(!sg)) { in __sg_alloc_table()
317 sg_init_table(sg, alloc_size); in __sg_alloc_table()
325 sg_chain(prv, prv_max_ents, sg); in __sg_alloc_table()
327 table->sgl = sg; in __sg_alloc_table()
333 sg_mark_end(&sg[sg_size - 1]); in __sg_alloc_table()
335 prv = sg; in __sg_alloc_table()
571 struct scatterlist *sgl, *sg; in sgl_alloc_order() local
593 sg = sgl; in sgl_alloc_order()
602 sg_set_page(sg, page, elem_len, 0); in sgl_alloc_order()
604 sg = sg_next(sg); in sgl_alloc_order()
643 struct scatterlist *sg; in sgl_free_n_order() local
647 for_each_sg(sgl, sg, nents, i) { in sgl_free_n_order()
648 if (!sg) in sgl_free_n_order()
650 page = sg_page(sg); in sgl_free_n_order()
688 piter->sg = sglist; in __sg_page_iter_start()
693 static int sg_page_count(struct scatterlist *sg) in sg_page_count() argument
695 return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT; in sg_page_count()
700 if (!piter->__nents || !piter->sg) in __sg_page_iter_next()
706 while (piter->sg_pgoffset >= sg_page_count(piter->sg)) { in __sg_page_iter_next()
707 piter->sg_pgoffset -= sg_page_count(piter->sg); in __sg_page_iter_next()
708 piter->sg = sg_next(piter->sg); in __sg_page_iter_next()
709 if (!--piter->__nents || !piter->sg) in __sg_page_iter_next()
717 static int sg_dma_page_count(struct scatterlist *sg) in sg_dma_page_count() argument
719 return PAGE_ALIGN(sg->offset + sg_dma_len(sg)) >> PAGE_SHIFT; in sg_dma_page_count()
726 if (!piter->__nents || !piter->sg) in __sg_page_iter_dma_next()
732 while (piter->sg_pgoffset >= sg_dma_page_count(piter->sg)) { in __sg_page_iter_dma_next()
733 piter->sg_pgoffset -= sg_dma_page_count(piter->sg); in __sg_page_iter_dma_next()
734 piter->sg = sg_next(piter->sg); in __sg_page_iter_dma_next()
735 if (!--piter->__nents || !piter->sg) in __sg_page_iter_dma_next()
769 struct scatterlist *sg; in sg_miter_get_next_page() local
774 sg = miter->piter.sg; in sg_miter_get_next_page()
776 miter->__offset = miter->piter.sg_pgoffset ? 0 : sg->offset; in sg_miter_get_next_page()
779 miter->__remaining = sg->offset + sg->length - in sg_miter_get_next_page()