mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	bcachefs: Delete redundant log messages
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>
This commit is contained in:
		
							parent
							
								
									8726dc936f
								
							
						
					
					
						commit
						c8b4534d82
					
				
					 8 changed files with 17 additions and 64 deletions
				
			
		| 
						 | 
					@ -457,21 +457,17 @@ int bch2_fs_btree_cache_init(struct bch_fs *c)
 | 
				
			||||||
	unsigned i;
 | 
						unsigned i;
 | 
				
			||||||
	int ret = 0;
 | 
						int ret = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_verbose_init(c->opts, "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ret = rhashtable_init(&bc->table, &bch_btree_cache_params);
 | 
						ret = rhashtable_init(&bc->table, &bch_btree_cache_params);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		goto out;
 | 
							goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bc->table_init_done = true;
 | 
						bc->table_init_done = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bch2_recalc_btree_reserve(c);
 | 
						bch2_recalc_btree_reserve(c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < bc->reserve; i++)
 | 
						for (i = 0; i < bc->reserve; i++)
 | 
				
			||||||
		if (!__bch2_btree_node_mem_alloc(c)) {
 | 
							if (!__bch2_btree_node_mem_alloc(c))
 | 
				
			||||||
			ret = -BCH_ERR_ENOMEM_fs_btree_cache_init;
 | 
								goto err;
 | 
				
			||||||
			goto out;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	list_splice_init(&bc->live, &bc->freeable);
 | 
						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.scan_objects		= bch2_btree_cache_scan;
 | 
				
			||||||
	bc->shrink.seeks		= 4;
 | 
						bc->shrink.seeks		= 4;
 | 
				
			||||||
	ret = register_shrinker(&bc->shrink, "%s/btree_cache", c->name);
 | 
						ret = register_shrinker(&bc->shrink, "%s/btree_cache", c->name);
 | 
				
			||||||
out:
 | 
						if (ret)
 | 
				
			||||||
	pr_verbose_init(c->opts, "ret %i", ret);
 | 
							goto err;
 | 
				
			||||||
	return ret;
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					err:
 | 
				
			||||||
 | 
						return -BCH_ERR_ENOMEM_fs_btree_cache_init;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void bch2_fs_btree_cache_init_early(struct btree_cache *bc)
 | 
					void bch2_fs_btree_cache_init_early(struct btree_cache *bc)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -680,8 +680,6 @@ int bch2_fs_encryption_init(struct bch_fs *c)
 | 
				
			||||||
	struct bch_key key;
 | 
						struct bch_key key;
 | 
				
			||||||
	int ret = 0;
 | 
						int ret = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_verbose_init(c->opts, "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	c->sha256 = crypto_alloc_shash("sha256", 0, 0);
 | 
						c->sha256 = crypto_alloc_shash("sha256", 0, 0);
 | 
				
			||||||
	ret = PTR_ERR_OR_ZERO(c->sha256);
 | 
						ret = PTR_ERR_OR_ZERO(c->sha256);
 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
| 
						 | 
					@ -707,6 +705,5 @@ int bch2_fs_encryption_init(struct bch_fs *c)
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	memzero_explicit(&key, sizeof(key));
 | 
						memzero_explicit(&key, sizeof(key));
 | 
				
			||||||
	pr_verbose_init(c->opts, "ret %i", ret);
 | 
					 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -542,7 +542,7 @@ void bch2_fs_compress_exit(struct bch_fs *c)
 | 
				
			||||||
	mempool_exit(&c->compression_bounce[READ]);
 | 
						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;
 | 
						size_t decompress_workspace_size = 0;
 | 
				
			||||||
	bool decompress_workspace_needed;
 | 
						bool decompress_workspace_needed;
 | 
				
			||||||
| 
						 | 
					@ -612,17 +612,6 @@ static int _bch2_fs_compress_init(struct bch_fs *c, u64 features)
 | 
				
			||||||
	return 0;
 | 
						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)
 | 
					int bch2_fs_compress_init(struct bch_fs *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	u64 f = c->sb.features;
 | 
						u64 f = c->sb.features;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3915,10 +3915,6 @@ void bch2_fs_fsio_exit(struct bch_fs *c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int bch2_fs_fsio_init(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,
 | 
						if (bioset_init(&c->writepage_bioset,
 | 
				
			||||||
			4, offsetof(struct bch_writepage_io, op.wbio.bio),
 | 
								4, offsetof(struct bch_writepage_io, op.wbio.bio),
 | 
				
			||||||
			BIOSET_NEED_BVECS))
 | 
								BIOSET_NEED_BVECS))
 | 
				
			||||||
| 
						 | 
					@ -3938,8 +3934,7 @@ int bch2_fs_fsio_init(struct bch_fs *c)
 | 
				
			||||||
			1, offsetof(struct nocow_flush, bio), 0))
 | 
								1, offsetof(struct nocow_flush, bio), 0))
 | 
				
			||||||
		return -BCH_ERR_ENOMEM_nocow_flush_bioset_init;
 | 
							return -BCH_ERR_ENOMEM_nocow_flush_bioset_init;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_verbose_init(c->opts, "ret %i", ret);
 | 
						return 0;
 | 
				
			||||||
	return ret;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* NO_BCACHEFS_FS */
 | 
					#endif /* NO_BCACHEFS_FS */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1220,12 +1220,8 @@ void bch2_fs_journal_exit(struct journal *j)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int bch2_fs_journal_init(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;
 | 
						static struct lock_class_key res_key;
 | 
				
			||||||
	unsigned i;
 | 
						unsigned i;
 | 
				
			||||||
	int ret = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pr_verbose_init(c->opts, "");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_init(&j->lock);
 | 
						spin_lock_init(&j->lock);
 | 
				
			||||||
	spin_lock_init(&j->err_lock);
 | 
						spin_lock_init(&j->err_lock);
 | 
				
			||||||
