• Tejun Heo's avatar
    sg: reimplement sg mapping iterator · 137d3edb
    Tejun Heo authored
    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: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
    137d3edb
scatterlist.c 11.7 KB