bcachefs: Delete redundant log messages
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 7 Jul 2023 08:38:29 +0000 (04:38 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:06 +0000 (17:10 -0400)
Now that we have distinct error codes for different memory allocation
failures, the early init log messages are no longer needed.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_cache.c
fs/bcachefs/checksum.c
fs/bcachefs/compress.c
fs/bcachefs/fs-io.c
fs/bcachefs/journal.c
fs/bcachefs/recovery.c
fs/bcachefs/super-io.c
fs/bcachefs/super.c

index b36bed3..f1494bd 100644 (file)
@@ -457,21 +457,17 @@ int bch2_fs_btree_cache_init(struct bch_fs *c)
        unsigned i;
        int ret = 0;
 
-       pr_verbose_init(c->opts, "");
-
        ret = rhashtable_init(&bc->table, &bch_btree_cache_params);
        if (ret)
-               goto out;
+               goto err;
 
        bc->table_init_done = true;
 
        bch2_recalc_btree_reserve(c);
 
        for (i = 0; i < bc->reserve; i++)
-               if (!__bch2_btree_node_mem_alloc(c)) {
-                       ret = -BCH_ERR_ENOMEM_fs_btree_cache_init;
-                       goto out;
-               }
+               if (!__bch2_btree_node_mem_alloc(c))
+                       goto err;
 
        list_splice_init(&bc->live, &bc->freeable);
 
@@ -481,9 +477,12 @@ int bch2_fs_btree_cache_init(struct bch_fs *c)
        bc->shrink.scan_objects         = bch2_btree_cache_scan;
        bc->shrink.seeks                = 4;
        ret = register_shrinker(&bc->shrink, "%s/btree_cache", c->name);
-out:
-       pr_verbose_init(c->opts, "ret %i", ret);
-       return ret;
+       if (ret)
+               goto err;
+
+       return 0;
+err:
+       return -BCH_ERR_ENOMEM_fs_btree_cache_init;
 }
 
 void bch2_fs_btree_cache_init_early(struct btree_cache *bc)
index f2a56d7..20d0e8a 100644 (file)
@@ -680,8 +680,6 @@ int bch2_fs_encryption_init(struct bch_fs *c)
        struct bch_key key;
        int ret = 0;
 
-       pr_verbose_init(c->opts, "");
-
        c->sha256 = crypto_alloc_shash("sha256", 0, 0);
        ret = PTR_ERR_OR_ZERO(c->sha256);
        if (ret) {
@@ -707,6 +705,5 @@ int bch2_fs_encryption_init(struct bch_fs *c)
                goto out;
 out:
        memzero_explicit(&key, sizeof(key));
-       pr_verbose_init(c->opts, "ret %i", ret);
        return ret;
 }
index 38a3475..48427a2 100644 (file)
@@ -542,7 +542,7 @@ void bch2_fs_compress_exit(struct bch_fs *c)
        mempool_exit(&c->compression_bounce[READ]);
 }
 
-static int _bch2_fs_compress_init(struct bch_fs *c, u64 features)
+static int __bch2_fs_compress_init(struct bch_fs *c, u64 features)
 {
        size_t decompress_workspace_size = 0;
        bool decompress_workspace_needed;
@@ -612,17 +612,6 @@ static int _bch2_fs_compress_init(struct bch_fs *c, u64 features)
        return 0;
 }
 
-static int __bch2_fs_compress_init(struct bch_fs *c, u64 features)
-{
-       int ret;
-
-       pr_verbose_init(c->opts, "");
-       ret = _bch2_fs_compress_init(c, features);
-       pr_verbose_init(c->opts, "ret %i", ret);
-
-       return ret;
-}
-
 int bch2_fs_compress_init(struct bch_fs *c)
 {
        u64 f = c->sb.features;
index 513ffb5..cb654cf 100644 (file)
@@ -3915,10 +3915,6 @@ void bch2_fs_fsio_exit(struct bch_fs *c)
 
 int bch2_fs_fsio_init(struct bch_fs *c)
 {
-       int ret = 0;
-
-       pr_verbose_init(c->opts, "");
-
        if (bioset_init(&c->writepage_bioset,
                        4, offsetof(struct bch_writepage_io, op.wbio.bio),
                        BIOSET_NEED_BVECS))
@@ -3938,8 +3934,7 @@ int bch2_fs_fsio_init(struct bch_fs *c)
                        1, offsetof(struct nocow_flush, bio), 0))
                return -BCH_ERR_ENOMEM_nocow_flush_bioset_init;
 
-       pr_verbose_init(c->opts, "ret %i", ret);
-       return ret;
+       return 0;
 }
 
 #endif /* NO_BCACHEFS_FS */
index f33ab45..9c4f61a 100644 (file)
@@ -1220,12 +1220,8 @@ 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;
        unsigned i;
-       int ret = 0;
-
-       pr_verbose_init(c->opts, "");
 
        spin_lock_init(&j->lock);
        spin_lock_init(&j->err_lock);
@@ -1242,24 +1238,18 @@ int bch2_fs_journal_init(struct journal *j)
                ((union journal_res_state)
                 { .cur_entry_offset = JOURNAL_ENTRY_CLOSED_VAL }).v);
 
-       if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL))) {
-               ret = -BCH_ERR_ENOMEM_journal_pin_fifo;
-               goto out;
-       }
+       if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)))
+               return -BCH_ERR_ENOMEM_journal_pin_fifo;
 
        for (i = 0; i < ARRAY_SIZE(j->buf); i++) {
                j->buf[i].buf_size = JOURNAL_ENTRY_SIZE_MIN;
                j->buf[i].data = kvpmalloc(j->buf[i].buf_size, GFP_KERNEL);
-               if (!j->buf[i].data) {
-                       ret = -BCH_ERR_ENOMEM_journal_buf;
-                       goto out;
-               }
+               if (!j->buf[i].data)
+                       return -BCH_ERR_ENOMEM_journal_buf;
        }
 
        j->pin.front = j->pin.back = 1;
-out:
-       pr_verbose_init(c->opts, "ret %i", ret);
-       return ret;
+       return 0;
 }
 
 /* debug: */
index 9b49a6b..9ea85b0 100644 (file)
@@ -1504,8 +1504,6 @@ out:
 
        if (ret)
                bch_err_fn(c, ret);
-       else
-               bch_verbose(c, "ret %s", bch2_err_str(ret));
        return ret;
 err:
 fsck_err:
index 71764e0..7f3e358 100644 (file)
@@ -615,8 +615,6 @@ int bch2_read_super(const char *path, struct bch_opts *opts,
        __le64 *i;
        int ret;
 
-       pr_verbose_init(*opts, "");
-
        memset(sb, 0, sizeof(*sb));
        sb->mode        = BLK_OPEN_READ;
        sb->have_bio    = true;
@@ -726,7 +724,6 @@ got_super:
                goto err_no_print;
        }
 out:
-       pr_verbose_init(*opts, "ret %i", ret);
        printbuf_exit(&err);
        return ret;
 err:
index 061a151..06d4614 100644 (file)
@@ -651,8 +651,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);
@@ -863,7 +861,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);
@@ -1179,8 +1176,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;
 
@@ -1191,14 +1186,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)
@@ -1874,8 +1866,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;
@@ -1947,8 +1937,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",