Skip to content

Commit 5049ff4

Browse files
author
Darrick J. Wong
committed
xfs: create a helper to decide if a file mapping targets the rt volume
Create a helper so that we can stop open-coding this decision everywhere. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 0dc63c8 commit 5049ff4

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4913,7 +4913,7 @@ xfs_bmap_del_extent_delay(
49134913

49144914
XFS_STATS_INC(mp, xs_del_exlist);
49154915

4916-
isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip);
4916+
isrt = xfs_ifork_is_realtime(ip, whichfork);
49174917
del_endoff = del->br_startoff + del->br_blockcount;
49184918
got_endoff = got->br_startoff + got->br_blockcount;
49194919
da_old = startblockval(got->br_startblock);
@@ -5149,7 +5149,7 @@ xfs_bmap_del_extent_real(
51495149
return -ENOSPC;
51505150

51515151
*logflagsp = XFS_ILOG_CORE;
5152-
if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) {
5152+
if (xfs_ifork_is_realtime(ip, whichfork)) {
51535153
if (!(bflags & XFS_BMAPI_REMAP)) {
51545154
error = xfs_rtfree_blocks(tp, del->br_startblock,
51555155
del->br_blockcount);
@@ -5396,7 +5396,7 @@ __xfs_bunmapi(
53965396
return 0;
53975397
}
53985398
XFS_STATS_INC(mp, xs_blk_unmap);
5399-
isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip);
5399+
isrt = xfs_ifork_is_realtime(ip, whichfork);
54005400
end = start + len;
54015401

54025402
if (!xfs_iext_lookup_extent_before(ip, ifp, &end, &icur, &got)) {

fs/xfs/libxfs/xfs_inode_fork.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,3 +813,12 @@ xfs_iext_count_upgrade(
813813

814814
return 0;
815815
}
816+
817+
/* Decide if a file mapping is on the realtime device or not. */
818+
bool
819+
xfs_ifork_is_realtime(
820+
struct xfs_inode *ip,
821+
int whichfork)
822+
{
823+
return XFS_IS_REALTIME_INODE(ip) && whichfork != XFS_ATTR_FORK;
824+
}

fs/xfs/libxfs/xfs_inode_fork.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ int xfs_iext_count_may_overflow(struct xfs_inode *ip, int whichfork,
260260
int nr_to_add);
261261
int xfs_iext_count_upgrade(struct xfs_trans *tp, struct xfs_inode *ip,
262262
uint nr_to_add);
263+
bool xfs_ifork_is_realtime(struct xfs_inode *ip, int whichfork);
263264

264265
/* returns true if the fork has extents but they are not read in yet. */
265266
static inline bool xfs_need_iread_extents(const struct xfs_ifork *ifp)

fs/xfs/scrub/bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ xchk_bmap(
924924
if (!ifp)
925925
return -ENOENT;
926926

927-
info.is_rt = whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip);
927+
info.is_rt = xfs_ifork_is_realtime(ip, whichfork);
928928
info.whichfork = whichfork;
929929
info.is_shared = whichfork == XFS_DATA_FORK && xfs_is_reflink_inode(ip);
930930
info.sc = sc;

0 commit comments

Comments
 (0)