Re: [RFCv2][PATCH 1/7] fs: optimize inotify/fsnotify code for unwatched files
From: Dave Hansen
Date: Thu Jun 25 2015 - 12:28:38 EST
On 06/24/2015 05:57 PM, Eric Paris wrote:
> On Wed, 2015-06-24 at 17:16 -0700, Dave Hansen wrote:
>> + if (!to_tell->i_fsnotify_marks.first &&
>> + (!mnt || !mnt->mnt_fsnotify_marks.first))
>> + return 0;
>
> two useless peeps from the old peanut gallery of long lost....
>
> 1) should you actually move this check up before the IN_MODIFY check?
> This seems like it would be by far the most common case, and you'd save
> yourself a bunch of useless conditionals/bit operations.
Doing that actually makes fsnotify() 82 bytes smaller for me. I think
you're also right that the new check is a much more general condition
than the existing one. I'll move it up when I post again.
> 2) do you want to use hlist_empty(&to_tell->i_fsnotify_marks) instead,
> for readability (and they are static inline, so compiled code is the
> same)
Yeah I guess that makes sense. The only thing that the current code is
nice for is that it makes it obvious that the .first checks match with
the srcu_dereference()s done below.
--
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/