sg: reimplement sg mapping iterator
authorTejun Heo <htejun@gmail.com>
Sat, 19 Jul 2008 14:03:35 +0000 (23:03 +0900)
committerPierre Ossman <drzeus@drzeus.cx>
Wed, 23 Jul 2008 12:42:09 +0000 (14:42 +0200)
commit137d3edb48425f82a6a4226b664f90ed5e42eea5
tree0fc5845a0082686f0c5ebc87c9e48ac34e6265b7
parent60c9c7b1d91396f511e55a2a5be13d148dcf66ff
sg: reimplement sg mapping iterator

This is alternative implementation of sg content iterator introduced
by commit 83e7d317... from Pierre Ossman in next-20080716.  As there's
already an sg iterator which iterates over sg entries themselves, name
this sg_mapping_iterator.

Slightly edited description from the original implementation follows.

Iteration over a sg list is not that trivial when you take into
account that memory pages might have to be mapped before being used.
Unfortunately, that means that some parts of the kernel restrict
themselves to directly accesible memory just to not have to deal with
the mess.

This patch adds a simple iterator system that allows any code to
easily traverse an sg list and not have to deal with all the details.
The user can decide to consume part of the iteration.  Also, iteration
can be stopped and resumed later if releasing the kmap between
iteration steps is necessary.  These features are useful to implement
piecemeal sg copying for interrupt drive PIO for example.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
include/linux/scatterlist.h
lib/scatterlist.c