xfs: swalloc doesn't align allocations properly
authorDave Chinner <dchinner@redhat.com>
Thu, 12 Dec 2013 05:34:36 +0000 (16:34 +1100)
committerBen Myers <bpm@sgi.com>
Tue, 17 Dec 2013 15:30:12 +0000 (09:30 -0600)
commit33177f05364c6cd13b06d0f3500dad07cf4647c2
tree53737ce77a1e4bef9bbe5b38d4d6ec06d6f60da0
parent83a0adc3f93aae4ab9c59113e3145c7bdb2b4a8c
xfs: swalloc doesn't align allocations properly

When swalloc is specified as a mount option, allocations are
supposed to be aligned to the stripe width rather than the stripe
unit of the underlying filesystem. However, it does not do this.

What the implementation does is round up the allocation size to a
stripe width, hence ensuring that all allocations span a full stripe
width. It does not, however, ensure that that allocation is aligned
to a stripe width, and hence the allocations can span multiple
underlying stripes and so still see RMW cycles for things like
direct IO on MD RAID.

So, if the swalloc mount option is set, change the allocation
alignment in xfs_bmap_btalloc() to use the stripe width rather than
the stripe unit.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_bmap.c