]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/journal.c
Update bcachefs sources to e99d29e402 bcachefs: zstd support, compression refactoring
[bcachefs-tools-debian] / libbcachefs / journal.c
index a1e45625704afd42509f8f3a20c8132554b5dbf0..8ce1745233e53e1ce3f8eb3a843c195436e35dc6 100644 (file)
@@ -1046,12 +1046,11 @@ int bch2_journal_read(struct bch_fs *c, struct list_head *list)
 
                if (!degraded &&
                    (test_bit(BCH_FS_REBUILD_REPLICAS, &c->flags) ||
-                    fsck_err_on(!bch2_sb_has_replicas(c, BCH_DATA_JOURNAL,
+                    fsck_err_on(!bch2_replicas_marked(c, BCH_DATA_JOURNAL,
                                                       i->devs), c,
                                 "superblock not marked as containing replicas (type %u)",
                                 BCH_DATA_JOURNAL))) {
-                       ret = bch2_check_mark_super(c, BCH_DATA_JOURNAL,
-                                                   i->devs);
+                       ret = bch2_mark_replicas(c, BCH_DATA_JOURNAL, i->devs);
                        if (ret)
                                return ret;
                }
@@ -2232,7 +2231,7 @@ static void journal_write_done(struct closure *cl)
                goto err;
        }
 
-       if (bch2_check_mark_super(c, BCH_DATA_JOURNAL, devs))
+       if (bch2_mark_replicas(c, BCH_DATA_JOURNAL, devs))
                goto err;
 out:
        __bch2_time_stats_update(j->write_time, j->write_start_time);
@@ -2851,7 +2850,7 @@ int bch2_journal_flush_device(struct journal *j, int dev_idx)
                seq++;
 
                spin_unlock(&j->lock);
-               ret = bch2_check_mark_super(c, BCH_DATA_JOURNAL, devs);
+               ret = bch2_mark_replicas(c, BCH_DATA_JOURNAL, devs);
                spin_lock(&j->lock);
        }
        spin_unlock(&j->lock);
@@ -2946,7 +2945,11 @@ void bch2_fs_journal_exit(struct journal *j)
 
 int bch2_fs_journal_init(struct journal *j)
 {
+       struct bch_fs *c = container_of(j, struct bch_fs, journal);
        static struct lock_class_key res_key;
+       int ret = 0;
+
+       pr_verbose_init(c->opts, "");
 
        spin_lock_init(&j->lock);
        spin_lock_init(&j->err_lock);
@@ -2972,12 +2975,15 @@ int bch2_fs_journal_init(struct journal *j)
 
        if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)) ||
            !(j->buf[0].data = kvpmalloc(j->buf[0].size, GFP_KERNEL)) ||
-           !(j->buf[1].data = kvpmalloc(j->buf[1].size, GFP_KERNEL)))
-               return -ENOMEM;
+           !(j->buf[1].data = kvpmalloc(j->buf[1].size, GFP_KERNEL))) {
+               ret = -ENOMEM;
+               goto out;
+       }
 
        j->pin.front = j->pin.back = 1;
-
-       return 0;
+out:
+       pr_verbose_init(c->opts, "ret %i", ret);
+       return ret;
 }
 
 /* debug: */