summaryrefslogtreecommitdiff
path: root/libbcachefs/alloc_foreground.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/alloc_foreground.c')
-rw-r--r--libbcachefs/alloc_foreground.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libbcachefs/alloc_foreground.c b/libbcachefs/alloc_foreground.c
index ac1244e7..a0f92daa 100644
--- a/libbcachefs/alloc_foreground.c
+++ b/libbcachefs/alloc_foreground.c
@@ -1339,6 +1339,8 @@ alloc_done:
open_bucket_for_each(c, &req->wp->ptrs, ob, i)
req->wp->sectors_free = min(req->wp->sectors_free, ob->sectors_free);
+ req->wp->sectors_free = rounddown(req->wp->sectors_free, block_sectors(c));
+
BUG_ON(!req->wp->sectors_free || req->wp->sectors_free == UINT_MAX);
return 0;