Update bcachefs sources to 7e07e19c29 bcachefs: Traverse iterator in journal replay

This commit is contained in:
Kent Overstreet 2020-03-09 16:27:23 -04:00
parent 2d238045d3
commit 96a6a5a58f
7 changed files with 19 additions and 13 deletions

View File

@ -1 +1 @@
4a4139a563c4ee59f22ef23219fc2a3bb990b7b8
7e07e19c29a31d2c719eb16f7e9061ad5aba5099

View File

@ -79,8 +79,8 @@ void bch2_dump_bset(struct btree *b, struct bset *i, unsigned set)
_n = bkey_next_skip_noops(_k, vstruct_last(i));
bch2_bkey_to_text(&PBUF(buf), &k);
printk(KERN_ERR "block %u key %5u: %s\n", set,
__btree_node_key_to_offset(b, _k), buf);
printk(KERN_ERR "block %u key %5zu: %s\n", set,
_k->_data - i->_data, buf);
if (_n == vstruct_last(i))
continue;

View File

@ -345,7 +345,7 @@ enum merge_result bch2_extent_merge(struct bch_fs *c,
crc_r.uncompressed_size > c->sb.encoded_extent_max)
return BCH_MERGE_NOMERGE;
if (crc_l.uncompressed_size + crc_r.uncompressed_size - 1 >
if (crc_l.uncompressed_size + crc_r.uncompressed_size >
bch2_crc_field_size_max[extent_entry_type(en_l)])
return BCH_MERGE_NOMERGE;
@ -563,15 +563,15 @@ void bch2_extent_crc_append(struct bkey_i *k,
enum bch_extent_entry_type type;
if (bch_crc_bytes[new.csum_type] <= 4 &&
new.uncompressed_size - 1 <= CRC32_SIZE_MAX &&
new.uncompressed_size <= CRC32_SIZE_MAX &&
new.nonce <= CRC32_NONCE_MAX)
type = BCH_EXTENT_ENTRY_crc32;
else if (bch_crc_bytes[new.csum_type] <= 10 &&
new.uncompressed_size - 1 <= CRC64_SIZE_MAX &&
new.uncompressed_size <= CRC64_SIZE_MAX &&
new.nonce <= CRC64_NONCE_MAX)
type = BCH_EXTENT_ENTRY_crc64;
else if (bch_crc_bytes[new.csum_type] <= 16 &&
new.uncompressed_size - 1 <= CRC128_SIZE_MAX &&
new.uncompressed_size <= CRC128_SIZE_MAX &&
new.nonce <= CRC128_NONCE_MAX)
type = BCH_EXTENT_ENTRY_crc128;
else

View File

@ -1221,7 +1221,8 @@ void bch2_write(struct closure *cl)
if (c->opts.nochanges ||
!percpu_ref_tryget(&c->writes)) {
__bcache_io_error(c, "read only");
if (!(op->flags & BCH_WRITE_FROM_INTERNAL))
__bcache_io_error(c, "read only");
op->error = -EROFS;
goto err;
}

View File

@ -31,10 +31,11 @@ enum bch_write_flags {
BCH_WRITE_ONLY_SPECIFIED_DEVS = (1 << 6),
BCH_WRITE_NOPUT_RESERVATION = (1 << 7),
BCH_WRITE_WROTE_DATA_INLINE = (1 << 8),
BCH_WRITE_FROM_INTERNAL = (1 << 9),
/* Internal: */
BCH_WRITE_JOURNAL_SEQ_PTR = (1 << 9),
BCH_WRITE_SKIP_CLOSURE_PUT = (1 << 10),
BCH_WRITE_JOURNAL_SEQ_PTR = (1 << 10),
BCH_WRITE_SKIP_CLOSURE_PUT = (1 << 11),
};
static inline u64 *op_journal_seq(struct bch_write_op *op)

View File

@ -243,7 +243,8 @@ int bch2_migrate_write_init(struct bch_fs *c, struct migrate_write *m,
m->op.flags |= BCH_WRITE_ONLY_SPECIFIED_DEVS|
BCH_WRITE_PAGES_STABLE|
BCH_WRITE_PAGES_OWNED|
BCH_WRITE_DATA_ENCODED;
BCH_WRITE_DATA_ENCODED|
BCH_WRITE_FROM_INTERNAL;
m->op.nr_replicas = 1;
m->op.nr_replicas_required = 1;

View File

@ -417,14 +417,17 @@ static int __bch2_journal_replay_key(struct btree_trans *trans,
enum btree_id id, struct bkey_i *k)
{
struct btree_iter *iter;
int ret;
iter = bch2_trans_get_iter(trans, id, bkey_start_pos(&k->k),
BTREE_ITER_INTENT);
if (IS_ERR(iter))
return PTR_ERR(iter);
bch2_trans_update(trans, iter, k, BTREE_TRIGGER_NORUN);
return 0;
ret = bch2_btree_iter_traverse(iter) ?:
bch2_trans_update(trans, iter, k, BTREE_TRIGGER_NORUN);
bch2_trans_iter_put(trans, iter);
return ret;
}
static int bch2_journal_replay_key(struct bch_fs *c, enum btree_id id,