Skip to content

Commit

Permalink
posix: set default stripe count
Browse files Browse the repository at this point in the history
This commit fixes a bug that occurs when the dataset directory is
using the default striping count. In this case the ioctl may return
lmm_stripe_count = 0. Since hio assumes a stripe count >= 1 this was
triggering a problem when setting up the shared memory segment. To be
safe always set the default to 1 (or larger if writing shared files).

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
  • Loading branch information
hjelmn committed Jun 10, 2016
1 parent d6b7e0a commit 83f4931
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/builtin-posix_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ static int builtin_posix_module_dataset_open (struct hio_module_t *module, hio_d
}

if (fs_attr->fs_flags & HIO_FS_SUPPORTS_STRIPING) {
if (HIO_SET_ELEMENT_UNIQUE == dataset->ds_mode) {
/* set defaults striping count */
fs_attr->fs_scount = 1;
} else {
fs_attr->fs_scount = max (1, (unsigned) ((float) fs_attr->fs_smax_count * 0.9));
}

hioi_config_add (context, &dataset->ds_object, &fs_attr->fs_scount,
"stripe_count", HIO_CONFIG_TYPE_UINT32, NULL, "Stripe count for all dataset "
"data files", 0);
Expand Down
4 changes: 2 additions & 2 deletions src/hio_dataset_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int hioi_dataset_buffer_flush (hio_dataset_t dataset) {

int hioi_dataset_shared_init (hio_dataset_t dataset) {
hio_context_t context = hioi_object_context (&dataset->ds_object);
int stripes = dataset->ds_fsattr.fs_scount;
int stripes = max (1, dataset->ds_fsattr.fs_scount);
size_t ds_buffer_size = 512 * 1024;
size_t control_block_size;
MPI_Win shared_win;
Expand Down Expand Up @@ -109,7 +109,7 @@ int hioi_dataset_shared_init (hio_dataset_t dataset) {
pthread_mutexattr_setpshared (&mutex_attr, PTHREAD_PROCESS_SHARED);

/* fixme - not sure this is the right way to ensure stripe 0 mutex gets init'd */
for (int i = 0 ; i < max(1, stripes) ; ++i) {
for (int i = 0 ; i < stripes ; ++i) {
pthread_mutex_init (&dataset->ds_shared_control->s_stripes[i].s_mutex, &mutex_attr);
atomic_init (&dataset->ds_shared_control->s_stripes[i].s_index, 0);
}
Expand Down
6 changes: 5 additions & 1 deletion src/hio_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static int hioi_fs_query_lustre (const char *path, hio_fs_attr_t *fs_attr) {
}
}

fs_attr->fs_scount = lum->lmm_stripe_count;
fs_attr->fs_scount = lum->lmm_stripe_count ? lum->lmm_stripe_count : 1;
fs_attr->fs_ssize = lum->lmm_stripe_size;

switch (lum->lmm_pattern) {
Expand Down Expand Up @@ -276,6 +276,10 @@ int hioi_fs_query (hio_context_t context, const char *path, hio_fs_attr_t *fs_at
fs_attr->fs_btotal = fsinfo.f_blocks;
fs_attr->fs_bsize = fsinfo.f_bsize;

/* set some reasonable defaults for striping parameters */
fs_attr->fs_scount = 1;
fs_attr->fs_ssize = fs_attr->fs_bsize;

/* get filesytem specific data */
switch (fsinfo.f_type) {
#if defined(LL_SUPER_MAGIC)
Expand Down

0 comments on commit 83f4931

Please sign in to comment.