diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-01-05 17:45:04 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-03-25 17:08:25 -0700 |
commit | 11cb8ced0b2fdf0be0cc133edbe70654663fd012 (patch) | |
tree | a7eb49d2e309e9f532f8209b0c9ad6723e2b5a6a | |
parent | e72bbdd14d419ff87df748662d204ba717805965 (diff) |
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>
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 6 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_fork.c | 9 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_fork.h | 1 | ||||
-rw-r--r-- | fs/xfs/scrub/bmap.c | 4 | ||||
-rw-r--r-- | fs/xfs/scrub/rmap_repair.c | 12 |
5 files changed, 17 insertions, 15 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index edfc48535a9e..3565e2800ea1 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -4973,7 +4973,7 @@ xfs_bmap_del_extent_delay( XFS_STATS_INC(mp, xs_del_exlist); - isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip); + isrt = xfs_ifork_is_realtime(ip, whichfork); del_endoff = del->br_startoff + del->br_blockcount; got_endoff = got->br_startoff + got->br_blockcount; da_old = startblockval(got->br_startblock); @@ -5213,7 +5213,7 @@ xfs_bmap_del_extent_real( return -ENOSPC; flags = XFS_ILOG_CORE; - if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) { + if (xfs_ifork_is_realtime(ip, whichfork)) { if (!(bflags & XFS_BMAPI_REMAP)) { xfs_fsblock_t bno; xfs_filblks_t len; @@ -5499,7 +5499,7 @@ __xfs_bunmapi( return 0; } XFS_STATS_INC(mp, xs_blk_unmap); - isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip); + isrt = xfs_ifork_is_realtime(ip, whichfork); end = start + len; if (!xfs_iext_lookup_extent_before(ip, ifp, &end, &icur, &got)) { diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c index 1c23063e2739..e39754fe6929 100644 --- a/fs/xfs/libxfs/xfs_inode_fork.c +++ b/fs/xfs/libxfs/xfs_inode_fork.c @@ -764,3 +764,12 @@ xfs_iext_count_may_overflow( return 0; } + +/* Decide if a file mapping is on the realtime device or not. */ +bool +xfs_ifork_is_realtime( + struct xfs_inode *ip, + int whichfork) +{ + return XFS_IS_REALTIME_INODE(ip) && whichfork != XFS_ATTR_FORK; +} diff --git a/fs/xfs/libxfs/xfs_inode_fork.h b/fs/xfs/libxfs/xfs_inode_fork.h index 4b875749e894..b040991373e4 100644 --- a/fs/xfs/libxfs/xfs_inode_fork.h +++ b/fs/xfs/libxfs/xfs_inode_fork.h @@ -238,5 +238,6 @@ int xfs_ifork_verify_local_data(struct xfs_inode *ip); int xfs_ifork_verify_local_attr(struct xfs_inode *ip); int xfs_iext_count_may_overflow(struct xfs_inode *ip, int whichfork, int nr_to_add); +bool xfs_ifork_is_realtime(struct xfs_inode *ip, int whichfork); #endif /* __XFS_INODE_FORK_H__ */ diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c index 9b725f40e0c4..13e68b9924c5 100644 --- a/fs/xfs/scrub/bmap.c +++ b/fs/xfs/scrub/bmap.c @@ -679,7 +679,7 @@ xchk_bmap_check_rmaps( return 0; /* Don't support realtime rmap checks yet. */ - if (XFS_IS_REALTIME_INODE(sc->ip) && whichfork == XFS_DATA_FORK) + if (xfs_ifork_is_realtime(sc->ip, whichfork)) return 0; ASSERT(XFS_IFORK_PTR(sc->ip, whichfork) != NULL); @@ -735,7 +735,7 @@ xchk_bmap( if (!ifp) goto out; - info.is_rt = whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip); + info.is_rt = xfs_ifork_is_realtime(ip, whichfork); info.whichfork = whichfork; info.is_shared = whichfork == XFS_DATA_FORK && xfs_is_reflink_inode(ip); info.sc = sc; diff --git a/fs/xfs/scrub/rmap_repair.c b/fs/xfs/scrub/rmap_repair.c index 806f49431a4f..9495dac6eb4f 100644 --- a/fs/xfs/scrub/rmap_repair.c +++ b/fs/xfs/scrub/rmap_repair.c @@ -454,14 +454,6 @@ out: return error; } -static inline bool -is_rt_data_fork( - struct xfs_inode *ip, - int whichfork) -{ - return XFS_IS_REALTIME_INODE(ip) && whichfork == XFS_DATA_FORK; -} - /* * Iterate the block mapping btree to collect rmap records for anything in this * fork that matches the AG. Sets @mappings_done to true if we've scanned the @@ -482,7 +474,7 @@ xrep_rmap_scan_bmbt( ifp = XFS_IFORK_PTR(ip, rf->whichfork); cur = xfs_bmbt_init_cursor(rr->sc->mp, rr->sc->tp, ip, rf->whichfork); - if (is_rt_data_fork(ip, rf->whichfork)) { + if (xfs_ifork_is_realtime(ip, rf->whichfork)) { /* Ignore mappings on the realtime device. */ *mappings_done = true; } else if (!(ifp->if_flags & XFS_IFEXTENTS)) { @@ -561,7 +553,7 @@ xrep_rmap_scan_ifork( return 0; } - if (is_rt_data_fork(ip, whichfork)) + if (xfs_ifork_is_realtime(ip, whichfork)) return 0; /* Scan incore extent cache. */ |