1
0
Fork 0

kernel/kfifo.c: add handling of chained scatterlists

The current kfifo scatterlist implementation will not work with chained
scatterlists.  It assumes that struct scatterlist arrays are allocated
contiguously, which is not the case when chained scatterlists (struct
sg_table) are in use.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
hifive-unleashed-5.1
Stefani Seibold 2010-08-11 14:17:27 -07:00 committed by Linus Torvalds
parent 5af568cbd5
commit d78a3eda69
1 changed files with 6 additions and 7 deletions

View File

@ -333,17 +333,16 @@ static int setup_sgl_buf(struct scatterlist *sgl, void *buf,
buf += PAGE_SIZE;
npage = virt_to_page(buf);
if (page_to_phys(page) != page_to_phys(npage) - l) {
sgl->page_link = 0;
sg_set_page(sgl++, page, l - off, off);
if (++n == nents)
sg_set_page(sgl, page, l - off, off);
sgl = sg_next(sgl);
if (++n == nents || sgl == NULL)
return n;
page = npage;
len -= l - off;
l = off = 0;
}
}
sgl->page_link = 0;
sg_set_page(sgl++, page, len, off);
sg_set_page(sgl, page, len, off);
return n + 1;
}