X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libbcachefs%2Falloc_foreground.c;h=ce365fec7f4129ed45089d06d461c1f7ff873677;hb=99caca2c70f312c4a2504a7e7a9c92a91426d885;hp=dce227c54a7ed980416ce0d5490adee010be8c4f;hpb=7af94e14b5a9945c28a3c34e58b920e81c696a53;p=bcachefs-tools-debian diff --git a/libbcachefs/alloc_foreground.c b/libbcachefs/alloc_foreground.c index dce227c..ce365fe 100644 --- a/libbcachefs/alloc_foreground.c +++ b/libbcachefs/alloc_foreground.c @@ -268,7 +268,6 @@ static struct open_bucket *__try_alloc_bucket(struct bch_fs *c, struct bch_dev * spin_unlock(&c->freelist_lock); - trace_and_count(c, bucket_alloc, ca, bch2_alloc_reserves[reserve]); return ob; } @@ -575,7 +574,10 @@ err: if (!ob) ob = ERR_PTR(-BCH_ERR_no_buckets_found); - if (IS_ERR(ob)) + if (!IS_ERR(ob)) + trace_and_count(c, bucket_alloc, ca, bch2_alloc_reserves[reserve], + may_alloc_partial, ob->bucket); + else trace_and_count(c, bucket_alloc_fail, ca, bch2_alloc_reserves[reserve], usage.d[BCH_DATA_free].buckets, @@ -1223,7 +1225,9 @@ err: if (bch2_err_matches(ret, BCH_ERR_open_buckets_empty) || bch2_err_matches(ret, BCH_ERR_freelist_empty)) - return cl ? ERR_PTR(-EAGAIN) : ERR_PTR(-ENOSPC); + return cl + ? ERR_PTR(-EAGAIN) + : ERR_PTR(-BCH_ERR_ENOSPC_bucket_alloc); if (bch2_err_matches(ret, BCH_ERR_insufficient_devices)) return ERR_PTR(-EROFS);