This is because get_bucket() never returns 0 on error,
it always returns a non-zero value. So if you
assert(get_bucket(item)), you always get a postive answer.
Replace existence check for a specific item
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
return false;
}
+ assert(bucket_exists(id));
crush_bucket *b = get_bucket(id);
- assert(b);
// see if item exists in this bucket
for (unsigned j=0; j<b->size; j++) {
return (-EINVAL);
// check that the bucket that we want to detach exists
- assert( get_bucket(item) );
+ assert(bucket_exists(item));
// get the bucket's weight
crush_bucket *b = get_bucket(item);