• Martin K. Petersen's avatar
    block: Backport of various I/O topology fixes from 2.6.33 and 2.6.34 · 9b2ff973
    Martin K. Petersen authored
    block: Backport of various I/O topology fixes from 2.6.33 and 2.6.34
    
    The stacking code incorrectly scaled up the data offset in some cases
    causing misaligned devices to report alignment.  Rewrite the stacking
    algorithm to remedy this.  
    
    (Upstream commit 9504e086)
    
    The top device misalignment flag would not be set if the added bottom
    device was already misaligned as opposed to causing a stacking failure.
        
    Also massage the reporting so that an error is only returned if adding
    the bottom device caused the misalignment.  I.e. don't return an error
    if the top is already flagged as misaligned.
    
    (Upstream commit fe0b393f
    
    )
    
    
    lcm() was defined to take integer-sized arguments.  The supplied
    arguments are multiplied, however, causing us to overflow given
    sufficiently large input.  That in turn led to incorrect optimal I/O
    size reporting in some cases.  Switch lcm() over to unsigned long
    similar to gcd() and move the function from blk-settings.c to lib.
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    Reviewed-by: default avatarMike Snitzer <snitzer@redhat.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    9b2ff973
blk-settings.c 24.9 KB