mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Fix some misuses of the MiB and MB units
This commit is contained in:
parent
74fa6e9274
commit
9ade11483e
7 changed files with 27 additions and 22 deletions
|
|
@ -72,7 +72,7 @@ void io_init(struct snapraid_io* io, struct snapraid_state* state,
|
|||
allocated += state->block_size * buffer_max;
|
||||
}
|
||||
|
||||
msg_progress("Using %u MiB of memory for the MT buffers.\n", (unsigned)(allocated / (1024 * 1024)));
|
||||
msg_progress("Using %u MiB of memory for the IO cache.\n", (unsigned)(allocated / MEBI));
|
||||
|
||||
if (parity_writer) {
|
||||
io->reader_max = handle_max;
|
||||
|
|
|
|||
16
cmdline/io.h
16
cmdline/io.h
|
|
@ -30,14 +30,14 @@
|
|||
*
|
||||
* This is the scrub performance on my machine with different buffers:
|
||||
*
|
||||
* 1 - 380 MiB/s, CPU 26%, speed 100% [SnapRAID 9.2]
|
||||
* 2 - 426 MiB/s, CPU 46%, speed 112%
|
||||
* 4 - 452 MiB/s, CPU 54%, speed 118%
|
||||
* 8 - 487 MiB/s, CPU 60%, speed 128%
|
||||
* 16 - 505 MiB/s, CPU 63%, speed 132%
|
||||
* 32 - 520 MiB/s, CPU 64%, speed 136%
|
||||
* 64 - 524 MiB/s, CPU 65%, speed 137%
|
||||
* 128 - 525 MiB/s, CPU 66%, speed 138%
|
||||
* 1 - 380 MB/s, CPU 26%, speed 100% [SnapRAID 9.2]
|
||||
* 2 - 426 MB/s, CPU 46%, speed 112%
|
||||
* 4 - 452 MB/s, CPU 54%, speed 118%
|
||||
* 8 - 487 MB/s, CPU 60%, speed 128%
|
||||
* 16 - 505 MB/s, CPU 63%, speed 132%
|
||||
* 32 - 520 MB/s, CPU 64%, speed 136%
|
||||
* 64 - 524 MB/s, CPU 65%, speed 137%
|
||||
* 128 - 525 MB/s, CPU 66%, speed 138%
|
||||
*/
|
||||
#define IO_MIN 3 /* required by writers, readers can work also with 2 */
|
||||
#define IO_MAX 128
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ void memory(void)
|
|||
log_tag("memory:link:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_link)));
|
||||
log_tag("memory:dir:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_dir)));
|
||||
|
||||
msg_progress("Using %u MiB of memory for the FileSystem.\n", (unsigned)(malloc_counter_get() / (1024 * 1024)));
|
||||
msg_progress("Using %u MiB of memory for the FileSystem.\n", (unsigned)(malloc_counter_get() / MEBI));
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
/*
|
||||
* Size of the blocks to test.
|
||||
*/
|
||||
#define TEST_SIZE (256 * 1024)
|
||||
#define TEST_SIZE (256 * KIBI)
|
||||
|
||||
/*
|
||||
* Number of data blocks to test.
|
||||
|
|
@ -160,9 +160,9 @@ void speed(int period)
|
|||
|
||||
printf("\n");
|
||||
|
||||
printf("Speed test using %u data buffers of %u bytes, for a total of %u KiB.\n", nd, size, nd * size / 1024);
|
||||
printf("Speed test using %u data buffers of %u bytes, for a total of %u KiB.\n", nd, size, nd * size / KIBI);
|
||||
printf("Memory blocks have a displacement of %u bytes to improve cache performance.\n", RAID_MALLOC_DISPLACEMENT);
|
||||
printf("The reported values are the aggregate bandwidth of all data blocks in MiB/s,\n");
|
||||
printf("The reported values are the aggregate bandwidth of all data blocks in MB/s,\n");
|
||||
printf("not counting parity blocks.\n");
|
||||
printf("\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ void state_init(struct snapraid_state* state)
|
|||
state->autosave = 0;
|
||||
state->need_write = 0;
|
||||
state->checked_read = 0;
|
||||
state->block_size = 256 * 1024; /* default 256 KiB */
|
||||
state->block_size = 256 * KIBI; /* default 256 KiB */
|
||||
state->raid_mode = RAID_MODE_CAUCHY;
|
||||
state->file_mode = MODE_SEQUENTIAL;
|
||||
for (l = 0; l < LEV_MAX; ++l) {
|
||||
|
|
@ -581,7 +581,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (state->block_size > 16 * 1024) {
|
||||
if (state->block_size > 16 * KIBI) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Too big 'blocksize' specification in '%s' at line %u\n", path, line);
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
@ -594,7 +594,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
state->block_size *= 1024;
|
||||
state->block_size *= KIBI;
|
||||
} else if (lev_config_scan(tag, &level, &state->raid_mode) == 0) {
|
||||
char device[PATH_MAX];
|
||||
char* slash;
|
||||
|
|
@ -2378,7 +2378,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
|||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Mismatching 'blocksize' specification in the content file!\n");
|
||||
log_fatal("Please restore the 'blocksize' value in the configuration file to '%u'\n", blksize / 1024);
|
||||
log_fatal("Please restore the 'blocksize' value in the configuration file to '%u'\n", blksize / KIBI);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -3965,7 +3965,7 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
delta_tick_total = tick_total - state->progress_tick_total[oldest];
|
||||
delta_tick_cpu = tick_cpu - state->progress_tick_cpu[oldest];
|
||||
|
||||
/* estimate the speed in MiB/s */
|
||||
/* estimate the speed in MB/s */
|
||||
if (delta_time != 0)
|
||||
out_speed = (unsigned)(delta_size / MEGA / delta_time);
|
||||
|
||||
|
|
@ -3982,9 +3982,9 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
log_tag("run:pos:%u:%u:%" PRIu64 ":%u:%u:%u:%u:%" PRIu64 "\n", blockpos, countpos, countsize, out_perc, out_eta, out_speed, out_cpu, (uint64_t)elapsed);
|
||||
log_flush();
|
||||
} else {
|
||||
msg_bar("%u%%, %u MiB", out_perc, (unsigned)(countsize / MEGA));
|
||||
msg_bar("%u%%, %u MB", out_perc, (unsigned)(countsize / MEGA));
|
||||
if (out_speed)
|
||||
msg_bar(", %u MiB/s", out_speed);
|
||||
msg_bar(", %u MB/s", out_speed);
|
||||
msg_bar(", CPU %u%%", out_cpu);
|
||||
if (out_eta)
|
||||
msg_bar(", %u:%02u ETA", out_eta / 60, out_eta % 60);
|
||||
|
|
@ -4115,7 +4115,7 @@ void generate_configuration(const char* path)
|
|||
printf("# Configuration file generated from %s\n", path);
|
||||
printf("\n");
|
||||
printf("# Use this blocksize\n");
|
||||
printf("blocksize %u\n", state.block_size / 1024);
|
||||
printf("blocksize %u\n", state.block_size / KIBI);
|
||||
printf("\n");
|
||||
for (i = 0; i < state.level; ++i) {
|
||||
printf("# Set the correct path for the %s file\n", lev_name(i));
|
||||
|
|
|
|||
|
|
@ -44,9 +44,14 @@ const char* lev_config_name(unsigned level);
|
|||
/**
|
||||
* Units for disk space.
|
||||
*/
|
||||
#define KILO (1000)
|
||||
#define MEGA (1000 * 1000)
|
||||
#define GIGA (1000 * 1000 * 1000)
|
||||
#define TERA (1000 * 1000 * 1000 * 1000LL)
|
||||
#define KIBI (1024)
|
||||
#define MEBI (1024 * 1024)
|
||||
#define GIBI (1024 * 1024 * 1024)
|
||||
#define TEBI (1024 * 1024 * 1024 * 1024LL)
|
||||
|
||||
/**
|
||||
* File modes.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
/****************************************************************************/
|
||||
/* stream */
|
||||
|
||||
unsigned STREAM_SIZE = 1024 * 64;
|
||||
unsigned STREAM_SIZE = 64 * 1024;
|
||||
|
||||
STREAM* sopen_read(const char* file)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue