bcachefs: Add some printks for error paths
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
f59b346477
commit
1e1a31c4b0
@ -701,8 +701,10 @@ static int bch2_gc_start(struct bch_fs *c,
|
|||||||
|
|
||||||
c->usage_gc = __alloc_percpu_gfp(fs_usage_u64s(c) * sizeof(u64),
|
c->usage_gc = __alloc_percpu_gfp(fs_usage_u64s(c) * sizeof(u64),
|
||||||
sizeof(u64), GFP_KERNEL);
|
sizeof(u64), GFP_KERNEL);
|
||||||
if (!c->usage_gc)
|
if (!c->usage_gc) {
|
||||||
|
bch_err(c, "error allocating c->usage_gc");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
for_each_member_device(ca, c, i) {
|
for_each_member_device(ca, c, i) {
|
||||||
BUG_ON(ca->buckets[1]);
|
BUG_ON(ca->buckets[1]);
|
||||||
@ -713,19 +715,23 @@ static int bch2_gc_start(struct bch_fs *c,
|
|||||||
GFP_KERNEL|__GFP_ZERO);
|
GFP_KERNEL|__GFP_ZERO);
|
||||||
if (!ca->buckets[1]) {
|
if (!ca->buckets[1]) {
|
||||||
percpu_ref_put(&ca->ref);
|
percpu_ref_put(&ca->ref);
|
||||||
|
bch_err(c, "error allocating ca->buckets[gc]");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
ca->usage[1] = alloc_percpu(struct bch_dev_usage);
|
ca->usage[1] = alloc_percpu(struct bch_dev_usage);
|
||||||
if (!ca->usage[1]) {
|
if (!ca->usage[1]) {
|
||||||
|
bch_err(c, "error allocating ca->usage[gc]");
|
||||||
percpu_ref_put(&ca->ref);
|
percpu_ref_put(&ca->ref);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bch2_ec_mem_alloc(c, true);
|
ret = bch2_ec_mem_alloc(c, true);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
bch_err(c, "error allocating ec gc mem");
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
percpu_down_write(&c->mark_lock);
|
percpu_down_write(&c->mark_lock);
|
||||||
|
|
||||||
|
@ -304,8 +304,10 @@ static int replicas_table_update(struct bch_fs *c,
|
|||||||
if (!(new_base = kzalloc(bytes, GFP_NOIO)) ||
|
if (!(new_base = kzalloc(bytes, GFP_NOIO)) ||
|
||||||
!(new_scratch = kmalloc(scratch_bytes, GFP_NOIO)) ||
|
!(new_scratch = kmalloc(scratch_bytes, GFP_NOIO)) ||
|
||||||
(c->usage_gc &&
|
(c->usage_gc &&
|
||||||
!(new_gc = __alloc_percpu_gfp(bytes, sizeof(u64), GFP_NOIO))))
|
!(new_gc = __alloc_percpu_gfp(bytes, sizeof(u64), GFP_NOIO)))) {
|
||||||
|
bch_err(c, "error updating replicas table: memory allocation failure");
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(new_usage); i++)
|
for (i = 0; i < ARRAY_SIZE(new_usage); i++)
|
||||||
if (c->usage[i])
|
if (c->usage[i])
|
||||||
@ -365,7 +367,7 @@ static int bch2_mark_replicas_slowpath(struct bch_fs *c,
|
|||||||
struct bch_replicas_entry *new_entry)
|
struct bch_replicas_entry *new_entry)
|
||||||
{
|
{
|
||||||
struct bch_replicas_cpu new_r, new_gc;
|
struct bch_replicas_cpu new_r, new_gc;
|
||||||
int ret = -ENOMEM;
|
int ret = 0;
|
||||||
|
|
||||||
verify_replicas_entry(new_entry);
|
verify_replicas_entry(new_entry);
|
||||||
|
|
||||||
@ -412,14 +414,16 @@ static int bch2_mark_replicas_slowpath(struct bch_fs *c,
|
|||||||
swap(new_gc, c->replicas_gc);
|
swap(new_gc, c->replicas_gc);
|
||||||
percpu_up_write(&c->mark_lock);
|
percpu_up_write(&c->mark_lock);
|
||||||
out:
|
out:
|
||||||
ret = 0;
|
|
||||||
err:
|
|
||||||
mutex_unlock(&c->sb_lock);
|
mutex_unlock(&c->sb_lock);
|
||||||
|
|
||||||
kfree(new_r.entries);
|
kfree(new_r.entries);
|
||||||
kfree(new_gc.entries);
|
kfree(new_gc.entries);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
err:
|
||||||
|
bch_err(c, "error adding replicas entry: memory allocation failure");
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bch2_mark_replicas(struct bch_fs *c,
|
int bch2_mark_replicas(struct bch_fs *c,
|
||||||
@ -564,6 +568,7 @@ int bch2_replicas_gc_start(struct bch_fs *c, unsigned typemask)
|
|||||||
GFP_NOIO);
|
GFP_NOIO);
|
||||||
if (!c->replicas_gc.entries) {
|
if (!c->replicas_gc.entries) {
|
||||||
mutex_unlock(&c->sb_lock);
|
mutex_unlock(&c->sb_lock);
|
||||||
|
bch_err(c, "error allocating c->replicas_gc");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,8 +594,10 @@ retry:
|
|||||||
nr = READ_ONCE(c->replicas.nr);
|
nr = READ_ONCE(c->replicas.nr);
|
||||||
new.entry_size = READ_ONCE(c->replicas.entry_size);
|
new.entry_size = READ_ONCE(c->replicas.entry_size);
|
||||||
new.entries = kcalloc(nr, new.entry_size, GFP_KERNEL);
|
new.entries = kcalloc(nr, new.entry_size, GFP_KERNEL);
|
||||||
if (!new.entries)
|
if (!new.entries) {
|
||||||
|
bch_err(c, "error allocating c->replicas_gc");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_lock(&c->sb_lock);
|
mutex_lock(&c->sb_lock);
|
||||||
percpu_down_write(&c->mark_lock);
|
percpu_down_write(&c->mark_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user