In the DUP profile, we can use only half of the space available in a device extent. Fix the calculation of calc_size for it.
Signed-off-by: Naohiro Aota <naohiro.a...@wdc.com> --- kernel-shared/volumes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 2a094eab4971..ed3015bf3e0c 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -1323,7 +1323,10 @@ again: } if (!looped && max_avail > 0) { looped = 1; - ctl.calc_size = max_avail; + if (ctl.type & BTRFS_BLOCK_GROUP_DUP) + ctl.calc_size = max_avail / 2; + else + ctl.calc_size = max_avail; goto again; } return -ENOSPC; -- 2.31.1