summaryrefslogtreecommitdiff
path: root/libbcachefs/journal.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-12-13 18:27:31 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2022-12-13 18:27:31 -0500
commit3c0484687d00f3f2818d13c0c6f65123abcf4517 (patch)
treebf288e3d6c1f0c085db0af3fb472f2214c7775f0 /libbcachefs/journal.c
parenta06dee6da2babd19a392ff30a399b89b85018a36 (diff)
Update bcachefs sources to 84505cfd37 bcachefs: Go RW before check_alloc_info()
Diffstat (limited to 'libbcachefs/journal.c')
-rw-r--r--libbcachefs/journal.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/libbcachefs/journal.c b/libbcachefs/journal.c
index 95c29229..e35b685a 100644
--- a/libbcachefs/journal.c
+++ b/libbcachefs/journal.c
@@ -199,12 +199,6 @@ static bool journal_entry_close(struct journal *j)
/*
* should _only_ called from journal_res_get() - when we actually want a
* journal reservation - journal entry is open means journal is dirty:
- *
- * returns:
- * 0: success
- * -ENOSPC: journal currently full, must invoke reclaim
- * -EAGAIN: journal blocked, must wait
- * -EROFS: insufficient rw devices or journal error
*/
static int journal_entry_open(struct journal *j)
{
@@ -353,7 +347,7 @@ retry:
return 0;
if (bch2_journal_error(j))
- return -EROFS;
+ return -BCH_ERR_erofs_journal_err;
spin_lock(&j->lock);
@@ -445,7 +439,9 @@ unlock:
}
}
- return ret == JOURNAL_ERR_insufficient_devices ? -EROFS : -EAGAIN;
+ return ret == JOURNAL_ERR_insufficient_devices
+ ? -EROFS
+ : -BCH_ERR_journal_res_get_blocked;
}
/*
@@ -464,7 +460,8 @@ int bch2_journal_res_get_slowpath(struct journal *j, struct journal_res *res,
int ret;
closure_wait_event(&j->async_wait,
- (ret = __journal_res_get(j, res, flags)) != -EAGAIN ||
+ (ret = __journal_res_get(j, res, flags)) !=
+ -BCH_ERR_journal_res_get_blocked||
(flags & JOURNAL_RES_GET_NONBLOCK));
return ret;
}
@@ -815,12 +812,9 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
} else {
ob[nr_got] = bch2_bucket_alloc(c, ca, RESERVE_none,
false, cl);
- if (IS_ERR(ob[nr_got])) {
- ret = cl
- ? -EAGAIN
- : -BCH_ERR_ENOSPC_bucket_alloc;
+ ret = PTR_ERR_OR_ZERO(ob[nr_got]);
+ if (ret)
break;
- }
bu[nr_got] = ob[nr_got]->bucket;
}
@@ -930,7 +924,7 @@ int bch2_set_nr_journal_buckets(struct bch_fs *c, struct bch_dev *ca,
closure_init_stack(&cl);
- while (ja->nr != nr && (ret == 0 || ret == -EAGAIN)) {
+ while (ja->nr != nr && (ret == 0 || ret == -BCH_ERR_bucket_alloc_blocked)) {
struct disk_reservation disk_res = { 0, 0 };
closure_sync(&cl);