diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2020-12-04 13:41:56 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-12-06 15:17:19 -0800 |
commit | ddf11296c97fc39f1b53428e0d343f52fb89587f (patch) | |
tree | c1f136f87bd3d00daac36d61db4eabfe576d5e3f /fs/xfs/libxfs/xfs_types.c | |
parent | fdf37f3742cd561967f02d81d45a9a3fcc3153ef (diff) |
xfs: refactor realtime volume extent validation
Refactor all the open-coded validation of realtime device extents into a
single helper.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_types.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_types.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_types.c b/fs/xfs/libxfs/xfs_types.c index b74866dbea94..7b310eb296b7 100644 --- a/fs/xfs/libxfs/xfs_types.c +++ b/fs/xfs/libxfs/xfs_types.c @@ -198,6 +198,22 @@ xfs_verify_rtbno( return rtbno < mp->m_sb.sb_rblocks; } +/* Verify that a realtime device extent is fully contained inside the volume. */ +bool +xfs_verify_rtext( + struct xfs_mount *mp, + xfs_rtblock_t rtbno, + xfs_rtblock_t len) +{ + if (rtbno + len <= rtbno) + return false; + + if (!xfs_verify_rtbno(mp, rtbno)) + return false; + + return xfs_verify_rtbno(mp, rtbno + len - 1); +} + /* Calculate the range of valid icount values. */ void xfs_icount_range( |