LLAPI_GET_LUM_FILE_FD(3)
π LLAPI_GET_LUM_FILE_FD π
okay bestie, so this is a page from the Lustre Library Functions manual β third section, <kbd>3</kbd>, the library-call section, iykyk β and it's all about pulling valid file attributes and LOV stripe information out to you, the user. β¨
πΈ NAME πΈ
llapi_get_lum_file_fd, llapi_get_lum_dir_fd, llapi_get_lum_file, llapi_get_lum_dir β get valid file attributes and LOV stripe information to the user. π
β¨ SYNOPSIS β¨
#include <lustre/lustreapi.h>
int llapi_get_lum_file_fd(int dir_fd, const char *fname,
__u64 *valid, lstatx_t *statx,
struct lov_user_md *lum,
size_t lumsize);
int llapi_get_lum_dir_fd(int dir_fd, __u64 *valid,
lstatx_t *statx, struct lov_user_md *lum,
size_t lumsize);
int llapi_get_lum_file(const char *path, __u64 *valid,
lstatx_t *statx, struct lov_user_md *lum,
size_t lumsize);
int llapi_get_lum_dir(const char *path, __u64 *valid,
lstatx_t *statx, struct lov_user_md *lum,
size_t lumsize);
four little functions, all serving looks π«Ά
π DESCRIPTION π
So the way this works is: llapi_get_lum_file_fd(), llapi_get_lum_dir_fd(), llapi_get_lum_file(), and llapi_get_lum_dir() hand you back file attributes and LOV stripe information, and they do it by an ioctl on the dir. that's the whole vibe. π
dir_fd is a file descriptor that refers to a directory. and for llapi_get_lum_file_fd() specifically, if fname is provided, it's a relative pathname that gets interpreted relative to the directory that dir_fd refers to. no cap.
For the "I'm just doing one thing" girlies:
llapi_get_lum_dir_fd(),llapi_get_lum_file(), andllapi_get_lum_dir()can be used for applications that are only processing a single file or directory, referred to bydir_fdorpath.
And for the "I have a MILLION files" girlies:
llapi_get_lum_file_fd()can be used for applications that process lots of files. It avoids opening, locking, and closing each file on the client if that is not needed. Multiple calls of this llapi can be done on the parent dir referenced bydir_fdwith a single open for all files in that directory, and it also does not pollute the client dcache with millions of dentries when traversing a large filesystem. that's the icon behaviour honestly π
π¦ What actually comes back π¦
The stripe information for the target file is returned to the user in the struct lov_user_md pointed to by lum β but only if it is not a NULL pointer. π
The file attribute information for the target file is returned in the lstatx_t structure pointed to by statx β again, only if it is not a NULL pointer.
And the output argument valid contains the flags that indicate which fields in the returned file attributes have been validly filled in. it's giving receipts. π§Ύβ¨
β The valid flags β
OBD_MD_FLSIZEβ The returned file size is known strictly correct.OBD_MD_FLBLOCKSβ The returned file blocks is known strictly correct.OBD_MD_FLLAZYSIZEβ The returned file size is approximate, may never have been strictly correct.OBD_MD_FLLAZYBLOCKSβ The returned file blocks is approximate, may never have been strictly correct.OBD_MD_FLIDβ The returned object ID is valid.OBD_MD_FLATIMEβ The returned access time is valid.OBD_MD_FLMTIMEβ The returned data modification time is valid.OBD_MD_FLCTIMEβ The returned change time is valid.OBD_MD_FLBLKSZβ The returned block size is valid.OBD_MD_FLMODEβ The returned access bits (mode & ~S_IFMT) is valid.OBD_MD_FLTYPEβ The returned object type (mode & S_IFMT) is valid.OBD_MD_FLUIDβ The returned user ID is valid.OBD_MD_FLGIDβ The returned group ID is valid.OBD_MD_FLFLAGSβ The returned flags word is valid.OBD_MD_FLNLINKβ The returned link count is valid.OBD_MD_FLRDEVβ The returned device number is valid.
sixteen flags, all accounted for, nobody left behind π
π₯ RETURN VALUES π₯
llapi_get_lum_file_fd(), llapi_get_lum_dir_fd(), llapi_get_lum_file(), and llapi_get_lum_dir() return 0 on success, or a negative errno value on failure. so if it's zero you're slaying, and if it's negative... bestie, check errno. π
π ERRORS π
-ENOMEMβ Insufficient memory to complete operation.-EFAULTβ Memory region is not properly mapped.-EINVALβ One or more invalid arguments are given.-EOPNOTSUPPβ The operation is not supported.-ENOTTYβ File does not reside on a Lustre filesystem.-ENOENTβpathdoes not exist.-EBADFβdir_fdis not a valid open file descriptor.
fr fr, -ENOTTY is the sneaky one β it doesn't mean "wrong ioctl", it means the file isn't on a Lustre filesystem at all. read the room. π«
π AVAILABILITY π
llapi_get_lum_file_fd(), llapi_get_lum_file(), llapi_get_lum_dir_fd() and llapi_get_lum_dir() are part of the lustre(7) user application interface library since release 2.13.0. so if your Lustre is older than that... not me being the bearer of bad news π
π SEE ALSO π
that's the whole page, bestie, no notes π
this was Lustre User API, dated 2024-08-27, and it lives in section 3 of the manual as LLAPI_GET_LUM_FILE_FD(3) β mwah, go read your file attributes, you're doing amazing πΈπ
β¨
π¦ where this page comes from
- ubuntu stonking: lustre-client-utils 2.17.58+dfsg-0ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms