Commit bf322d98 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Ben Myers

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 673e8e59
...@@ -57,26 +57,26 @@ xfs_iomap_eof_align_last_fsb( ...@@ -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)) {
; /*
/* * Round up the allocation request to a stripe unit
* If mounted with the "-o swalloc" option, roundup the allocation * (m_dalign) boundary if the file size is >= stripe unit
* request to a stripe width boundary if the file size is >= * size, and we are allocating past the allocation eof.
* stripe width and we are allocating past the allocation eof. *
*/ * If mounted with the "-o swalloc" option the alignment is
else if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC) && * increased from the strip unit size to the stripe width.
(ip->i_size >= XFS_FSB_TO_B(mp, mp->m_swidth))) */
new_last_fsb = roundup_64(*last_fsb, mp->m_swidth); if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
/* align = mp->m_swidth;
* Roundup the allocation request to a stripe unit (m_dalign) boundary else if (mp->m_dalign)
* if the file size is >= stripe unit size, and we are allocating past align = mp->m_dalign;
* the allocation eof.
*/ if (align && ip->i_size >= XFS_FSB_TO_B(mp, align))
else if (mp->m_dalign && (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_dalign))) new_last_fsb = roundup_64(*last_fsb, align);
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment