Skip to content

Commit de94a2e

Browse files
henryZedchinner
authored andcommitted
xfs: simplify if-else condition in xfs_validate_new_dalign
"else" is not generally useful after a return, so remove them which makes if condition a bit more clear. There is no logical changes. Signed-off-by: Zeng Heng <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent 92b4076 commit de94a2e

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

fs/xfs/xfs_mount.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -300,26 +300,28 @@ xfs_validate_new_dalign(
300300
"alignment check failed: sunit/swidth vs. blocksize(%d)",
301301
mp->m_sb.sb_blocksize);
302302
return -EINVAL;
303-
} else {
304-
/*
305-
* Convert the stripe unit and width to FSBs.
306-
*/
307-
mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
308-
if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) {
309-
xfs_warn(mp,
310-
"alignment check failed: sunit/swidth vs. agsize(%d)",
311-
mp->m_sb.sb_agblocks);
312-
return -EINVAL;
313-
} else if (mp->m_dalign) {
314-
mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
315-
} else {
316-
xfs_warn(mp,
317-
"alignment check failed: sunit(%d) less than bsize(%d)",
318-
mp->m_dalign, mp->m_sb.sb_blocksize);
319-
return -EINVAL;
320-
}
321303
}
322304

305+
/*
306+
* Convert the stripe unit and width to FSBs.
307+
*/
308+
mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
309+
if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) {
310+
xfs_warn(mp,
311+
"alignment check failed: sunit/swidth vs. agsize(%d)",
312+
mp->m_sb.sb_agblocks);
313+
return -EINVAL;
314+
}
315+
316+
if (!mp->m_dalign) {
317+
xfs_warn(mp,
318+
"alignment check failed: sunit(%d) less than bsize(%d)",
319+
mp->m_dalign, mp->m_sb.sb_blocksize);
320+
return -EINVAL;
321+
}
322+
323+
mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
324+
323325
if (!xfs_has_dalign(mp)) {
324326
xfs_warn(mp,
325327
"cannot change alignment: superblock does not support data alignment");

0 commit comments

Comments
 (0)