Whamcloud - gitweb
LU-8585 llapi: use open_by_handle_at in llapi_open_by_fid
Reimplement llapi_open_by_fid() to use llapi_fid_to_handle() and
open_by_handle_at(2) rather than using ioctl(). This works for
opens on subdirectory mountpoints, unlike ".lustre/fid/<fid>".
This patch also adds llapi_open_by_fid_at() which is similar to
llapi_open_by_fid() except that it takes an open directory file
descriptor or AT_CWD rather than a path as its first argument.
[AD:
- Move get_root_*() functions over to a new liblustreapi_root.c
file in expectation of further enhancements to that code.
- Cache an open file handle on the root directory so repeated
calls to llapi_open_by_fid() and llapi_fid2path() do not need
to search for and open the same root directory path many times.
- Add man pages for newly-added functions.
This reduces the system calls for llapi_fid_test significantly:
original patched
14511 4315 total opens
64807 34067 total syscalls
]
There may still be a need to have a fallback from open_by_handle_at()
to using ".lustre/fid/<FID>" to open the fid (if available), but
that can be added if this initial patch does not test well. The
open_by_handle_at() method avoids reopening the "fid/" directory
each time (though this fd could also be cached), but it has the
drawback that it reconnects dentries to the root directory each time.
Signed-off-by: Quentin Bouget <quentin.bouget@cea.fr>
Change-Id: I8a4904c996389da2b0894cd9fac639a398607535
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/36603
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
13 files changed: