Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs/ufs: change default locking protocol #12756

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ompi/mca/fs/lustre/fs_lustre.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserverd.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -31,6 +32,12 @@
extern int mca_fs_lustre_priority;
extern int mca_fs_lustre_stripe_size;
extern int mca_fs_lustre_stripe_width;
extern int mca_fs_lustre_lock_algorithm;

#define FS_LUSTRE_LOCK_AUTO 0
#define FS_LUSTRE_LOCK_NEVER 1
#define FS_LUSTRE_LOCK_ENTIRE_FILE 2
#define FS_LUSTRE_LOCK_RANGES 3

BEGIN_C_DECLS

Expand Down
11 changes: 11 additions & 0 deletions ompi/mca/fs/lustre/fs_lustre_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserverd.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -45,6 +46,7 @@ int mca_fs_lustre_priority = 20;
runtime also*/
int mca_fs_lustre_stripe_size = 0;
int mca_fs_lustre_stripe_width = 0;
int mca_fs_lustre_lock_algorithm = 0; /* auto */
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
Expand Down Expand Up @@ -93,6 +95,15 @@ lustre_register(void)
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_lustre_stripe_width);
mca_fs_lustre_lock_algorithm = 0;
(void) mca_base_component_var_register(&mca_fs_lustre_component.fsm_version,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (feel free to ignore) This could be more user friendly if it was implemented with mca_base_var_enum_t, but requires more code.

"lock_algorithm", "Locking algorithm used by the fs ufs component. "
" 0: auto (default), 1: skip locking, 2: always lock entire file, "
"3: lock only specific ranges",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&mca_fs_lustre_lock_algorithm );

return OMPI_SUCCESS;
}
17 changes: 16 additions & 1 deletion ompi/mca/fs/lustre/fs_lustre_file_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2015-2020 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserverd.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -175,8 +176,22 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm,
fh->f_stripe_size = lump->lmm_stripe_size;
fh->f_stripe_count = lump->lmm_stripe_count;
fh->f_fs_block_size = lump->lmm_stripe_size;
fh->f_flags |= OMPIO_LOCK_NEVER;
free(lump);

if (FS_LUSTRE_LOCK_AUTO == mca_fs_lustre_lock_algorithm ||
FS_LUSTRE_LOCK_NEVER == mca_fs_lustre_lock_algorithm ) {
fh->f_flags |= OMPIO_LOCK_NEVER;
}
else if (FS_LUSTRE_LOCK_ENTIRE_FILE == mca_fs_lustre_lock_algorithm) {
fh->f_flags |= OMPIO_LOCK_ENTIRE_FILE;
}
else if (FS_LUSTRE_LOCK_RANGES == mca_fs_lustre_lock_algorithm) {
/* Nothing to be done. This is what the posix fbtl component would do
anyway without additional information . */
}
else {
opal_output ( 1, "Invalid value for mca_fs_lustre_lock_algorithm %d", mca_fs_lustre_lock_algorithm );
}

return OMPI_SUCCESS;
}
7 changes: 1 addition & 6 deletions ompi/mca/fs/ufs/fs_ufs_file_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserverd.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -105,12 +106,6 @@ mca_fs_ufs_file_open (struct ompi_communicator_t *comm,
component. */
fh->f_flags |= OMPIO_LOCK_ENTIRE_FILE;
}
else {
fh->f_flags |= OMPIO_LOCK_NEVER;
}
}
else {
fh->f_flags |= OMPIO_LOCK_NEVER;
}
free (fstype);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not knowing this code path very well, it looks to me like you handled Lustre and NFS just fine. However, is there any case other than NFS and Lustre? Seems that previously such a case would have set OMPIO_LOCK_NEVER but now it would be unset (LOCK_RANGES).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fs/ufs component handles everything that is not Lustre at the moment (e.g. NFS, local file systems, BeeGFS, etc.). We treat all of them equal except for NFS. Lustre requires special handling because it allows us to modify some additional parameters (stripe size, stripe count, etc.), hence it has its own component. So from the fs/ufs component perspective its either NFS (in which case we activate locking) or everything else (in which case we now do range locking instead of no locking).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot that we also have separate components for GPFS and IME, not sure how much they are in use however. We also used to have separate components for PVFS2/OrangeFS, but that was removed a few weeks ago.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just re-read the commit message. Your intent is to change those paths from LOCK_NEVER to LOCK_RANGE, which is what you have done. 👍

}
Expand Down
Loading