| 
						 | 
					@ -1242,24 +1238,18 @@ int bch2_fs_journal_init(struct journal *j)
 | 
				
			||||||
		((union journal_res_state)
 | 
							((union journal_res_state)
 | 
				
			||||||
		 { .cur_entry_offset = JOURNAL_ENTRY_CLOSED_VAL }).v);
 | 
							 { .cur_entry_offset = JOURNAL_ENTRY_CLOSED_VAL }).v);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL))) {
 | 
						if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)))
 | 
				
			||||||
		ret = -BCH_ERR_ENOMEM_journal_pin_fifo;
 | 
							return -BCH_ERR_ENOMEM_journal_pin_fifo;
 | 
				
			||||||
		goto out;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < ARRAY_SIZE(j->buf); i++) {
 | 
						for (i = 0; i < ARRAY_SIZE(j->buf); i++) {
 | 
				
			||||||
		j->buf[i].buf_size = JOURNAL_ENTRY_SIZE_MIN;
 | 
							j->buf[i].buf_size = JOURNAL_ENTRY_SIZE_MIN;
 | 
				
			||||||
		j->buf[i].data = kvpmalloc(j->buf[i].buf_size, GFP_KERNEL);
 | 
							j->buf[i].data = kvpmalloc(j->buf[i].buf_size, GFP_KERNEL);
 | 
				
			||||||
		if (!j->buf[i].data) {
 | 
							if (!j->buf[i].data)
 | 
				
			||||||
			ret = -BCH_ERR_ENOMEM_journal_buf;
 | 
								return -BCH_ERR_ENOMEM_journal_buf;
 | 
				
			||||||
			goto out;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	j->pin.front = j->pin.back = 1;
 | 
						j->pin.front = j->pin.back = 1;
 | 
				
			||||||
out:
 | 
						return 0;
 | 
				
			||||||
	pr_verbose_init(c->opts, "ret %i", ret);
 | 
					 | 
				
			||||||
	return ret;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* debug: */
 | 
					/* debug: */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1504,8 +1504,6 @@ int bch2_fs_recovery(struct bch_fs *c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		bch_err_fn(c, ret);
 | 
							bch_err_fn(c, ret);
 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		bch_verbose(c, "ret %s", bch2_err_str(ret));
 | 
					 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
fsck_err:
 | 
					fsck_err:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -615,8 +615,6 @@ int bch2_read_super(const char *path, struct bch_opts *opts,
 | 
				
			||||||
	__le64 *i;
 | 
						__le64 *i;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_verbose_init(*opts, "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	memset(sb, 0, sizeof(*sb));
 | 
						memset(sb, 0, sizeof(*sb));
 | 
				
			||||||
	sb->mode	= BLK_OPEN_READ;
 | 
						sb->mode	= BLK_OPEN_READ;
 | 
				
			||||||
	sb->have_bio	= true;
 | 
						sb->have_bio	= true;
 | 
				
			||||||
| 
						 | 
					@ -726,7 +724,6 @@ int bch2_read_super(const char *path, struct bch_opts *opts,
 | 
				
			||||||
		goto err_no_print;
 | 
							goto err_no_print;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	pr_verbose_init(*opts, "ret %i", ret);
 | 
					 | 
				
			||||||
	printbuf_exit(&err);
 | 
						printbuf_exit(&err);
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -651,8 +651,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
 | 
				
			||||||
	unsigned i, iter_size;
 | 
						unsigned i, iter_size;
 | 
				
			||||||
	int ret = 0;
 | 
						int ret = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_verbose_init(opts, "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	c = kvpmalloc(sizeof(struct bch_fs), GFP_KERNEL|__GFP_ZERO);
 | 
						c = kvpmalloc(sizeof(struct bch_fs), GFP_KERNEL|__GFP_ZERO);
 | 
				
			||||||
	if (!c) {
 | 
						if (!c) {
 | 
				
			||||||
		c = ERR_PTR(-BCH_ERR_ENOMEM_fs_alloc);
 | 
							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)
 | 
						if (ret)
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	pr_verbose_init(opts, "ret %i", PTR_ERR_OR_ZERO(c));
 | 
					 | 
				
			||||||
	return c;
 | 
						return c;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
	bch2_fs_free(c);
 | 
						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;
 | 
						struct bch_dev *ca = NULL;
 | 
				
			||||||
	int ret = 0;
 | 
						int ret = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_verbose_init(c->opts, "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (bch2_fs_init_fault("dev_alloc"))
 | 
						if (bch2_fs_init_fault("dev_alloc"))
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1191,14 +1186,11 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
 | 
				
			||||||
	ca->fs = c;
 | 
						ca->fs = c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bch2_dev_attach(c, ca, dev_idx);
 | 
						bch2_dev_attach(c, ca, dev_idx);
 | 
				
			||||||
out:
 | 
					 | 
				
			||||||
	pr_verbose_init(c->opts, "ret %i", ret);
 | 
					 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
	if (ca)
 | 
						if (ca)
 | 
				
			||||||
		bch2_dev_free(ca);
 | 
							bch2_dev_free(ca);
 | 
				
			||||||
	ret = -BCH_ERR_ENOMEM_dev_alloc;
 | 
						return -BCH_ERR_ENOMEM_dev_alloc;
 | 
				
			||||||
	goto out;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __bch2_dev_attach_bdev(struct bch_dev *ca, struct bch_sb_handle *sb)
 | 
					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))
 | 
						if (!try_module_get(THIS_MODULE))
 | 
				
			||||||
		return ERR_PTR(-ENODEV);
 | 
							return ERR_PTR(-ENODEV);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr_verbose_init(opts, "");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!nr_devices) {
 | 
						if (!nr_devices) {
 | 
				
			||||||
		ret = -EINVAL;
 | 
							ret = -EINVAL;
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
| 
						 | 
					@ -1947,8 +1937,6 @@ struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices,
 | 
				
			||||||
	kfree(sb);
 | 
						kfree(sb);
 | 
				
			||||||
	printbuf_exit(&errbuf);
 | 
						printbuf_exit(&errbuf);
 | 
				
			||||||
	module_put(THIS_MODULE);
 | 
						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;
 | 
						return c;
 | 
				
			||||||
err_print:
 | 
					err_print:
 | 
				
			||||||
	pr_err("bch_fs_open err opening %s: %s",
 | 
						pr_err("bch_fs_open err opening %s: %s",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue