]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/super.c
Update bcachefs sources to da7d42a9a2 bcachefs: Add new assertions for shutdown path
[bcachefs-tools-debian] / libbcachefs / super.c
index 6fa805cb4bc51cb08147fd90d477e54e9b30d53f..426d2acfcab93c97cff9e3d69aa806dde67221c3 100644 (file)
@@ -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");
 
@@ -653,8 +654,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
        unsigned i, iter_size;
        int ret = 0;
 
-       pr_verbose_init(opts, "");
-
        c = kvpmalloc(sizeof(struct bch_fs), GFP_KERNEL|__GFP_ZERO);
        if (!c) {
                c = ERR_PTR(-BCH_ERR_ENOMEM_fs_alloc);
@@ -865,7 +864,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
        if (ret)
                goto err;
 out:
-       pr_verbose_init(opts, "ret %i", PTR_ERR_OR_ZERO(c));
        return c;
 err:
        bch2_fs_free(c);
@@ -1181,8 +1179,6 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
        struct bch_dev *ca = NULL;
        int ret = 0;
 
-       pr_verbose_init(c->opts, "");
-
        if (bch2_fs_init_fault("dev_alloc"))
                goto err;
 
@@ -1193,14 +1189,11 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
        ca->fs = c;
 
        bch2_dev_attach(c, ca, dev_idx);
-out:
-       pr_verbose_init(c->opts, "ret %i", ret);
        return ret;
 err:
        if (ca)
                bch2_dev_free(ca);
-       ret = -BCH_ERR_ENOMEM_dev_alloc;
-       goto out;
+       return -BCH_ERR_ENOMEM_dev_alloc;
 }
 
 static int __bch2_dev_attach_bdev(struct bch_dev *ca, struct bch_sb_handle *sb)
@@ -1878,8 +1871,6 @@ struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices,
        if (!try_module_get(THIS_MODULE))
                return ERR_PTR(-ENODEV);
 
-       pr_verbose_init(opts, "");
-
        if (!nr_devices) {
                ret = -EINVAL;
                goto err;
@@ -1951,8 +1942,6 @@ out:
        kfree(sb);
        printbuf_exit(&errbuf);
        module_put(THIS_MODULE);
-       pr_verbose_init(opts, "ret %s (%i)", bch2_err_str(PTR_ERR_OR_ZERO(c)),
-                       PTR_ERR_OR_ZERO(c));
        return c;
 err_print:
        pr_err("bch_fs_open err opening %s: %s",