summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/xfbtree.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-10-05 10:47:36 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:41:17 -0700
commit04e01af9318f50df5e1974d8e2ce7d54b6cfbe55 (patch)
treec9ecd431013084675617dda8097c2a07ca3f3156 /fs/xfs/scrub/xfbtree.c
parent058725b83f3ab866a225aec3bfa204c0b7f4d3a8 (diff)
xfs: map xfile pages directly into xfs_buf
Map the xfile pages directly into xfs_buf to reduce memory overhead. It's silly to use memory to stage changes to shmem pages for ephemeral btrees that don't care about transactionality. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/xfbtree.c')
-rw-r--r--fs/xfs/scrub/xfbtree.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/xfs/scrub/xfbtree.c b/fs/xfs/scrub/xfbtree.c
index c43c18136733..1098234eec3b 100644
--- a/fs/xfs/scrub/xfbtree.c
+++ b/fs/xfs/scrub/xfbtree.c
@@ -151,8 +151,9 @@ xfs_btree_mem_head_read_buf(
{
struct xfs_mount *mp = btp->bt_mount;
- return xfs_trans_read_buf(mp, tp, btp, XFS_BTREE_MEM_HEAD_DADDR, 1, 0,
- bpp, &xfs_btree_mem_head_buf_ops);
+ return xfs_trans_read_buf(mp, tp, btp, XFS_BTREE_MEM_HEAD_DADDR,
+ XFS_FSB_TO_BB(mp, 1), 0, bpp,
+ &xfs_btree_mem_head_buf_ops);
}
/* Return tree height from the in-memory btree head */
@@ -239,6 +240,9 @@ xfbtree_create(
goto err_xfile;
}
+ if (mp->m_bsize == PAGE_SIZE && (flags & XFBTREE_DIRECT_MAP))
+ xfbt->target->bt_flags |= XFS_BUFTARG_DIRECT_MAP;
+
xfbt->freespace = kmem_alloc(sizeof(struct xbitmap),
KM_NOFS | KM_MAYFAIL);
if (!xfbt->freespace) {
@@ -264,7 +268,8 @@ xfbtree_create(
goto err_freesp;
/* Initialize the in-memory btree header block. */
- error = xfs_buf_get(xfbt->target, XFS_BTREE_MEM_HEAD_DADDR, 1, &bp);
+ error = xfs_buf_get(xfbt->target, XFS_BTREE_MEM_HEAD_DADDR,
+ XFS_FSB_TO_BB(mp, 1), &bp);
if (error)
goto err_freesp;