block: Backport of various I/O topology fixes from 2.6.33 and 2.6.34
commit9b2ff973b075293e16e148e57a1856498e23e95d
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 17 Mar 2010 00:30:01 +0000 (16 20:30 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 22:58:56 +0000 (1 15:58 -0700)
tree2aac23425e42c6ac2f5949aaa4347c141bb17373
parente548510b30a5b74f9be9c501d955ca90c7d1a8d0
block: Backport of various I/O topology fixes from 2.6.33 and 2.6.34

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 9504e0864b58b4a304820dcf3755f1da80d5e72f)

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 fe0b393f2c0a0d23a9bc9ed7dc51a1ee511098bd)

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: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
block/blk-settings.c
include/linux/lcm.h [new file with mode: 0644]
lib/Makefile
lib/lcm.c [new file with mode: 0644]