summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-04-08 00:32:57 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:30 +0300
commit62491956f48e1afda98f50250d4690131e87d6ea (patch)
treeb95291634dda56ad9f4d0774a7a2e966aaeaafbe /fs/bcachefs/alloc_background.c
parent1d8a268940045b73f43f86e6332bdfdfe64d0fa0 (diff)
downloadlinux-62491956f48e1afda98f50250d4690131e87d6ea.tar.xz
bcachefs: Move alloc assertion to .key_invalid()
.key_invalid is a better place for this assertion. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index f030030a8b50..090fdee58157 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -361,6 +361,14 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
pr_buf(err, "cached bucket with read_time == 0");
return -EINVAL;
}
+
+ if (!a.v->dirty_sectors &&
+ !a.v->cached_sectors &&
+ !a.v->stripe &&
+ a.v->data_type) {
+ pr_buf(err, "empty, but data_type nonzero");
+ return -EINVAL;
+ }
}
return 0;