• T
    ide-tape: use single continuous buffer · 7b13354e
    Tejun Heo 提交于
    Impact: simpler buffer allocation and handling, kills OOM, fix DMA transfers
    
    ide-tape has its own multiple buffer mechanism using struct
    idetape_bh.  It allocates buffer with decreasing order-of-two
    allocations so that it results in minimum number of segments.
    However, the implementation is quite complex and works in a way that
    no other block or ide driver works necessitating a lot of special case
    handling.
    
    The benefit this complex allocation scheme brings is questionable as
    PIO or DMA the number of segments (16 maximum) doesn't make any
    noticeable difference and it also doesn't negate the need for multiple
    order allocation which can fail under memory pressure or high
    fragmentation although it does lower the highest order necessary by
    one when the buffer size isn't power of two.
    
    As the first step to remove the custom buffer management, this patch
    makes ide-tape allocate single continous buffer.  The maximum order is
    four.  I doubt the change would cause any trouble but if it ever
    matters, it should be converted to regular sg mechanism like everyone
    else and even in that case dropping custom buffer handling and moving
    to standard mechanism first make sense as an intermediate step.
    
    This patch makes the first bh to contain the whole buffer and drops
    multi bh handling code.  Following patches will make further changes.
    
    This patch has the side effect of killing OOM triggered by allocation
    path and fixing DMA transfers.  Previously, bug in alloc path
    triggered OOM on command issue and commands were passed to DMA engine
    without DMA-mapping all the segments.
    Signed-off-by: NTejun Heo <tj@kernel.org>
    7b13354e
ide-tape.c 62.9 KB