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

parallel pool import #16093

Merged
merged 1 commit into from
Apr 22, 2024
Merged

parallel pool import #16093

merged 1 commit into from
Apr 22, 2024

Conversation

grwilson
Copy link
Member

This commit allow spa_load() to drop the spa_namespace_lock so that imports can happen concurrently. Prior to dropping the spa_namespace_lock, the import logic will set the spa_load_thread value to track the thread which is doing the import.

Consumers of spa_lookup() retain the same behavior by blocking when either a thread is holding the spa_namespace_lock or the spa_load_thread value is set. This will ensure that critical concurrent operations cannot take place while a pool is being imported.

The zpool command is enhanced to provide multi-threaded support when invoking zpool import -a.

Lastly, zinject provides a mechanism to insert artificial delays when importing a pool and new zfs tests are added to verify parallel import functionality.

Contributions-by: Don Brady don.brady@klarasystems.com

This commit allow spa_load() to drop the spa_namespace_lock so
that imports can happen concurrently. Prior to dropping the
spa_namespace_lock, the import logic will set the spa_load_thread
value to track the thread which is doing the import.

Consumers of spa_lookup() retain the same behavior by blocking
when either a thread is holding the spa_namespace_lock or the
spa_load_thread value is set. This will ensure that critical
concurrent operations cannot take place while a pool is being
imported.

The zpool command is also enhanced to provide multi-threaded support
when invoking zpool import -a.

Lastly, zinject provides a mechanism to insert artificial delays
when importing a pool and new zfs tests are added to verify parallel
import functionality.

Contributions-by: Don Brady <don.brady@klarasystems.com>
Signed-off-by: George Wilson <gwilson@delphix.com>
@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Apr 19, 2024
@behlendorf behlendorf merged commit c183d16 into openzfs:master Apr 22, 2024
24 of 25 checks passed
@mmatuska
Copy link
Contributor

mmatuska commented Apr 29, 2024

@grwilson When compiling 32-bit compat libraries on FreeBSD there is a cast error in

zfs/module/zfs/spa.c

Lines 6774 to 6775 in b28461b

(void) snprintf(name, MAXPATHLEN, "%s-%llx-%s",
TRYIMPORT_NAME, (u_longlong_t)curthread, poolname);

/usr/local/bin/x86_64-unknown-freebsd14.0-gcc13 -march=i686 -mmmx -msse -msse2 -m32    -DCOMPAT_LIBCOMPAT=\"32\"  -DCOMPAT_libcompat=\"32\"  -DCOMPAT_LIB32  --sysroot=/tmp/obj/workspace/src/amd64.amd64/tmp  -B/usr/local/x86_64-unknown-freebsd14.0/bin/ -B/tmp/obj/workspace/src/amd64.amd64/tmp/usr/lib32  -O2 -pipe -fno-common -DHAVE_SSE2       -DHAVE_SSE3 -DIN_BASE  -I/workspace/src/sys/contrib/openzfs/include  -I/workspace/src/sys/contrib/openzfs/lib/libspl/include  -I/workspace/src/sys/contrib/openzfs/lib/libspl/include/os/freebsd  -I/workspace/src/sys  -I/workspace/src/sys/contrib/openzfs/include/os/freebsd/zfs  -I/workspace/src/cddl/compat/opensolaris/include  -I/workspace/src/sys/contrib/openzfs/module/icp/include  -include /workspace/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h  -DHAVE_ISSETUGID  -include /workspace/src/sys/modules/zfs/zfs_config.h  -I/workspace/src/sys/modules/zfs  -I/workspace/src/sys/contrib/openzfs/include/os/freebsd/zfs  -DLIB_ZPOOL_BUILD -DZFS_DEBUG -DWANTS_MUTEX_OWNED -I/workspace/src/lib/libpthread/thread -I/workspace/src/lib/libpthread/sys -I/workspace/src/lib/libthr/arch/i386/include -g -DDEBUG=1  -DNEED_SOLARIS_BOOLEAN -g -MD  -MF.depend.spa.o -MTspa.o -std=iso9899:1999 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wdate-time -Wno-error=address -Wno-error=array-bounds -Wno-error=attributes -Wno-error=bool-compare -Wno-error=cast-align -Wno-error=clobbered -Wno-error=deprecated-declarations -Wno-error=enum-compare -Wno-error=extra -Wno-error=logical-not-parentheses -Wno-error=strict-aliasing -Wno-error=uninitialized -Wno-error=unused-function -Wno-error=unused-value -Wno-error=empty-body -Wno-error=maybe-uninitialized -Wno-error=nonnull-compare -Wno-error=shift-negative-value -Wno-error=tautological-compare -Wno-error=unused-const-variable -Wno-error=bool-operation -Wno-error=deprecated -Wno-error=expansion-to-defined -Wno-error=format-overflow -Wno-error=format-truncation -Wno-error=implicit-fallthrough -Wno-error=int-in-bool-context -Wno-error=memset-elt-size -Wno-error=noexcept-type -Wno-error=nonnull -Wno-error=pointer-compare -Wno-error=stringop-overflow -Wno-error=aggressive-loop-optimizations -Wno-error=cast-function-type -Wno-error=catch-value -Wno-error=multistatement-macros -Wno-error=restrict -Wno-error=sizeof-pointer-memaccess -Wno-error=stringop-truncation -Wno-error=overflow -Wno-return-type -Wno-unknown-pragmas -Wno-address-of-packed-member  -fms-extensions     -c /workspace/src/sys/contrib/openzfs/module/zfs/spa.c -o spa.o
--- all_subdir_cddl/lib/libzpool ---
/workspace/src/sys/contrib/openzfs/module/zfs/spa.c: In function 'spa_tryimport':
/workspace/src/sys/contrib/openzfs/module/zfs/spa.c:6775:29: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
 6775 |             TRYIMPORT_NAME, (u_longlong_t)curthread, poolname);
      |                             ^

@asomers asomers mentioned this pull request May 8, 2024
13 tasks
allanjude pushed a commit to KlaraSystems/zfs that referenced this pull request May 21, 2024
This commit allow spa_load() to drop the spa_namespace_lock so
that imports can happen concurrently. Prior to dropping the
spa_namespace_lock, the import logic will set the spa_load_thread
value to track the thread which is doing the import.

Consumers of spa_lookup() retain the same behavior by blocking
when either a thread is holding the spa_namespace_lock or the
spa_load_thread value is set. This will ensure that critical
concurrent operations cannot take place while a pool is being
imported.

The zpool command is also enhanced to provide multi-threaded support
when invoking zpool import -a.

Lastly, zinject provides a mechanism to insert artificial delays
when importing a pool and new zfs tests are added to verify parallel
import functionality.

Contributions-by: Don Brady <don.brady@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Wilson <gwilson@delphix.com>
Closes openzfs#16093
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
This commit allow spa_load() to drop the spa_namespace_lock so
that imports can happen concurrently. Prior to dropping the
spa_namespace_lock, the import logic will set the spa_load_thread
value to track the thread which is doing the import.

Consumers of spa_lookup() retain the same behavior by blocking
when either a thread is holding the spa_namespace_lock or the
spa_load_thread value is set. This will ensure that critical
concurrent operations cannot take place while a pool is being
imported.

The zpool command is also enhanced to provide multi-threaded support
when invoking zpool import -a.

Lastly, zinject provides a mechanism to insert artificial delays
when importing a pool and new zfs tests are added to verify parallel
import functionality.

Contributions-by: Don Brady <don.brady@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Wilson <gwilson@delphix.com>
Closes openzfs#16093
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants