Commit 7c50140f authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Convert more -EROFS to private error codes

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c8b4534d
...@@ -1024,7 +1024,7 @@ static void zero_out_rest_of_ec_bucket(struct bch_fs *c, ...@@ -1024,7 +1024,7 @@ static void zero_out_rest_of_ec_bucket(struct bch_fs *c,
int ret; int ret;
if (!bch2_dev_get_ioref(ca, WRITE)) { if (!bch2_dev_get_ioref(ca, WRITE)) {
s->err = -EROFS; s->err = -BCH_ERR_erofs_no_writes;
return; return;
} }
...@@ -1401,7 +1401,7 @@ __bch2_ec_stripe_head_get(struct btree_trans *trans, ...@@ -1401,7 +1401,7 @@ __bch2_ec_stripe_head_get(struct btree_trans *trans,
return ERR_PTR(ret); return ERR_PTR(ret);
if (test_bit(BCH_FS_GOING_RO, &c->flags)) { if (test_bit(BCH_FS_GOING_RO, &c->flags)) {
h = ERR_PTR(-EROFS); h = ERR_PTR(-BCH_ERR_erofs_no_writes);
goto found; goto found;
} }
...@@ -1774,7 +1774,7 @@ static void __bch2_ec_stop(struct bch_fs *c, struct bch_dev *ca) ...@@ -1774,7 +1774,7 @@ static void __bch2_ec_stop(struct bch_fs *c, struct bch_dev *ca)
} }
goto unlock; goto unlock;
found: found:
h->s->err = -EROFS; h->s->err = -BCH_ERR_erofs_no_writes;
ec_stripe_set_pending(c, h); ec_stripe_set_pending(c, h);
unlock: unlock:
mutex_unlock(&h->lock); mutex_unlock(&h->lock);
......
...@@ -175,6 +175,9 @@ ...@@ -175,6 +175,9 @@
x(EROFS, erofs_no_writes) \ x(EROFS, erofs_no_writes) \
x(EROFS, erofs_journal_err) \ x(EROFS, erofs_journal_err) \
x(EROFS, erofs_sb_err) \ x(EROFS, erofs_sb_err) \
x(EROFS, erofs_unfixed_errors) \
x(EROFS, erofs_norecovery) \
x(EROFS, erofs_nochanges) \
x(EROFS, insufficient_devices) \ x(EROFS, insufficient_devices) \
x(0, operation_blocked) \ x(0, operation_blocked) \
x(BCH_ERR_operation_blocked, btree_cache_cannibalize_lock_blocked) \ x(BCH_ERR_operation_blocked, btree_cache_cannibalize_lock_blocked) \
......
...@@ -494,7 +494,7 @@ static int __journal_res_get(struct journal *j, struct journal_res *res, ...@@ -494,7 +494,7 @@ static int __journal_res_get(struct journal *j, struct journal_res *res,
} }
return ret == JOURNAL_ERR_insufficient_devices return ret == JOURNAL_ERR_insufficient_devices
? -EROFS ? -BCH_ERR_erofs_journal_err
: -BCH_ERR_journal_res_get_blocked; : -BCH_ERR_journal_res_get_blocked;
} }
......
...@@ -361,20 +361,21 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early) ...@@ -361,20 +361,21 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
if (test_bit(BCH_FS_INITIAL_GC_UNFIXED, &c->flags)) { if (test_bit(BCH_FS_INITIAL_GC_UNFIXED, &c->flags)) {
bch_err(c, "cannot go rw, unfixed btree errors"); bch_err(c, "cannot go rw, unfixed btree errors");
return -EROFS; return -BCH_ERR_erofs_unfixed_errors;
} }
if (test_bit(BCH_FS_RW, &c->flags)) if (test_bit(BCH_FS_RW, &c->flags))
return 0; return 0;
if (c->opts.norecovery)
return -BCH_ERR_erofs_norecovery;
/* /*
* nochanges is used for fsck -n mode - we have to allow going rw * nochanges is used for fsck -n mode - we have to allow going rw
* during recovery for that to work: * during recovery for that to work:
*/ */
if (c->opts.norecovery || if (c->opts.nochanges && (!early || c->opts.read_only))
(c->opts.nochanges && return -BCH_ERR_erofs_nochanges;
(!early || c->opts.read_only)))
return -EROFS;
bch_info(c, "going read-write"); bch_info(c, "going read-write");
......
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