diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-12-17 15:08:58 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:50 -0400 |
commit | 07a1006ae81580c6a1b52b80e32fa9dadea1954b (patch) | |
tree | 7ac1a004d0209465c211f71f00818d9d3f176075 /fs/bcachefs/journal_io.c | |
parent | 8deed5f4e547e675cf8c1de88720c23c3c3093ca (diff) | |
download | lwn-07a1006ae81580c6a1b52b80e32fa9dadea1954b.tar.gz lwn-07a1006ae81580c6a1b52b80e32fa9dadea1954b.zip |
bcachefs: Reduce/kill BKEY_PADDED use
With various newer key types - stripe keys, inline data extents - the
old approach of calculating the maximum size of the value is becoming
more and more error prone. Better to switch to bkey_on_stack, which can
dynamically allocate if necessary to handle any size bkey.
In particular we also want to get rid of BKEY_EXTENT_VAL_U64s_MAX.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_io.c')
-rw-r--r-- | fs/bcachefs/journal_io.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index cb2cfbbf50d4..25010aa42af6 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -989,6 +989,8 @@ static int journal_write_alloc(struct journal *j, struct journal_buf *w, done: rcu_read_unlock(); + BUG_ON(bkey_val_u64s(&w->key.k) > BCH_REPLICAS_MAX); + return replicas >= c->opts.metadata_replicas_required ? 0 : -EROFS; } |