diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-13 20:04:21 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-13 20:07:22 -0500 |
commit | c1e4d447f6dd0ee60495b651436d2055db7777ed (patch) | |
tree | 36a657f7018cecc6bad43e0e178ef1913154eba0 /libbcachefs/alloc_background.c | |
parent | 980f7437e2588d100456640cb863908a3cc6fc77 (diff) |
Update bcachefs sources to 8d3fc97ca3 bcachefs: Fixes for building in userspace
Diffstat (limited to 'libbcachefs/alloc_background.c')
-rw-r--r-- | libbcachefs/alloc_background.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libbcachefs/alloc_background.c b/libbcachefs/alloc_background.c index 796b9f5a..742313c2 100644 --- a/libbcachefs/alloc_background.c +++ b/libbcachefs/alloc_background.c @@ -279,6 +279,22 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k, return -EINVAL; } + /* + * XXX this is wrong, we'll be checking updates that happened from + * before BCH_FS_CHECK_BACKPOINTERS_DONE + */ + if (rw == WRITE && test_bit(BCH_FS_CHECK_BACKPOINTERS_DONE, &c->flags)) { + unsigned i, bp_len = 0; + + for (i = 0; i < BCH_ALLOC_V4_NR_BACKPOINTERS(a.v); i++) + bp_len += alloc_v4_backpointers_c(a.v)[i].bucket_len; + + if (bp_len > a.v->dirty_sectors) { + prt_printf(err, "too many backpointers"); + return -EINVAL; + } + } + if (rw == WRITE) { if (alloc_data_type(*a.v, a.v->data_type) != a.v->data_type) { prt_printf(err, "invalid data type (got %u should be %u)", |