Re: [PATCH 4/4] fanotify: Expose the file changes to the user

From: Alexey Zaytsev
Date: Fri Nov 26 2010 - 06:21:24 EST


On Fri, Nov 26, 2010 at 13:11, Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxx> wrote:
> On Monday 22 Nov 2010 00:37:21 Alexey Zaytsev wrote:
>> +struct fanotify_opt_hdr {
>> + Â Â Â __u8 type;
>> + Â Â Â __u8 reserved;
>> + Â Â Â __u16 len;
>> + Â Â Â /* Payload goes here. */
>> +};
>> +
>> +#define FANOTIFY_METADATA_VERSION Â Â Â3
>>
>> Âstruct fanotify_event_metadata {
>> - Â Â Â __u16 event_len;
>> + Â Â Â __u16 event_len; /* Including the options */
>> Â Â Â Â __u8 vers;
>> - Â Â Â __u8 reserved;
>> + Â Â Â __u8 options_offset; /* Aka header length */
>> Â Â Â Â __s32 fd;
>> Â Â Â Â __aligned_u64 mask;
>> Â Â Â Â __s32 pid;
>> + Â Â Â /* Options go here. */
>> Â};
>
> I am not 100% comfortable with having 16 bits length fields because I am just
> not sure there is a measurable performance difference versus just going with
> 32 bits.

I'm not concerned so much with the performance, as with the storage.
If we are generating events for every access on a mount point, some
consumers might build a considerable backlog over a period of high
activity. Would be good if we could cut the event size by 1/3 for
free. And I don't see an event growing 64k even with the options. Do
you?


>
> Also, options_offset is, if I understood it correctly, basically the lenght of
> fanotify_event_metadata. As such, isn't that field redundant since the lenght
> is implied from the protocol version?

There are two problems there.

1) You lose backwards-compatibility. It's still an ABI breakage, even
if you tell the users about it.

2) You can't build a program to account for different fanotify versions:
if (vers >= N) { use the cool stuff } else if {vers >= N-1} {
still good }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/