llapi_file_create.3 llapi_file_get_stripe.3 lustreapi.7 \
lustre_rsync.8 lfs_migrate.1 lhbadm.8 ldev.8 ldev.conf.5 nids.5 \
lfs-hsm.1 llapi_hsm_state_get.3 llapi_hsm_state_set.3 \
- lustre_routes_config.8 lustre_routes_conversion.8
+ lustre_routes_config.8 lustre_routes_conversion.8 \
+ lfs-setdirstripe.1 lfs-mkdir.1 lfs-getdirstripe.1
SERVER_MANFILES = mkfs.lustre.8 tunefs.lustre.8
if SERVER
--- /dev/null
+.TH LFS-GETDIRSTRIPE 1 2014-06-08 "Lustre" "Lustre Utilities"
+.SH NAME
+lfs getdirstripe \- list the striping pattern of a given directory.
+.SH SYNOPSIS
+.B lfs getdirstripe
+[\fIOPTION\fR]... \fIDIR\fR...
+.SH DESCRIPTION
+Get the striping pattern information of directories. This lfs utility is
+similar to
+.B lfs getstripe
+, but is used to get directory striping pattern.
+.BP lfs
+.SH OPTIONS
+.TP
+.B \-c, \-\-stripe-count
+Only show the stripe count of the directory.
+.TP
+.B \-i, \-\-stripe-index
+Only show the stripe index of the directory.
+.TP
+.B \-R, \-\-raw
+The striping information is printed without substituting the
+filesystem's default values for unspecified fields. If the striping EA is not
+set, 0, and -1 will be printed for the stripe count, and offset respectively.
+.TP
+.B \-q, \-\-quiet
+Only show the details of the sub-striped directory FID information.
+.TP
+.B \-v, \-\-verbose
+Additional information will be shown with this option.
+.TP
+.B \-r, \-\-recursive
+The default behavior when a directory is specified is to list the striping
+information for all sub-directories within the specified directory. This
+can be expanded with --recursive, which will recurse into all subdirectories.
+.TP
+\fB\-O\fR, \fB\-\-obd\fR=\fIFSNAME-MDTnnnn_UUID\fR
+Limit the returned directories to those with objects on a specific MDT,
+whose uuid is
+.I FSNAME-MDTnnnn_UUID.
+.SH EXAMPLES
+.TP
+.B $ lfs getdirstripe -O lustre-MDT0001_UUID -r /mnt/lustre/dir1
+List the striping information of sub-directories, that are located on MDT1,
+under /mnt/lustre/dir1.
+.SH AVAILABILTY
+The lfs getdirstripe command is part of the Lustre filesystem.
+.SH SEE ALSO
+.BR lfs (1),
+.BR lfs-setdirstripe (1),
+.BR lfs-getstripe (1),
+.BR lustre (7)
--- /dev/null
+.so man1/lfs-setdirstripe.1
--- /dev/null
+.TH LFS-SETDIRSTRIPE 1 2014-06-08 "Lustre" "Lustre Utilities"
+.SH NAME
+lfs setdirstripe, mkdir \- set striping pattern of a directory.
+.SH SYNOPSIS
+.B lfs setdirstripe
+[\fIOPTION\fR]... \fIDIR\fR...
+.br
+.SH DESCRIPTION
+Create a striped directory with specified striping pattern. This lfs utility
+is similar to
+.B lfs setstripe
+, but is used to create striped directory.
+.B lfs mkdir
+is an alias for this command.
+.SH OPTIONS
+.TP
+\fB\-c\fR, \fB\-\-count\fR=\fICOUNT\fR
+Stripe over
+.I COUNT
+MDTs.
+.TP
+\fB\-i\fR, \fB\-\-index\fR=\fISTART_MDT_INDEX\fR
+Stripe from the MDT, whose index is
+.I START_MDT_INDEX.
+.TP
+\fB\-t\fR, \fB\-\-hash\-type\fR=\fIHASH_TYPE\fR
+the hash_type of the striped directory.
+.RS 1.2i
+.TP
+.B fnv_1a_64
+Fowler-Noll-Vo (FNV-1a) hash algorithm. This provides
+reasonably uniform, but not cryptographically strong,
+hashing of the filename. (default)
+.TP
+.B all_char
+Sum of ASCII characters modulo number of MDTs. This
+provides weak hashing of the filename, and is suitable
+for only testing or when the input is known to have
+perfectly uniform distribution (e.g. sequential numbers).
+.RE
+.TP
+.B \-D, \-\-default_stripe
+Set the default striping pattern of the directory. Newly created
+sub-directories will use the new default striping pattern,
+but existing sub-directories will not be affected. The newly
+created sub-directories will also inherit the current default
+striping pattern. Only default stripe count is supported for now.
+.TP
+\fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR
+Set the file access mode of the new directory to the specified
+numeric value (typically octal) as specified in
+.BR chmod (1),
+and is not affected by the current
+.BR umask (1p).
+.SH NOTE
+.PP
+The "lfs setdirstripe" command is only executable by root unless
+"mdt.*.enable_remote_dir_gid" is set via "lctl set_param" to be either a
+non-zero GID to limit it to a single group (e.g. "operator" or "admin"),
+or "-1" to allow any group to create remote directories.
+
+The root of the file system is on MDT0000, and directories and files inherit the
+MDT of their parent directory unless a different MDT is specified with this
+command.
+
+By default, only directories on MDT0000 can contain directories that are not on
+the same MDT. However, if "mdt.*.enable_remote_dir" is set non-zero on an MDT
+then it will allow creating remote directories that have parents other than
+MDT0000. This is restricted to avoid creating directory trees that have
+intermediate path components on a series different MDTs and become unavailable
+if any of the intermediate MDTs are offline.
+.SH EXAMPLES
+.TP
+.B $ lfs setdirstripe -c 2 -i 1 -t all_char /mnt/lustre/dir1
+This creates a directory striped on two MDTs, whose first stripe is on
+.B MDT0001
+(MDT index 1), and whose hash type is
+.BR all_char .
+.SH BUGS
+Default stripe cannot be deleted once it is set.
+.SH AVAILABILITY
+The lfs setdirstripe command is part of the Lustre filesystem.
+.SH SEE ALSO
+.BR lfs (1),
+.BR lfs-getdirstripe (1),
+.BR lfs-setstripe (1),
+.BR lustre (7)
.br
.B lfs data_version [-n] \fB<filename>\fR
.br
-.B lfs mkdir <--index|-i mdt_index> <dir>
-.br
.B lfs help
.SH DESCRIPTION
.B lfs
.B $ lfs setquota -t -u --block-grace 1000 --inode-grace 1w4d /mnt/lustre
Set grace times for user quotas: 1000 seconds for block quotas, 1 week and 4 days for inode quotas
.TP
-.B $ lfs mkdir -i 1 new_directory
-Create directory 'new_directory' on the mdt with index 1.
.SH BUGS
The \fBlfs find\fR command isn't as comprehensive as \fBfind\fR(1).
.SH AUTHOR
The lfs command is part of the Lustre filesystem.
.SH SEE ALSO
.BR lfs-hsm (1),
+.BR lfs-setdirstripe (1),
+.BR lfs-getdirstripe (1),
+.BR lfs-mkdir (1),
.BR lctl (8),
.BR lustre (7)
" [--layout|-L]\n"
" <directory|filename> ..."},
{"setdirstripe", lfs_setdirstripe, 0,
- "To create a remote directory on a specified MDT.\n"
+ "To create a striped directory on a specified MDT. This can only\n"
+ "be done on MDT0 with the right of administrator.\n"
"usage: setdirstripe <--count|-c stripe_count>\n"
- "[--index|-i mdt_index] [--hash-type|-t hash_type]\n"
- "[--default_stripe|-D ] <dir>\n"
+ " [--index|-i mdt_index] [--hash-type|-t hash_type]\n"
+ " [--default_stripe|-D ] [--mode|-m mode] <dir>\n"
"\tstripe_count: stripe count of the striped directory\n"
"\tmdt_index: MDT index of first stripe\n"
"\thash_type: hash type of the striped directory. Hash types:\n"
- " -t fnv_1a_64 FNV-1a hash algorithm(default)\n"
- " -t all_char sum of characters % MDT_COUNT. (not recommended)\n"
- "\tdefault_stripe: set default dirstripe of the directory\n"},
+ " fnv_1a_64 FNV-1a hash algorithm (default)\n"
+ " all_char sum of characters % MDT_COUNT (not recommended)\n"
+ "\tdefault_stripe: set default dirstripe of the directory\n"
+ "\tmode: the mode of the directory\n"},
{"getdirstripe", lfs_getdirstripe, 0,
"To list the striping info for a given directory\n"
"or recursively for all directories in a directory tree.\n"
" [--count|-c ] [--index|-i ] [--raw|-R]\n"
" [--recursive | -r] [ --default_stripe | -D ] <dir> "},
{"mkdir", lfs_setdirstripe, 0,
- "To create a remote directory on a specified MDT. And this can only\n"
- "be done on MDT0 by administrator.\n"
- "usage: mkdir <--index|-i mdt_index> <dir>\n"
- "\tmdt_index: MDT index of the remote directory.\n"},
+ "To create a striped directory on a specified MDT. This can only\n"
+ "be done on MDT0 with the right of administrator.\n"
+ "usage: mkdir <--count|-c stripe_count>\n"
+ " [--index|-i mdt_index] [--hash-type|-t hash_type]\n"
+ " [--default_stripe|-D ] [--mode|-m mode] <dir>\n"
+ "\tstripe_count: stripe count of the striped directory\n"
+ "\tmdt_index: MDT index of first stripe\n"
+ "\thash_type: hash type of the striped directory. Hash types:\n"
+ " fnv_1a_64 FNV-1a hash algorithm (default)\n"
+ " all_char sum of characters % MDT_COUNT (not recommended)\n"
+ "\tdefault_stripe: set default dirstripe of the directory\n"
+ "\tmode: the mode of the directory\n"},
{"rm_entry", lfs_rmentry, 0,
"To remove the name entry of the remote directory. Note: This\n"
"command will only delete the name entry, i.e. the remote directory\n"
if (sem_init && (ret = sem_init(path, parent ?: p, &d, data, de)))
goto err;
- if (!d || (param->get_lmv && !param->recursive))
+ if (d == NULL)
goto out;
while ((dent = readdir64(d)) != NULL) {
char *separator = "";
if (obdindex != OBD_NOT_FOUND) {
- for (i = 0; i < lum->lum_stripe_count; i++) {
- if (obdindex == objects[i].lum_mds) {
- llapi_printf(LLAPI_MSG_NORMAL, "%s%s\n", prefix,
- path);
+ if (lum->lum_stripe_count == 0) {
+ if (obdindex == lum->lum_stripe_offset)
obdstripe = 1;
- break;
+ } else {
+ for (i = 0; i < lum->lum_stripe_count; i++) {
+ if (obdindex == objects[i].lum_mds) {
+ llapi_printf(LLAPI_MSG_NORMAL,
+ "%s%s\n", prefix,
+ path);
+ obdstripe = 1;
+ break;
+ }
}
}
} else {
obdstripe = 1;
}
+ if (!obdstripe)
+ return;
+
/* show all information default */
if (!verbose) {
if (lum->lum_magic == LMV_USER_MAGIC)
llapi_printf(LLAPI_MSG_NORMAL, "lmv_stripe_count: ");
llapi_printf(LLAPI_MSG_NORMAL, "%u",
(int)lum->lum_stripe_count);
- separator = "\n";
+ if (verbose & VERBOSE_OFFSET)
+ separator = " ";
+ else
+ separator = "\n";
}
if (verbose & VERBOSE_OFFSET) {
(void *)¶m->lmd->lmd_lmm);
}
- } else if (parent) {
+ } else if (parent && !param->get_lmv && !param->get_default_lmv) {
char *fname = strrchr(path, '/');
fname = (fname == NULL ? path : fname + 1);
- if (param->get_lmv) {
- llapi_printf(LLAPI_MSG_NORMAL,
- "%s get dirstripe information for file\n",
- path);
- goto out;
- }
-
strncpy((char *)¶m->lmd->lmd_lmm, fname, param->lumlen);
ret = ioctl(dirfd(parent), IOC_MDC_GETFILESTRIPE,