summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:18:59 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:41:10 -0700
commitf40e739dfd8788d177c0067f985d034fffa8d50c (patch)
treec0d0b758e7fdf51503fb3a3d77355a59566d8ef3 /fs
parenta626b7e5704c95c91c79a0c89ddca8900cdcadff (diff)
xfs: add realtime refcount btree when adding rt volume
If we're adding a realtime section to the filesystem, create the rt refcount btree inode before we start adding rt space. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_rtalloc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index ac86a201666e..0297d1e4da5d 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -955,6 +955,8 @@ xfs_growfsrt_imeta_create(
if (path == &XFS_IMETA_RTRMAPBT) {
error = xfs_rtrmapbt_create(&tp, &ic, &ip);
+ } else if (path == &XFS_IMETA_RTREFCOUNTBT) {
+ error = xfs_rtrefcountbt_create(&tp, &ic, &ip);
} else {
ASSERT(0);
error = -EIO;
@@ -1034,7 +1036,10 @@ xfs_growfs_rt(
return -EINVAL;
/* Unsupported realtime features. */
- if ((!xfs_has_metadir(mp) && xfs_has_rmapbt(mp)) || xfs_has_reflink(mp))
+ if (!xfs_has_metadir(mp) && (xfs_has_rmapbt(mp) || xfs_has_reflink(mp)))
+ return -EOPNOTSUPP;
+
+ if (xfs_has_reflink(mp) && in->extsize != 1)
return -EOPNOTSUPP;
nrblocks = in->newblocks;
@@ -1082,6 +1087,14 @@ xfs_growfs_rt(
return error;
}
+ /* Add the realtime refcount inode. */
+ if (xfs_has_reflink(mp) && !mp->m_rrefcountip) {
+ error = xfs_growfsrt_imeta_create(mp, &XFS_IMETA_RTREFCOUNTBT,
+ &mp->m_rrefcountip);
+ if (error)
+ return error;
+ }
+
/*
* Get the old block counts for bitmap and summary inodes.
* These can't change since other growfs callers are locked out.