|
It looks like a few additional -printf options should be implemented, but nothing overly complex. These would be useful by themselves, and also to implement "lfs find -ls":
- "%i" - inode number
- "%LF" - Lustre FID
- "%k" - file blocks in kilobytes (should be trivial, just "%b/2")
- "%M" - symbolic file access mode (decode file type (-bcdls+/-rwxSt UGO permission bits)
"%n" - link count (LU-7495)
- "%u" - username (could be mapped to "%U" initially to print numeric UID, and implemented separately)
- "%g" - groupname (use "%g" initially, as with "%u")
|
|
Looking at the strace output for regular file processing it seems like it is doing far too much for most files:
The ioctl(4, _IOC(_IOC_READ|_IOC_WRITE, 0x69, 0x16, 0x140) = IOC_MDC_GETFILEINFO_V2) is expected for every file, since it gets the file layout and MDT attributes from the parent directory but we definitely should not be doing open() and ioctl(FS_IOC_FSGETXATTR) (to get projid) and newfstatat() (not sure why?) on every file when we are only printing the pathname. That is a lot of overhead (more than double the original ioctl(IOC_MDC_GETFILEINFO_V2) call).
Running without -printf "%p" shows none of that overhead:
|
|
I'm thinking that "gather_all" should be changed to be a STATX_ bitmask to indicate which fields are needed, and then the code could be changed to check the bitmask when the attributes are being fetched:
#ifndef STATX_PROJID
#define STATX_PROJID 0x40000000
#endif
if (param->fp_check_projid || gather_printf & STATX_PROJID)
The definition of STAX_PROJID would only be used internally until the kernel could itself return projid as part of statx() (LU-12480).
|