@@ -34,7 +34,7 @@ extern "C" {
/**
* Information about open files
*
- * Changed in version 3.0
+ * Changed in version 3.1
*/
struct fuse_file_info {
/** Open flags. Available in open() and release() */
@@ -67,8 +67,12 @@ struct fuse_file_info {
2.9 */
unsigned int flock_release : 1;
+ /* Indicates that the getattr request is for inode permission
+ * check. Introduced in version 3.1 */
+ unsigned int getattr_perm : 1;
+
/** Padding. Do not use*/
- unsigned int padding : 27;
+ unsigned int padding : 26;
/** File handle. May be filled in by filesystem in open().
Available in all other file operations */
@@ -259,6 +259,7 @@ struct fuse_file_lock {
* Getattr flags
*/
#define FUSE_GETATTR_FH (1 << 0)
+#define FUSE_GETATTR_PERM (1 << 1)
/**
* Lock flags
@@ -1136,11 +1136,14 @@ static void do_getattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
if (req->f->conn.proto_minor >= 9) {
struct fuse_getattr_in *arg = (struct fuse_getattr_in *) inarg;
- if (arg->getattr_flags & FUSE_GETATTR_FH) {
+ if (arg->getattr_flags) {
memset(&fi, 0, sizeof(fi));
- fi.fh = arg->fh;
fip = &fi;
}
+ if (arg->getattr_flags & FUSE_GETATTR_FH)
+ fi.fh = arg->fh;
+ if (arg->getattr_flags & FUSE_GETATTR_PERM)
+ fi.getattr_perm = 1;
}
if (req->f->op.getattr)
Introduce a new flag FUSE_GETATTR_PERM for getattr request. The flag indicates that the getattr request is for permission check. When getattr is for permission check, the user space daemon does not need to provide accurate size/ctime/mtime. This optimization is for Ceph fuse client. When a directory is accessed by multiple clients, getting accurate size/ctime/mtime of inode can be slow. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> --- include/fuse_common.h | 8 ++++++-- include/fuse_kernel.h | 1 + lib/fuse_lowlevel.c | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-)