diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-01-20 19:42:09 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:51 -0400 |
commit | ef470b4817e6592fdb22b566380d289d7c42a17d (patch) | |
tree | 4b064be802c2ac03e79538b8c10d5d4f766f7c8a /fs/bcachefs/extent_update.c | |
parent | a5cd80ea99e544b67acde573fc2a2dd68659fd40 (diff) | |
download | lwn-ef470b4817e6592fdb22b566380d289d7c42a17d.tar.gz lwn-ef470b4817e6592fdb22b566380d289d7c42a17d.zip |
bcachefs: Clean up bch2_extent_can_insert
It was using an internal btree node iterator interface, when
bch2_btree_iter_peek_slot() sufficed. We were hitting a null ptr deref
that looked like it was from the iterator not being uptodate - this will
also fix that.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extent_update.c')
-rw-r--r-- | fs/bcachefs/extent_update.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c index 1faca4bc1825..5c43678e94a3 100644 --- a/fs/bcachefs/extent_update.c +++ b/fs/bcachefs/extent_update.c @@ -192,18 +192,13 @@ bch2_extent_can_insert(struct btree_trans *trans, struct btree_iter *iter, struct bkey_i *insert) { - struct btree_iter_level *l = &iter->l[0]; - struct btree_node_iter node_iter = l->iter; - struct bkey_packed *_k; struct bkey_s_c k; - struct bkey unpacked; - int sectors; + int ret, sectors; - _k = bch2_btree_node_iter_peek(&node_iter, l->b); - if (!_k) - return BTREE_INSERT_OK; - - k = bkey_disassemble(l->b, _k, &unpacked); + k = bch2_btree_iter_peek_slot(iter); + ret = bkey_err(k); + if (ret) + return ret; /* Check if we're splitting a compressed extent: */ |