Private error code work
cover Private error code work
We never want to be returning standard error codes - those are a nightmare to track down when all you have is an error message that says "EIO".
This kills off EIO usage, mostly in io_write.c.
Kent Overstreet (3):
bcachefs: Simplify bch2_write_op_error()
bcachefs: bch2_write_prep_encoded_data() now returns errcode
bcachefs: EIO cleanup
fs/bcachefs/alloc_background.c | 4 +- fs/bcachefs/alloc_foreground.c | 4 +- fs/bcachefs/alloc_foreground.h | 2 +- fs/bcachefs/checksum.c | 2 +- fs/bcachefs/compress.c | 65 ++++---- fs/bcachefs/data_update.c | 2 +- fs/bcachefs/ec.c | 16 +- fs/bcachefs/ec.h | 2 +- fs/bcachefs/errcode.h | 18 ++- fs/bcachefs/inode.c | 4 +- fs/bcachefs/io_write.c | 277 +++++++++++++-------------------- fs/bcachefs/io_write.h | 9 +- fs/bcachefs/journal_io.c | 2 +- fs/bcachefs/journal_reclaim.c | 6 +- 14 files changed, 175 insertions(+), 238 deletions(-)
Signature · 1 line
2.49.0
PATCH 1/3 bcachefs: Simplify bch2_write_op_error()
There's no reason for the caller to do the actual logging, it's all done the same.
--- fs/bcachefs/compress.c | 15 ++---- fs/bcachefs/io_write.c | 110 ++++++++++++----------------------------- fs/bcachefs/io_write.h | 9 +--- 3 files changed, 37 insertions(+), 97 deletions(-)
fs/bcachefs/compress.c +3 -12
@@ -270,24 +270,15 @@ int bch2_bio_uncompress_inplace(struct bch_write_op *op,if (crc->uncompressed_size <<9 > c->opts.encoded_extent_max || crc->compressed_size <<9 > c->opts.encoded_extent_max) { -struct printbuf buf =PRINTBUF ; -bch2_write_op_error (&buf, op, op->pos.offset, -"extent too big to decompress" ); -bch_err_ratelimited (c,"%s" , buf.buf); -printbuf_exit (&buf); +bch2_write_op_error (op, op->pos.offset,"extent too big to decompress" );return -EIO ; } data =__bounce_alloc (c, dst_len,WRITE );if (__bio_uncompress (c, bio, data.b, *crc)) { -if (!c->opts.no_data_io) { -struct printbuf buf =PRINTBUF ; -bch2_write_op_error (&buf, op, op->pos.offset, -"decompression error" ); -bch_err_ratelimited (c,"%s" , buf.buf); -printbuf_exit (&buf); - } +if (!c->opts.no_data_io) +bch2_write_op_error (op, op->pos.offset,"decompression error" ); ret = -EIO ; goto err; }
fs/bcachefs/io_write.c +32 -78
183 lines not on this page · raw message
fs/bcachefs/io_write.h +2 -7
@@ -14,13 +14,8 @@ void bch2_bio_alloc_pages_pool(struct bch_fs *, struct bio *, size_t);void bch2_submit_wbio_replicas (struct bch_write_bio *,struct bch_fs *,enum bch_data_type ,const struct bkey_i *,bool ); -__printf(5, 6) -void bch2_write_op_error_trans (struct btree_trans *trans,struct printbuf *out, -struct bch_write_op *op,u64 ,const char *, ...); - -__printf(4, 5) -void bch2_write_op_error (struct printbuf *out,struct bch_write_op *op,u64 , -const char *, ...); +__printf(3, 4) +void bch2_write_op_error (struct bch_write_op *op,u64 ,const char *, ...);#define BCH_WRITE_FLAGS () \ x(alloc_nowait) \
Signature · 1 line
2.49.0
PATCH 2/3 bcachefs: bch2_write_prep_encoded_data() now returns errcode
In reply to Kent OverstreetPrep work for killing off EIO and replacing them with proper private error codes.
--- fs/bcachefs/io_write.c | 159 ++++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 88 deletions(-)
fs/bcachefs/io_write.c +71 -88
@@ -434,6 +434,12 @@ void bch2_write_op_error(struct bch_write_op *op, u64 offset, const char *fmt, .printbuf_exit (&buf); } +static void bch2_write_csum_err_msg (struct bch_write_op *op) +{ +bch2_write_op_error (op, op->pos.offset, +"error verifying existing checksum while rewriting existing data (memory corruption?)" ); +} + void bch2_submit_wbio_replicas(struct bch_write_bio *wbio, struct bch_fs *c, enum bch_data_type type, const struct bkey_i *k,
@@ -809,7 +815,6 @@ static int bch2_write_rechecksum(struct bch_fs *c, {struct bio *bio = &op->wbio.bio;struct bch_extent_crc_unpacked new_crc; -int ret;/* bch2_rechecksum_bio() can't encrypt or decrypt data: */
@@ -817,10 +822,10 @@ static int bch2_write_rechecksum(struct bch_fs *c, bch2_csum_type_is_encryption(new_csum_type)) new_csum_type = op->crc.csum_type; - ret =bch2_rechecksum_bio (c, bio, op->version, op->crc, -NULL , &new_crc, - op->crc.offset, op->crc.live_size, - new_csum_type); +int ret =bch2_rechecksum_bio (c, bio, op->version, op->crc, +NULL , &new_crc, + op->crc.offset, op->crc.live_size, + new_csum_type);if (ret)return ret;
@@ -830,44 +835,12 @@ static int bch2_write_rechecksum(struct bch_fs *c,return 0 ; } -static int bch2_write_decrypt (struct bch_write_op *op) -{ -struct bch_fs *c = op->c; -struct nonce nonce =extent_nonce (op->version, op->crc); -struct bch_csum csum; -int ret; - -if (!bch2_csum_type_is_encryption (op->crc.csum_type)) -return 0 ; - -/* -* If we need to decrypt data in the write path, we'll no longer be able -* to verify the existing checksum (poly1305 mac, in this case) after -* it's decrypted - this is the last point we'll be able to reverify the -* checksum: -*/ - csum =bch2_checksum_bio (c, op->crc.csum_type, nonce, &op->wbio.bio); -if (bch2_crc_cmp (op->crc.csum, csum) && !c->opts.no_data_io) -return -EIO ; - - ret =bch2_encrypt_bio (c, op->crc.csum_type, nonce, &op->wbio.bio); - op->crc.csum_type =0 ; - op->crc.csum = (struct bch_csum ) {0 ,0 }; -return ret; -} - -static enum prep_encoded_ret { -PREP_ENCODED_OK , -PREP_ENCODED_ERR , -PREP_ENCODED_CHECKSUM_ERR , -PREP_ENCODED_DO_WRITE , -}bch2_write_prep_encoded_data (struct bch_write_op *op,struct write_point *wp) +static noinline int bch2_write_prep_encoded_data(struct bch_write_op *op, struct write_point *wp) {struct bch_fs *c = op->c;struct bio *bio = &op->wbio.bio; - -if (!(op->flags & BCH_WRITE_data_encoded)) -return PREP_ENCODED_OK ; +struct nonce nonce =extent_nonce (op->version, op->crc); +int ret =0 ;BUG_ON (bio_sectors (bio) != op->crc.compressed_size);
@@ -878,12 +851,13 @@ static enum prep_encoded_ret { (op->crc.compression_type == bch2_compression_opt_to_type(op->compression_opt) || op->incompressible)) {if (!crc_is_compressed (op->crc) && - op->csum_type != op->crc.csum_type && -bch2_write_rechecksum (c, op, op->csum_type) && - !c->opts.no_data_io) -return PREP_ENCODED_CHECKSUM_ERR ; + op->csum_type != op->crc.csum_type) { + ret =bch2_write_rechecksum (c, op, op->csum_type); +if (ret) +return ret; + } -return PREP_ENCODED_DO_WRITE ; +return 1 ; }/*
@@ -891,20 +865,23 @@ static enum prep_encoded_ret {* is, we have to decompress it: */ if (crc_is_compressed (op->crc)) { -struct bch_csum csum; - -if (bch2_write_decrypt (op)) -return PREP_ENCODED_CHECKSUM_ERR ; -/* Last point we can still verify checksum: */ - csum =bch2_checksum_bio (c, op->crc.csum_type, -extent_nonce (op->version, op->crc), - bio); +struct bch_csum csum =bch2_checksum_bio (c, op->crc.csum_type, nonce, bio);if (bch2_crc_cmp (op->crc.csum, csum) && !c->opts.no_data_io) -return PREP_ENCODED_CHECKSUM_ERR ; + goto csum_err; -if (bch2_bio_uncompress_inplace (op, bio)) -return PREP_ENCODED_ERR ; +if (bch2_csum_type_is_encryption (op->crc.csum_type)) { + ret =bch2_encrypt_bio (c, op->crc.csum_type, nonce, bio); +if (ret) +return ret; + + op->crc.csum_type =0 ; + op->crc.csum = (struct bch_csum ) {0 ,0 }; + } + + ret =bch2_bio_uncompress_inplace (op, bio); +if (ret) +return ret; }/*
@@ -916,22 +893,34 @@ static enum prep_encoded_ret {* If the data is checksummed and we're only writing a subset, * rechecksum and adjust bio to point to currently live data: */ -if ((op->crc.live_size != op->crc.uncompressed_size || - op->crc.csum_type != op->csum_type) && -bch2_write_rechecksum (c, op, op->csum_type) && - !c->opts.no_data_io) -return PREP_ENCODED_CHECKSUM_ERR ; +if (op->crc.live_size != op->crc.uncompressed_size || + op->crc.csum_type != op->csum_type) { + ret =bch2_write_rechecksum (c, op, op->csum_type); +if (ret) +return ret; + }/* * If we want to compress the data, it has to be decrypted: */ -if ((op->compression_opt || -bch2_csum_type_is_encryption (op->crc.csum_type) != -bch2_csum_type_is_encryption (op->csum_type)) && -bch2_write_decrypt (op)) -return PREP_ENCODED_CHECKSUM_ERR ; +if (bch2_csum_type_is_encryption (op->crc.csum_type) && + (op->compression_opt || op->crc.csum_type != op->csum_type)) { +struct bch_csum csum =bch2_checksum_bio (c, op->crc.csum_type, nonce, bio); +if (bch2_crc_cmp (op->crc.csum, csum) && !c->opts.no_data_io) + goto csum_err; + + ret =bch2_encrypt_bio (c, op->crc.csum_type, nonce, bio); +if (ret) +return ret; -return PREP_ENCODED_OK ; + op->crc.csum_type =0 ; + op->crc.csum = (struct bch_csum ) {0 ,0 }; + } + +return 0 ; +csum_err: +bch2_write_csum_err_msg (op); +return -EIO ; } static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp,
@@ -950,25 +939,21 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp, ec_buf =bch2_writepoint_ec_buf (c, wp); -switch (bch2_write_prep_encoded_data (op, wp)) { -case PREP_ENCODED_OK : -break ; -case PREP_ENCODED_ERR : - ret = -EIO ; - goto err; -case PREP_ENCODED_CHECKSUM_ERR : - goto csum_err; -case PREP_ENCODED_DO_WRITE : -/* XXX look for bug here */ -if (ec_buf) { - dst =bch2_write_bio_alloc (c, wp, src, - &page_alloc_failed, - ec_buf); -bio_copy_data (dst, src); - bounce = true; +if (unlikely (op->flags & BCH_WRITE_data_encoded)) { + ret =bch2_write_prep_encoded_data (op, wp); +if (ret <0 ) + goto err; +if (ret) { +if (ec_buf) { + dst =bch2_write_bio_alloc (c, wp, src, + &page_alloc_failed, + ec_buf); +bio_copy_data (dst, src); + bounce = true; + } +init_append_extent (op, wp, op->version, op->crc); + goto do_write; } -init_append_extent (op, wp, op->version, op->crc); - goto do_write; } if (ec_buf ||
@@ -1141,9 +1126,7 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp, *_dst = dst;return more; csum_err: -bch2_write_op_error (op, op->pos.offset, -"error verifying existing checksum while rewriting existing data (memory corruption?)" ); - +bch2_write_csum_err_msg (op); ret = -EIO ; err:if (to_wbio (dst)->bounce)
Signature · 1 line
2.49.0
PATCH 3/3 bcachefs: EIO cleanup
In reply to Kent OverstreetReplace these with proper private error codes, so that when we get an error message we're not sifting through the entire codebase to see where it came from.
--- fs/bcachefs/alloc_background.c | 4 +-- fs/bcachefs/alloc_foreground.c | 4 +-- fs/bcachefs/alloc_foreground.h | 2 +- fs/bcachefs/checksum.c | 2 +- fs/bcachefs/compress.c | 56 ++++++++++++++++++---------------- fs/bcachefs/data_update.c | 2 +- fs/bcachefs/ec.c | 16 +++++----- fs/bcachefs/ec.h | 2 +- fs/bcachefs/errcode.h | 18 ++++++++++- fs/bcachefs/inode.c | 4 +-- fs/bcachefs/io_write.c | 14 ++++----- fs/bcachefs/journal_io.c | 2 +- fs/bcachefs/journal_reclaim.c | 6 ++-- 13 files changed, 73 insertions(+), 59 deletions(-)
fs/bcachefs/alloc_background.c +2 -2
@@ -837,7 +837,7 @@ int bch2_trigger_alloc(struct btree_trans *trans,struct bch_dev *ca =bch2_dev_bucket_tryget (c, new.k->p);if (!ca) -return -EIO ; +return -BCH_ERR_trigger_alloc;struct bch_alloc_v4 old_a_convert;const struct bch_alloc_v4 *old_a =bch2_alloc_to_v4 (old, &old_a_convert);
@@ -1031,7 +1031,7 @@ int bch2_trigger_alloc(struct btree_trans *trans, invalid_bucket:bch2_fs_inconsistent (c,"reference to invalid bucket\n %s" , (bch2_bkey_val_to_text (&buf, c, new.s_c), buf.buf)); - ret = -EIO ; + ret = -BCH_ERR_trigger_alloc; goto err; }
fs/bcachefs/alloc_foreground.c +2 -2
@@ -127,14 +127,14 @@ void __bch2_open_bucket_put(struct bch_fs *c, struct open_bucket *ob)void bch2_open_bucket_write_error (struct bch_fs *c,struct open_buckets *obs, -unsigned dev) +unsigned dev,int err) {struct open_bucket *ob;unsigned i;open_bucket_for_each (c, obs, ob, i)if (ob->dev == dev && ob->ec) -bch2_ec_bucket_cancel (c, ob); +bch2_ec_bucket_cancel (c, ob, err); }static struct open_bucket *bch2_open_bucket_alloc (struct bch_fs *c)
fs/bcachefs/alloc_foreground.h +1 -1
@@ -82,7 +82,7 @@ static inline struct open_bucket *ec_open_bucket(struct bch_fs *c, }void bch2_open_bucket_write_error (struct bch_fs *, -struct open_buckets *,unsigned ); +struct open_buckets *,unsigned ,int );void __bch2_open_bucket_put (struct bch_fs *,struct open_bucket *);
fs/bcachefs/checksum.c +1 -1
@@ -466,7 +466,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,prt_str (&buf,")" );WARN_RATELIMIT (1 ,"%s" , buf.buf);printbuf_exit (&buf); -return -EIO ; +return -BCH_ERR_recompute_checksum; }for (i = splits; i < splits +ARRAY_SIZE (splits); i++) {
fs/bcachefs/compress.c +29 -27
123 lines not on this page · raw message
fs/bcachefs/data_update.c +1 -1
@@ -354,7 +354,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans,printbuf_exit (&buf);bch2_fatal_error (c); - ret = -EIO ; + ret = -BCH_ERR_invalid_bkey; goto out; }
fs/bcachefs/ec.c +7 -9
@@ -1124,7 +1124,7 @@ static int ec_stripe_update_extent(struct btree_trans *trans,bch2_fs_inconsistent (c,"%s" , buf.buf);printbuf_exit (&buf); -return -EIO ; +return -BCH_ERR_erasure_coding_found_btree_node; } k =bch2_backpointer_get_key (trans, bp, &iter, BTREE_ITER_intent, last_flushed);
@@ -1190,7 +1190,7 @@ static int ec_stripe_update_bucket(struct btree_trans *trans, struct ec_stripe_bstruct bch_dev *ca =bch2_dev_tryget (c, ptr.dev);if (!ca) -return -EIO ; +return -BCH_ERR_ENOENT_dev_not_found;struct bpos bucket_pos =PTR_BUCKET_POS (ca, &ptr);
@@ -1227,21 +1227,19 @@ static int ec_stripe_update_extents(struct bch_fs *c, struct ec_stripe_buf *s) {struct btree_trans *trans =bch2_trans_get (c);struct bch_stripe *v = &bkey_i_to_stripe (&s->key)->v; -unsigned i, nr_data = v->nr_blocks - v->nr_redundant; -int ret =0 ; +unsigned nr_data = v->nr_blocks - v->nr_redundant; - ret =bch2_btree_write_buffer_flush_sync (trans); +int ret =bch2_btree_write_buffer_flush_sync (trans);if (ret) goto err; -for (i =0 ; i < nr_data; i++) { +for (unsigned i =0 ; i < nr_data; i++) { ret =ec_stripe_update_bucket (trans, s, i);if (ret)break ; } err:bch2_trans_put (trans); -return ret; }
@@ -1451,11 +1449,11 @@ static void ec_stripe_new_cancel(struct bch_fs *c, struct ec_stripe_head *h, intec_stripe_new_set_pending (c, h); } -void bch2_ec_bucket_cancel (struct bch_fs *c,struct open_bucket *ob) +void bch2_ec_bucket_cancel (struct bch_fs *c,struct open_bucket *ob,int err) {struct ec_stripe_new *s = ob->ec; - s->err = -EIO ; + s->err = err; }void *bch2_writepoint_ec_buf (struct bch_fs *c,struct write_point *wp)
fs/bcachefs/ec.h +1 -1
@@ -249,7 +249,7 @@ int bch2_ec_read_extent(struct btree_trans *, struct bch_read_bio *, struct bkeyvoid *bch2_writepoint_ec_buf (struct bch_fs *,struct write_point *); -void bch2_ec_bucket_cancel (struct bch_fs *,struct open_bucket *); +void bch2_ec_bucket_cancel (struct bch_fs *,struct open_bucket *,int );int bch2_ec_stripe_new_alloc (struct bch_fs *,struct ec_stripe_head *);
fs/bcachefs/errcode.h +17 -1
@@ -116,6 +116,7 @@ x(ENOENT, ENOENT_snapshot_tree) \ x(ENOENT, ENOENT_dirent_doesnt_match_inode) \ x(ENOENT, ENOENT_dev_not_found) \ + x(ENOENT, ENOENT_dev_bucket_not_found) \ x(ENOENT, ENOENT_dev_idx_not_found) \ x(ENOENT, ENOENT_inode_no_backpointer) \x (ENOENT , ENOENT_no_snapshot_tree_subvol) \
@@ -207,6 +208,7 @@ x(EINVAL, no_resize_with_buckets_nouse) \ x(EINVAL, inode_unpack_error) \ x(EINVAL, varint_decode_error) \ + x(EINVAL, erasure_coding_found_btree_node) \ x(EOPNOTSUPP, may_not_use_incompat_feature) \ x(EROFS, erofs_trans_commit) \x (EROFS , erofs_no_writes) \
@@ -267,6 +269,7 @@ x(BCH_ERR_operation_blocked, nocow_lock_blocked) \ x(EIO, journal_shutdown) \ x(EIO, journal_flush_err) \ + x(EIO, journal_write_err) \ x(EIO, btree_node_read_err) \ x(BCH_ERR_btree_node_read_err, btree_node_read_err_cached) \x (EIO , sb_not_downgraded) \
@@ -275,6 +278,7 @@ x(EIO, btree_node_read_validate_error) \ x(EIO, btree_need_topology_repair) \ x(EIO, bucket_ref_update) \ + x(EIO, trigger_alloc) \ x(EIO, trigger_pointer) \ x(EIO, trigger_stripe_pointer) \x (EIO , metadata_bucket_inconsistency) \
@@ -290,7 +294,19 @@ x(EIO, EIO_fault_injected) \ x(EIO, ec_block_read) \ x(EIO, ec_block_write) \ - x(EIO, data_read) \ + x(EIO, recompute_checksum) \ + x(EIO, decompress) \ + x(BCH_ERR_decompress, decompress_exceeded_max_encoded_extent) \ + x(BCH_ERR_decompress, decompress_lz4) \ + x(BCH_ERR_decompress, decompress_gzip) \ + x(BCH_ERR_decompress, decompress_zstd_src_len_bad) \ + x(BCH_ERR_decompress, decompress_zstd) \ + x(EIO, data_write) \ + x(BCH_ERR_data_write, data_write_io) \ + x(BCH_ERR_data_write, data_write_csum) \ + x(BCH_ERR_data_write, data_write_invalid_ptr) \ + x(BCH_ERR_data_write, data_write_misaligned) \ + x(BCH_ERR_decompress, data_read) \ x(BCH_ERR_data_read, no_device_to_read_from) \ x(BCH_ERR_data_read, data_read_io_err) \x (BCH_ERR_data_read, data_read_csum_err) \
fs/bcachefs/inode.c +2 -2
@@ -1079,7 +1079,7 @@ int bch2_inode_rm(struct bch_fs *c, subvol_inum inum)bch2_fs_inconsistent (c,"inode %llu:%u not found when deleting" , inum.inum, snapshot); - ret = -EIO ; + ret = -BCH_ERR_ENOENT_inode; goto err; }
@@ -1243,7 +1243,7 @@ static noinline int __bch2_inode_rm_snapshot(struct btree_trans *trans, u64 inumbch2_fs_inconsistent (c,"inode %llu:%u not found when deleting" , inum, snapshot); - ret = -EIO ; + ret = -BCH_ERR_ENOENT_inode; goto err; }
fs/bcachefs/io_write.c +7 -7
@@ -535,7 +535,7 @@ static noinline int bch2_write_drop_io_error_ptrs(struct bch_write_op *op) test_bit(ptr->dev, op->failed.d));if (!bch2_bkey_nr_ptrs (bkey_i_to_s_c (src))) -return -EIO ; +return -BCH_ERR_data_write_io; }if (dst != src)
@@ -589,7 +589,7 @@ static void __bch2_write_index(struct bch_write_op *op) out:/* If some a bucket wasn't written, we can't erasure code it: */ for_each_set_bit (dev, op->failed.d,BCH_SB_MEMBERS_MAX ) -bch2_open_bucket_write_error (c, &op->open_buckets, dev); +bch2_open_bucket_write_error (c, &op->open_buckets, dev, -BCH_ERR_data_write_io);bch2_open_buckets_put (c, &op->open_buckets);return ;
@@ -920,7 +920,7 @@ static noinline int bch2_write_prep_encoded_data(struct bch_write_op *op, structreturn 0 ; csum_err:bch2_write_csum_err_msg (op); -return -EIO ; +return -BCH_ERR_data_write_csum; } static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp,
@@ -1127,7 +1127,7 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp,return more; csum_err:bch2_write_csum_err_msg (op); - ret = -EIO ; + ret = -BCH_ERR_data_write_csum; err:if (to_wbio (dst)->bounce)bch2_bio_free_pages_pool (c, dst);
@@ -1233,7 +1233,7 @@ static void bch2_nocow_write_convert_unwritten(struct bch_write_op *op)static void __bch2_nocow_write_done (struct bch_write_op *op) {if (unlikely (op->flags & BCH_WRITE_io_error)) { - op->error = -EIO ; + op->error = -BCH_ERR_data_write_io; }else if (unlikely (op->flags & BCH_WRITE_convert_unwritten))bch2_nocow_write_convert_unwritten (op); }
@@ -1424,7 +1424,7 @@ static void bch2_nocow_write(struct bch_write_op *op) "pointer to invalid bucket in nocow path on device %llu\n %s", stale_at->b.inode, (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) { - ret = -EIO; + ret = -BCH_ERR_data_write_invalid_ptr; } else {/* We can retry this: */ ret = -BCH_ERR_transaction_restart;
@@ -1632,7 +1632,7 @@ CLOSURE_CALLBACK(bch2_write)if (unlikely (bio->bi_iter.bi_size & (c->opts.block_size -1 ))) {bch2_write_op_error (op, op->pos.offset,"misaligned write" ); - op->error = -EIO ; + op->error = -BCH_ERR_data_write_misaligned; goto err; }
fs/bcachefs/journal_io.c +1 -1
@@ -1624,7 +1624,7 @@ static CLOSURE_CALLBACK(journal_write_done)if (!w->devs_written.nr) {bch_err (c,"unable to write journal to sufficient devices" ); - err = -EIO ; + err = -BCH_ERR_journal_write_err; }else {bch2_devlist_to_replicas (&replicas.e, BCH_DATA_journal, w->devs_written);
fs/bcachefs/journal_reclaim.c +2 -4
@@ -645,7 +645,6 @@ static u64 journal_seq_to_flush(struct journal *j)* @j: journal object * @direct: direct or background reclaim? * @kicked: requested to run since we last ran? -* Returns: 0 on success, or -EIO if the journal has been shutdown * * Background journal reclaim writes out btree nodes. It should be run * early enough so that we never completely run out of journal buckets.
@@ -685,10 +684,9 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct, bool kicked)if (kthread &&kthread_should_stop ())break ; -if (bch2_journal_error (j)) { - ret = -EIO ; + ret =bch2_journal_error (j); +if (ret)break ; - }bch2_journal_do_discards (j);
Signature · 1 line
2.49.0