From 93c03de4bb52e9ceeb79f89dc277d2e251f27167 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Tue, 25 Mar 2025 12:10:14 -0400 Subject: [PATCH] LU-17814 utils: add parallel find arg lfs find is currently serial, but it can be much faster if we add a parallel implementation where it creates a work unit for every directory and handles them in parallel. This is the first patch of that implementation. Add arg to control thread count. No implementation yet. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: I73b542decd75e1f7580f584d2ea6a219af51be4c Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57221 Reviewed-by: Marc Vef Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/include/lustre/lustreapi.h | 1 + lustre/utils/lfs.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lustre/include/lustre/lustreapi.h b/lustre/include/lustre/lustreapi.h index 614e498..15ee893 100644 --- a/lustre/include/lustre/lustreapi.h +++ b/lustre/include/lustre/lustreapi.h @@ -422,6 +422,7 @@ struct find_param { int fp_bsign; unsigned int fp_hash_inflags; unsigned int fp_hash_exflags; + __u8 fp_thread_count; /* Print all information (lfs find only) */ char *fp_format_printf_str; nlink_t fp_nlink; diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index c690d5c..7ace058 100755 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -3727,6 +3727,7 @@ enum { LFS_QUOTA_IHARDLIMIT_OPT, LFS_QUOTA_IGRACE_OPT, LFS_FILES_FROM, + LFS_THREAD_OPT, }; #ifndef LCME_USER_MIRROR_FLAGS @@ -5801,6 +5802,8 @@ static int lfs_find(int argc, char **argv) { .val = LFS_POOL_OPT, .name = "pool", .has_arg = required_argument }, { .val = '0', .name = "print0", .has_arg = no_argument }, + { .val = LFS_THREAD_OPT, + .name = "thread", .has_arg = required_argument }, { .val = 'P', .name = "print", .has_arg = no_argument }, { .val = LFS_PRINTF_OPT, .name = "printf", .has_arg = required_argument }, @@ -6493,6 +6496,9 @@ static int lfs_find(int argc, char **argv) case '0': param.fp_zero_end = 1; break; + case LFS_THREAD_OPT: + param.fp_thread_count = strtol(optarg, &endptr, 0); + break; case 'P': /* we always print, this option is a no-op */ break; case LFS_PRINTF_OPT: -- 1.8.3.1