xfs: cleanup xfs_iomap_eof_align_last_fsb

Replace the nasty if, else if, elseif condition with more natural C flow
that expressed the logic we want here better.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
This commit is contained in:
Christoph Hellwig
2011-12-18 20:00:05 +00:00
committed by Ben Myers
parent 673e8e597c
commit bf322d983e

View File

@@ -57,26 +57,26 @@ xfs_iomap_eof_align_last_fsb(
xfs_fileoff_t *last_fsb) xfs_fileoff_t *last_fsb)
{ {
xfs_fileoff_t new_last_fsb = 0; xfs_fileoff_t new_last_fsb = 0;
xfs_extlen_t align; xfs_extlen_t align = 0;
int eof, error; int eof, error;
if (XFS_IS_REALTIME_INODE(ip)) if (!XFS_IS_REALTIME_INODE(ip)) {
;
/* /*
* If mounted with the "-o swalloc" option, roundup the allocation * Round up the allocation request to a stripe unit
* request to a stripe width boundary if the file size is >= * (m_dalign) boundary if the file size is >= stripe unit
* stripe width and we are allocating past the allocation eof. * size, and we are allocating past the allocation eof.
*
* If mounted with the "-o swalloc" option the alignment is
* increased from the strip unit size to the stripe width.
*/ */
else if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC) && if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
(ip->i_size >= XFS_FSB_TO_B(mp, mp->m_swidth))) align = mp->m_swidth;
new_last_fsb = roundup_64(*last_fsb, mp->m_swidth); else if (mp->m_dalign)
/* align = mp->m_dalign;
* Roundup the allocation request to a stripe unit (m_dalign) boundary
* if the file size is >= stripe unit size, and we are allocating past if (align && ip->i_size >= XFS_FSB_TO_B(mp, align))
* the allocation eof. new_last_fsb = roundup_64(*last_fsb, align);
*/ }
else if (mp->m_dalign && (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_dalign)))
new_last_fsb = roundup_64(*last_fsb, mp->m_dalign);
/* /*
* Always round up the allocation request to an extent boundary * Always round up the allocation request to an extent boundary