Commit cc1add4a authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: BTREE_INSERT_JOURNAL_RES_FULL is no longer possible

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent df8a4239
...@@ -255,13 +255,6 @@ void bch2_verify_insert_pos(struct btree *b, struct bkey_packed *where, ...@@ -255,13 +255,6 @@ void bch2_verify_insert_pos(struct btree *b, struct bkey_packed *where,
#endif #endif
} }
void bch2_verify_key_order(struct btree *b,
struct btree_node_iter *_iter,
struct bkey_packed *where)
{
bch2_verify_insert_pos(b, where, where, where->u64s);
}
#else #else
static inline void bch2_btree_node_iter_next_check(struct btree_node_iter *iter, static inline void bch2_btree_node_iter_next_check(struct btree_node_iter *iter,
......
...@@ -632,8 +632,6 @@ void __bch2_verify_btree_nr_keys(struct btree *); ...@@ -632,8 +632,6 @@ void __bch2_verify_btree_nr_keys(struct btree *);
void bch2_btree_node_iter_verify(struct btree_node_iter *, struct btree *); void bch2_btree_node_iter_verify(struct btree_node_iter *, struct btree *);
void bch2_verify_insert_pos(struct btree *, struct bkey_packed *, void bch2_verify_insert_pos(struct btree *, struct bkey_packed *,
struct bkey_packed *, unsigned); struct bkey_packed *, unsigned);
void bch2_verify_key_order(struct btree *, struct btree_node_iter *,
struct bkey_packed *);
#else #else
...@@ -644,9 +642,6 @@ static inline void bch2_verify_insert_pos(struct btree *b, ...@@ -644,9 +642,6 @@ static inline void bch2_verify_insert_pos(struct btree *b,
struct bkey_packed *where, struct bkey_packed *where,
struct bkey_packed *insert, struct bkey_packed *insert,
unsigned clobber_u64s) {} unsigned clobber_u64s) {}
static inline void bch2_verify_key_order(struct btree *b,
struct btree_node_iter *iter,
struct bkey_packed *where) {}
#endif #endif
static inline void bch2_verify_btree_nr_keys(struct btree *b) static inline void bch2_verify_btree_nr_keys(struct btree *b)
......
...@@ -463,7 +463,6 @@ enum btree_insert_ret { ...@@ -463,7 +463,6 @@ enum btree_insert_ret {
/* write lock held for too long */ /* write lock held for too long */
/* leaf node needs to be split */ /* leaf node needs to be split */
BTREE_INSERT_BTREE_NODE_FULL, BTREE_INSERT_BTREE_NODE_FULL,
BTREE_INSERT_JOURNAL_RES_FULL,
BTREE_INSERT_ENOSPC, BTREE_INSERT_ENOSPC,
BTREE_INSERT_NEED_GC_LOCK, BTREE_INSERT_NEED_GC_LOCK,
}; };
......
...@@ -336,40 +336,14 @@ static inline void reserve_whiteout(struct btree *b, struct bkey_packed *k) ...@@ -336,40 +336,14 @@ static inline void reserve_whiteout(struct btree *b, struct bkey_packed *k)
* insert into could be written out from under us) * insert into could be written out from under us)
*/ */
static inline bool bch2_btree_node_insert_fits(struct bch_fs *c, static inline bool bch2_btree_node_insert_fits(struct bch_fs *c,
struct btree *b, unsigned u64s) struct btree *b, unsigned u64s)
{ {
if (unlikely(btree_node_fake(b))) if (unlikely(btree_node_fake(b)))
return false; return false;
if (btree_node_is_extents(b)) {
/* The insert key might split an existing key
* (bch2_insert_fixup_extent() -> BCH_EXTENT_OVERLAP_MIDDLE case:
*/
u64s += BKEY_EXTENT_U64s_MAX;
}
return u64s <= bch_btree_keys_u64s_remaining(c, b); return u64s <= bch_btree_keys_u64s_remaining(c, b);
} }
static inline bool journal_res_insert_fits(struct btree_insert *trans,
struct btree_insert_entry *insert)
{
unsigned u64s = 0;
struct btree_insert_entry *i;
/*
* If we didn't get a journal reservation, we're in journal replay and
* we're not journalling updates:
*/
if (!trans->journal_res.ref)
return true;
for (i = insert; i < trans->entries + trans->nr; i++)
u64s += jset_u64s(i->k->k.u64s + i->extra_res);
return u64s <= trans->journal_res.u64s;
}
ssize_t bch2_btree_updates_print(struct bch_fs *, char *); ssize_t bch2_btree_updates_print(struct bch_fs *, char *);
size_t bch2_btree_interior_updates_nr_pending(struct bch_fs *); size_t bch2_btree_interior_updates_nr_pending(struct bch_fs *);
......
...@@ -408,7 +408,6 @@ static inline int do_btree_insert_at(struct btree_insert *trans, ...@@ -408,7 +408,6 @@ static inline int do_btree_insert_at(struct btree_insert *trans,
case BTREE_INSERT_OK: case BTREE_INSERT_OK:
i->done = true; i->done = true;
break; break;
case BTREE_INSERT_JOURNAL_RES_FULL:
case BTREE_INSERT_NEED_TRAVERSE: case BTREE_INSERT_NEED_TRAVERSE:
ret = -EINTR; ret = -EINTR;
break; break;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment