From 36012a66f30dfeb9dca03dc94367a6445d5f607a Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 18 Dec 2020 15:47:09 -0700 Subject: [PATCH] LU-14265 utils: allow 'lfs mkdir' without arguments If no arguments are given to "lfs mkdir " assume that "-i -1 -c 1" were given, to create the specified on an MDT with above-average free space/inodes. Signed-off-by: Andreas Dilger Change-Id: I319f68240832a905a86833a70a4631cde5ce7057 Reviewed-on: https://review.whamcloud.com/41054 Reviewed-by: Olaf Faaland-LLNL Tested-by: jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/doc/lfs-setdirstripe.1 | 10 ++++++++++ lustre/utils/lfs.c | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lustre/doc/lfs-setdirstripe.1 b/lustre/doc/lfs-setdirstripe.1 index 8e5ff62..6f0906a 100644 --- a/lustre/doc/lfs-setdirstripe.1 +++ b/lustre/doc/lfs-setdirstripe.1 @@ -105,6 +105,16 @@ Specify a numeric bitmask of type-specific layout flags for the foreign layout. Specify a string to be used as a foreign (free format) striping. .SH NOTE .PP +If neither +.B -c +or +.B -i +are specified, +.B lfs mkdir +will default to +.B -c 1 -i -1 +and create the directory on an MDT that is less full than the others. +.PP The .B lfs setdirstripe command is only usable by root unless the diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index a50c958..98c3eb0 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -6209,10 +6209,9 @@ static int lfs_setdirstripe(int argc, char **argv) if (!delete && lsa.lsa_stripe_off == LLAPI_LAYOUT_DEFAULT && lsa.lsa_stripe_count == LLAPI_LAYOUT_DEFAULT && !foreign_mode) { - fprintf(stderr, - "%s %s: stripe offset and count must be specified\n", - progname, argv[0]); - return CMD_HELP; + /* if no parameters set, create directory on least-used MDTs */ + lsa.lsa_stripe_off = -1; + lsa.lsa_stripe_count = 1; } if (delete && -- 1.8.3.1