From: Kent Overstreet Date: Thu, 5 Mar 2020 23:43:31 +0000 (-0500) Subject: bcachefs: Skip 0 size deleted extents in journal replay X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3186c80fe93fd2bae4af68b94bb63403e1180ceb;p=linux.git bcachefs: Skip 0 size deleted extents in journal replay These are created by the new extent update path, but not used yet by the recovery code and they break the existing recovery code, so we can just skip them. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 712a6b1fd9685..bd0edda7abf91 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -230,7 +230,11 @@ static struct journal_keys journal_keys_sort(struct list_head *journal_entries) goto err; list_for_each_entry(p, journal_entries, list) - for_each_jset_key(k, _n, entry, &p->j) + for_each_jset_key(k, _n, entry, &p->j) { + if (bkey_deleted(&k->k) && + btree_node_type_is_extents(entry->btree_id)) + continue; + keys.d[keys.nr++] = (struct journal_key) { .btree_id = entry->btree_id, .pos = bkey_start_pos(&k->k), @@ -239,8 +243,9 @@ static struct journal_keys journal_keys_sort(struct list_head *journal_entries) keys.journal_seq_base, .journal_offset = k->_data - p->j._data, }; + } - sort(keys.d, nr_keys, sizeof(keys.d[0]), journal_sort_key_cmp, NULL); + sort(keys.d, keys.nr, sizeof(keys.d[0]), journal_sort_key_cmp, NULL); i = keys.d; while (i < keys.d + keys.nr) {