From 23224e03dc30c89dd449de5a7fe99b0bd3aca495 Mon Sep 17 00:00:00 2001 From: Nathan Rutman Date: Wed, 22 Feb 2023 14:34:09 -0800 Subject: [PATCH] LU-16587 utils: give lfs migrate a larger buffer lfs migrate is slow because it mostly uses a small 1MB buffer. Bigify. [root@kjlmo4n00 16G]# time lfs migrate -S 1M -p flash 16G.1 real 0m25.341s [root@kjlmo4n00 16G]# time /root/tools/lfs_nzr migrate -S 1M -p flash 16G.1 real 0m6.526s Signed-off-by: Nathan Rutman Change-Id: I850ca475fcd0efe2d71d26e4d1544f462c60252a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50118 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger --- lustre/utils/lfs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index f3ca066..96cff47 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -832,7 +832,7 @@ static int migrate_copy_data(int fd_src, int fd_dst, int (*check_file)(int), long stats_interval_sec, off_t file_size_bytes) { struct llapi_layout *layout; - size_t buf_size = 4 * 1024 * 1024; + size_t buf_size = 64 * 1024 * 1024; void *buf = NULL; off_t pos = 0; off_t data_end = 0; @@ -850,8 +850,14 @@ static int migrate_copy_data(int fd_src, int fd_dst, int (*check_file)(int), uint64_t stripe_size; rc = llapi_layout_stripe_size_get(layout, &stripe_size); - if (rc == 0) - buf_size = stripe_size; + if (rc == 0) { + /* We like big bufs */ + if (stripe_size > buf_size) + buf_size = stripe_size; + else + /* Trim to stripe_size multiple */ + buf_size -= buf_size % stripe_size; + } llapi_layout_free(layout); } -- 1.8.3.1