diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-12-18 15:00:05 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-01-13 13:11:46 -0500 |
commit | bf322d983e540f66517db85b6870017613bb1e8d (patch) | |
tree | f01eb47527c526d3654746db1f2533eae8cfe050 /fs | |
parent | 673e8e597c06eb81954bf21a10f5cce74a1de8f1 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 9afa282aa937..a27a44659da6 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -57,26 +57,26 @@ xfs_iomap_eof_align_last_fsb( | |||
57 | xfs_fileoff_t *last_fsb) | 57 | xfs_fileoff_t *last_fsb) |
58 | { | 58 | { |
59 | xfs_fileoff_t new_last_fsb = 0; | 59 | xfs_fileoff_t new_last_fsb = 0; |
60 | xfs_extlen_t align; | 60 | xfs_extlen_t align = 0; |
61 | int eof, error; | 61 | int eof, error; |
62 | 62 | ||
63 | if (XFS_IS_REALTIME_INODE(ip)) | 63 | if (!XFS_IS_REALTIME_INODE(ip)) { |
64 | ; | 64 | /* |
65 | /* | 65 | * Round up the allocation request to a stripe unit |
66 | * If mounted with the "-o swalloc" option, roundup the allocation | 66 | * (m_dalign) boundary if the file size is >= stripe unit |
67 | * request to a stripe width boundary if the file size is >= | 67 | * size, and we are allocating past the allocation eof. |
68 | * stripe width and we are allocating past the allocation eof. | 68 | * |
69 | */ | 69 | * If mounted with the "-o swalloc" option the alignment is |
70 | else if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC) && | 70 | * increased from the strip unit size to the stripe width. |
71 | (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_swidth))) | 71 | */ |
72 | new_last_fsb = roundup_64(*last_fsb, mp->m_swidth); | 72 | if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC)) |
73 | /* | 73 | align = mp->m_swidth; |
74 | * Roundup the allocation request to a stripe unit (m_dalign) boundary | 74 | else if (mp->m_dalign) |
75 | * if the file size is >= stripe unit size, and we are allocating past | 75 | align = mp->m_dalign; |
76 | * the allocation eof. | 76 | |
77 | */ | 77 | if (align && ip->i_size >= XFS_FSB_TO_B(mp, align)) |
78 | else if (mp->m_dalign && (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_dalign))) | 78 | new_last_fsb = roundup_64(*last_fsb, align); |
79 | new_last_fsb = roundup_64(*last_fsb, mp->m_dalign); | 79 | } |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Always round up the allocation request to an extent boundary | 82 | * Always round up the allocation request to an extent boundary |