summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-07-07 17:09:26 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:06 -0400
commit7c50140fce00120b1dcf674759393267689ca2d8 (patch)
tree7aa467e2320738803ec073de2566810f7ad95ca9
parentc8b4534d820f47480e7d5efb38d13e10919ccc7c (diff)
downloadlinux-7c50140fce00120b1dcf674759393267689ca2d8.tar.gz
linux-7c50140fce00120b1dcf674759393267689ca2d8.tar.bz2
linux-7c50140fce00120b1dcf674759393267689ca2d8.zip
bcachefs: Convert more -EROFS to private error codes
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/ec.c6
-rw-r--r--fs/bcachefs/errcode.h3
-rw-r--r--fs/bcachefs/journal.c2
-rw-r--r--fs/bcachefs/super.c11
4 files changed, 13 insertions, 9 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index d35a59e2d0e9..efbb7cf7a5d0 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -1024,7 +1024,7 @@ static void zero_out_rest_of_ec_bucket(struct bch_fs *c,
int ret;
if (!bch2_dev_get_ioref(ca, WRITE)) {
- s->err = -EROFS;
+ s->err = -BCH_ERR_erofs_no_writes;
return;
}
@@ -1401,7 +1401,7 @@ __bch2_ec_stripe_head_get(struct btree_trans *trans,
return ERR_PTR(ret);
if (test_bit(BCH_FS_GOING_RO, &c->flags)) {
- h = ERR_PTR(-EROFS);
+ h = ERR_PTR(-BCH_ERR_erofs_no_writes);
goto found;
}
@@ -1774,7 +1774,7 @@ static void __bch2_ec_stop(struct bch_fs *c, struct bch_dev *ca)
}
goto unlock;
found:
- h->s->err = -EROFS;
+ h->s->err = -BCH_ERR_erofs_no_writes;
ec_stripe_set_pending(c, h);
unlock:
mutex_unlock(&h->lock);
diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h
index 1e06d95f3484..d5277ec7372f 100644
--- a/fs/bcachefs/errcode.h
+++ b/fs/bcachefs/errcode.h
@@ -175,6 +175,9 @@
x(EROFS, erofs_no_writes) \
x(EROFS, erofs_journal_err) \
x(EROFS, erofs_sb_err) \
+ x(EROFS, erofs_unfixed_errors) \
+ x(EROFS, erofs_norecovery) \
+ x(EROFS, erofs_nochanges) \
x(EROFS, insufficient_devices) \
x(0, operation_blocked) \
x(BCH_ERR_operation_blocked, btree_cache_cannibalize_lock_blocked) \
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 9c4f61ab33e4..80a612c0577f 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -494,7 +494,7 @@ unlock:
}
return ret == JOURNAL_ERR_insufficient_devices
- ? -EROFS
+ ? -BCH_ERR_erofs_journal_err
: -BCH_ERR_journal_res_get_blocked;
}
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 06d461423da5..6ab98c2299dd 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -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)) {
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))
return 0;
+ if (c->opts.norecovery)
+ return -BCH_ERR_erofs_norecovery;
+
/*
* nochanges is used for fsck -n mode - we have to allow going rw
* during recovery for that to work:
*/
- if (c->opts.norecovery ||
- (c->opts.nochanges &&
- (!early || c->opts.read_only)))
- return -EROFS;
+ if (c->opts.nochanges && (!early || c->opts.read_only))
+ return -BCH_ERR_erofs_nochanges;
bch_info(c, "going read-write");