Details
-
Improvement
-
Resolution: Duplicate
-
Medium
-
None
-
None
-
3
-
9223372036854775807
Description
It looks like there are no simple interfaces for getting and setting the numeric projid of a file (either by pathname or by open file descriptor). The lfs_projid_set() and lfs_projid_list() commands are implemented in lustre/utils/lfs_project.c and are geared toward mass updates, and the project_set_one() command calls ioctl(fd, FS_IOC_FSSETXATTR, fsx) and ioctl(fd, FS_IOC_FSGETXATTR, fsx) directly. It would be useful to have simple llapi_proj*() interfaces to get and set the numeric projid on a file.
On Function Naming
There are already llapi_project_[f]getprojid() interfaces that are used to perform projname<->projid lookups from the /etc/projid file, so potentially llapi_projid_[f]{get,set}() seem reasonable, or possibly llapi_projid_{get,set}_at() would be better (to allow operating by relative filename against an open parent directory handle).
API usage/Testing
Once added, these new llapi_projid_*() functions should be used by lfs_project.c::project_{get,clear,list}_one(), liblustreapi_pfind.c::get_projid(), checkstat.c, and createmany.c code. This should provide sufficient test coverage through existing subtests that dedicated test cases are not needed.
The liblustreapi_pfind.c::get_projid() usage would ideally be replaced by statx(STATX_PROJID) so that there is no need for the extra overhead to open(), ioctl(FS_IOC_FSGETXATTR), close() on each file scanned when --projid is requested.
Documentation
There should be new man3/llapi_projid_*()}} pages added to describe the new APIs.