OS Manuals

llapi_dir_create(3)

llapi_dir_create - create a directory with specified striping

LLAPI_DIR_CREATE(3) Lustre Library Functions LLAPI_DIR_CREATE(3)

llapi_dir_create - create a directory with specified striping

#include <lustre/lustreapi.h>
int llapi_dir_create(const char *name, mode_t mode,
                     const struct llapi_stripe_param *param)

llapi_dir_create() creates a new directory with the specified name and stripe parameters on a Lustre filesystem. This allows explicit control over which MDTs (Metadata Targets) the directory is striped across, enabling parallel metadata operations for directories with large numbers of entries.

The arguments are as follows:

The pathname of the directory to create. The parent directory must already exist and be on a Lustre filesystem.
The permission bits for the new directory, as described in open(2).
A pointer to a struct llapi_stripe_param containing the striping configuration. The relevant fields for directories are:
The number of MDTs to stripe the directory across. This is typically set to '1' unless hundreds of thousands of files will be created directly in this directory.
The MDT index where the directory should start, or -1 to allow the system to choose based on available space.
The hash algorithm used to distribute directory entries across MDTs. Valid values include LMV_HASH_TYPE_FNV_1A_64 (default, good distribution), LMV_HASH_TYPE_CRUSH (optimized for migration), and LMV_HASH_TYPE_ALL_CHARS (weak, for testing only).
Currently ignored, should be set as NULL.
If true, use the lsp_tgts array for specific MDT indices.
Maximum depth for subdirectories to inherit this default layout.
Maximum depth for subdirectories to use round-robin MDT selection.

llapi_dir_create() returns 0 on success, or a negative errno value on failure.

Permission denied on parent directory.
Stripe already set on existing directory.
Directory already exists.
An invalid argument was specified.
Parent directory does not exist.
Not enough memory to allocate a resource.

llapi_dir_create () is part of the lustre(7) user application interface library since release 2.10.0.

llapi_dir_create_foreign(3), llapi_dir_create_pool(3), lustreapi(7)

2026-01-26 Lustre User API

lustre 2.17.59-r1 · enterprise-packages · ingested 2026-10-02