From: Emmanuel D. <ma...@ne...> - 2011-12-05 13:30:24
|
On Mon, Dec 05, 2011 at 01:44:17PM +0100, Miklos Szeredi wrote: > But please take into account that in most cases the filesystem isn't > interested in the secondary groups and so care is needed not to > introduce a performance regression in the majority for the sake of a > performance improvement in the minority. It could be enabled by a FUSE_XHEADER flag in the init message. If the kernel returns the flag in the reply, then this means subsequent messages will start by struct fuse_in_xheader instead of struct fuse_in_header. Here there is a choice to make: I can just add secondary groups to struct fuse_in_xheader, or I can make an extensible struct fuse_in_xheader where secondary groups or other information can be added. In that later case, another init flag (FUSE_SECONDARY_GROUPS) would cause secondary groups to be appended. Here is a proposal for the extensible header. Note that without option, it remains binary compatible with the original one. Also note that header_len will make sure that future changes can be handled gracefully by the filesystem: it will just have to skip the extra data. struct fuse_in_xheader { __u32 len; __u32 opcode; __u64 unique; __u64 nodeid; __u32 uid; __u32 gid; __u32 pid; __u8 version: /* header version for later changes */ __u8 padding; __u16 header_len; /* header length including options */ /* More optionnal data, starting by struct fuse_in_xheader_option */ }; Each option would start by struct fuse_in_xhopt, which would give the option type and length. If the filesystem does not care about one, it can skip: struct fuse_in_xhopt { __u16 type; /* FUSE_XHOPT_* */ __u16 option_len; } And here is the structure for secondary groups: #define FUSE_XHOPT_GROUPS 1 struct fuse_in_xhopt_groups { __u16 type; /* FUSE_XHOPT_GROUPS */ __u16 option_len; /* sizeof(struct fuse_in_xhopt_groups) */ __u32 ngroups; __u32 groups[NGROUPS]; } OTOH, if this is considered overkill, I can just do an unextensible new header, with just groups added: struct fuse_in_xheader { __u32 len; __u32 opcode; __u64 unique; __u64 nodeid; __u32 uid; __u32 gid; __u32 pid; __u32 ngroups; __u32 groups[NGROUPS]; }; -- Emmanuel Dreyfus ma...@ne... |