btrfs-progs: use our ASSERT macro everywhere
Switch the remaining use of assert() as it lacks the verbose assert that we have for ASSERT (but otherwise is equivalent). Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
2b909aa5db
commit
a3588b1ef6
|
@ -381,15 +381,15 @@ static void get_raid56_space_info(struct btrfs_ioctl_space_args *sargs,
|
|||
size = info_ptr->size / (info_ptr->num_stripes - parities_count);
|
||||
|
||||
if (info_ptr->type & BTRFS_BLOCK_GROUP_DATA) {
|
||||
assert(l_data_ratio >= 0);
|
||||
ASSERT(l_data_ratio >= 0);
|
||||
*r_data_chunks += size;
|
||||
*r_data_used += size * l_data_ratio;
|
||||
} else if (info_ptr->type & BTRFS_BLOCK_GROUP_METADATA) {
|
||||
assert(l_metadata_ratio >= 0);
|
||||
ASSERT(l_metadata_ratio >= 0);
|
||||
*r_metadata_chunks += size;
|
||||
*r_metadata_used += size * l_metadata_ratio;
|
||||
} else if (info_ptr->type & BTRFS_BLOCK_GROUP_SYSTEM) {
|
||||
assert(l_system_ratio >= 0);
|
||||
ASSERT(l_system_ratio >= 0);
|
||||
*r_system_chunks += size;
|
||||
*r_system_used += size * l_system_ratio;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <dirent.h>
|
||||
#include <signal.h>
|
||||
|
@ -521,7 +520,7 @@ time2string(char *buf, size_t s, __u64 t)
|
|||
time_t t_time_t;
|
||||
|
||||
t_time_t = (time_t)t;
|
||||
assert((__u64)t_time_t == t);
|
||||
ASSERT((__u64)t_time_t == t);
|
||||
localtime_r(&t_time_t, &t_tm);
|
||||
strftime(buf, s, "%e.%b %T", &t_tm);
|
||||
return buf;
|
||||
|
@ -531,7 +530,7 @@ static char *
|
|||
progress2string(char *buf, size_t s, int progress_1000)
|
||||
{
|
||||
snprintf(buf, s, "%d.%01d%%", progress_1000 / 10, progress_1000 % 10);
|
||||
assert(s > 0);
|
||||
ASSERT(s > 0);
|
||||
buf[s - 1] = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
|
|||
/* Unknown mode */
|
||||
if (!base) {
|
||||
internal_error("unknown unit base, mode %u", unit_mode);
|
||||
assert(0);
|
||||
ASSERT(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
|
|||
if (num_divs >= ARRAY_SIZE(unit_suffix_binary)) {
|
||||
str[0] = '\0';
|
||||
internal_error("unsupported unit suffix, index %d", num_divs);
|
||||
assert(0);
|
||||
ASSERT(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue