Skip to content

Commit

Permalink
rename block to buffer in copy opts and constants
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Moody <moody20@llnl.gov>
  • Loading branch information
adammoody committed Jan 27, 2021
1 parent a6a39f3 commit 1968c5d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/common/mfu_flist.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ extern "C" {
#define MFU_CHUNK_SIZE (4*1024*1024)

/* default buffer size to read/write data to file system */
#define MFU_BLOCK_SIZE_STR "4MB"
#define MFU_BLOCK_SIZE (4*1024*1024)
#define MFU_BUFFER_SIZE_STR "4MB"
#define MFU_BUFFER_SIZE (4*1024*1024)

/*
* FIXME: Is this description correct?
Expand Down
2 changes: 1 addition & 1 deletion src/common/mfu_flist_archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -5771,7 +5771,7 @@ mfu_archive_opts_t* mfu_archive_opts_new(void)
opts->chunk_size = MFU_CHUNK_SIZE;

/* buffer size for individual read/write operations */
opts->buf_size = MFU_BLOCK_SIZE;
opts->buf_size = MFU_BUFFER_SIZE;

/* max buffer size for reading in a full archive file */
opts->mem_size = 256ULL * 1024ULL * 1024ULL;
Expand Down
20 changes: 10 additions & 10 deletions src/common/mfu_flist_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1653,10 +1653,10 @@ static int mfu_copy_file_normal(
mfu_file_t* mfu_dst_file)
{
/* set buffer and buffer size */
size_t buf_size = copy_opts->block_size;
size_t buf_size = copy_opts->buf_size;
void* buf = copy_opts->block_buf1;

/* for O_DIRECT, check that length is multiple of block_size */
/* for O_DIRECT, check that length is multiple of buf_size */
if (copy_opts->direct && /* using O_DIRECT */
offset + length < file_size && /* not at end of file */
length % buf_size != 0) /* length not an integer multiple of block size */
Expand Down Expand Up @@ -1916,7 +1916,7 @@ static int mfu_copy_file_fiemap(
size_t ext_len;
size_t ext_hole_size;

size_t buf_size = copy_opts->block_size;
size_t buf_size = copy_opts->buf_size;
void* buf = copy_opts->block_buf1;

ext_start = fiemap->fm_extents[i].fe_logical;
Expand Down Expand Up @@ -2383,8 +2383,8 @@ int mfu_flist_copy(

/* allocate buffer to read/write files, aligned on 1MB boundaraies */
size_t alignment = 1024*1024;
copy_opts->block_buf1 = (char*) MFU_MEMALIGN(copy_opts->block_size, alignment);
copy_opts->block_buf2 = (char*) MFU_MEMALIGN(copy_opts->block_size, alignment);
copy_opts->block_buf1 = (char*) MFU_MEMALIGN(copy_opts->buf_size, alignment);
copy_opts->block_buf2 = (char*) MFU_MEMALIGN(copy_opts->buf_size, alignment);

/* Grab a relative and actual start time for the epilogue. */
time(&(mfu_copy_stats.time_started));
Expand Down Expand Up @@ -2775,7 +2775,7 @@ static int mfu_fill_file(
}

/* get buffer */
size_t buf_size = copy_opts->block_size;
size_t buf_size = copy_opts->buf_size;
void* buf = copy_opts->block_buf1;

/* fill buffer with data */
Expand Down Expand Up @@ -2860,12 +2860,12 @@ int mfu_flist_fill(mfu_flist list, mfu_copy_opts_t* copy_opts, mfu_file_t* mfu_f

/* allocate buffer to write files, aligned on 1MB boundaraies */
size_t alignment = 1024*1024;
copy_opts->block_buf1 = (char*) MFU_MEMALIGN(copy_opts->block_size, alignment);
copy_opts->block_buf1 = (char*) MFU_MEMALIGN(copy_opts->buf_size, alignment);

/* fill buffer with data */
//memset(copy_opts->block_buf1, 0, copy_opts->block_size);
//memset(copy_opts->block_buf1, 0, copy_opts->buf_size);
size_t idx;
for (idx = 0; idx < copy_opts->block_size; idx++) {
for (idx = 0; idx < copy_opts->buf_size; idx++) {
copy_opts->block_buf1[idx] = (char) rand();
}

Expand Down Expand Up @@ -3272,7 +3272,7 @@ mfu_copy_opts_t* mfu_copy_opts_new(void)
opts->chunk_size = MFU_CHUNK_SIZE;

/* temporaries used during the copy operation for buffers to read/write data */
opts->block_size = MFU_BLOCK_SIZE;
opts->buf_size = MFU_BUFFER_SIZE;
opts->block_buf1 = NULL;
opts->block_buf2 = NULL;

Expand Down
2 changes: 1 addition & 1 deletion src/common/mfu_param_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ typedef struct {
bool direct; /* whether to use O_DIRECT */
bool sparse; /* whether to create sparse files */
size_t chunk_size; /* size to chunk files by */
size_t block_size; /* block size to read/write to file system */
size_t buf_size; /* buffer size to read/write to file system */
char* block_buf1; /* buffer to read / write data */
char* block_buf2; /* another buffer to read / write data */
int grouplock_id; /* Lustre grouplock ID */
Expand Down
2 changes: 1 addition & 1 deletion src/common/mfu_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ int mfu_compare_contents(
{
/* extract values from copy options */
int direct = copy_opts->direct;
size_t buf_size = copy_opts->block_size;
size_t buf_size = copy_opts->buf_size;

/* for O_DIRECT, check that length is a multiple of buf_size */
if (direct && /* using O_DIRECT */
Expand Down
4 changes: 2 additions & 2 deletions src/dcmp/dcmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void print_usage(void)
printf(" -o, --output <EXPR:FILE> - write list of entries matching EXPR to FILE\n");
printf(" -t, --text - change output option to write in text format\n");
printf(" -b, --base - enable base checks and normal output with --output\n");
printf(" --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BLOCK_SIZE_STR ")\n");
printf(" --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BUFFER_SIZE_STR ")\n");
printf(" --chunksize <SIZE> - minimum work size per task in bytes (default " MFU_CHUNK_SIZE_STR ")\n");
#ifdef DAOS_SUPPORT
printf(" --daos-prefix - DAOS prefix for unified namespace path\n");
Expand Down Expand Up @@ -2150,7 +2150,7 @@ int main(int argc, char **argv)
}
usage = 1;
} else {
copy_opts->block_size = (size_t)bytes;
copy_opts->buf_size = (size_t)bytes;
}
break;
case 'k':
Expand Down
4 changes: 2 additions & 2 deletions src/dcp/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void print_usage(void)
#ifdef LUSTRE_SUPPORT
/* printf(" -g, --grouplock <id> - use Lustre grouplock when reading/writing file\n"); */
#endif
printf(" -b, --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BLOCK_SIZE_STR ")\n");
printf(" -b, --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BUFFER_SIZE_STR ")\n");
printf(" -k, --chunksize <SIZE> - work size per task in bytes (default " MFU_CHUNK_SIZE_STR ")\n");
#ifdef DAOS_SUPPORT
printf(" --daos-prefix - DAOS prefix for unified namespace path\n");
Expand Down Expand Up @@ -180,7 +180,7 @@ int main(int argc, char** argv)
}
usage = 1;
} else {
mfu_copy_opts->block_size = (size_t)bytes;
mfu_copy_opts->buf_size = (size_t)bytes;
}
break;
case 'd':
Expand Down
4 changes: 2 additions & 2 deletions src/dsync/dsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void print_usage(void)
printf("Options:\n");
printf(" --dryrun - show differences, but do not synchronize files\n");
printf(" -b --batch-files <N> - batch files into groups of N during copy\n");
printf(" --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BLOCK_SIZE_STR ")\n");
printf(" --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BUFFER_SIZE_STR ")\n");
printf(" --chunksize <SIZE> - minimum work size per task in bytes (default " MFU_CHUNK_SIZE_STR ")\n");
#ifdef DAOS_SUPPORT
printf(" --daos-prefix - DAOS prefix for unified namespace path \n");
Expand Down Expand Up @@ -2934,7 +2934,7 @@ int main(int argc, char **argv)
}
usage = 1;
} else {
copy_opts->block_size = (size_t)bytes;
copy_opts->buf_size = (size_t)bytes;
}
break;
case 'k':
Expand Down
2 changes: 1 addition & 1 deletion src/dtar/dtar.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static void print_usage(void)
// printf(" --preserve-acls - preserve acls (default ignores acls)\n");
// printf(" --preserve-flags - preserve fflags (default ignores ioctl iflags)\n");
printf(" --fsync - sync file data to disk on close\n");
printf(" -b, --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BLOCK_SIZE_STR ")\n");
printf(" -b, --bufsize <SIZE> - IO buffer size in bytes (default " MFU_BUFFER_SIZE_STR ")\n");
printf(" -k, --chunksize <SIZE> - work size per task in bytes (default " MFU_CHUNK_SIZE_STR ")\n");
printf(" --memsize <SIZE> - memory limit per task for parallel read in bytes (default 256MB)\n");
printf(" --progress <N> - print progress every N seconds\n");
Expand Down

0 comments on commit 1968c5d

Please sign in to comment.