]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/journal.c
Update bcachefs sources to 84505cfd37 bcachefs: Go RW before check_alloc_info()
[bcachefs-tools-debian] / libbcachefs / journal.c
index 95c29229d3fe658c6ff9e58361bdf0b2c125e50a..e35b685a6770df57484f8aceeb7f9883793735cd 100644 (file)
@@ -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);