[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1227803109.4454.1773.camel@twins>
Date: Thu, 27 Nov 2008 17:25:09 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Eric Paris <eparis@...hat.com>
Cc: linux-kernel@...r.kernel.org, malware-list@...ts.printk.net,
viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
alan@...rguk.ukuu.org.uk, arjan@...radead.org, hch@...radead.org
Subject: Re: [PATCH -v3 6/8] fsnotify: add group priorities
On Tue, 2008-11-25 at 12:21 -0500, Eric Paris wrote:
> In preperation for blocking fsnotify calls group priorities must be added.
> When multiple groups request the same event type the lowest priority group
> will receive the notification first.
> @@ -114,9 +117,26 @@ struct fsnotify_group *fsnotify_find_group(unsigned int group_num, unsigned long
>
> group->ops = ops;
>
> - /* add it */
> - list_add_rcu(&group->group_list, &fsnotify_groups);
> + /* Do we need to be the first entry? */
> + if (list_empty(&fsnotify_groups)) {
> + list_add_rcu(&group->group_list, &fsnotify_groups);
> + goto out;
> + }
> +
> + list_for_each_entry(group_iter, &fsnotify_groups, group_list) {
> + /* insert in front of this one? */
> + if (priority < group_iter->priority) {
> + /* I used list_add_tail() to insert in front of group_iter... */
> + list_add_tail_rcu(&group->group_list, &group_iter->group_list);
> + break;
> + }
>
> + /* are we at the end? if so insert at end */
> + if (list_is_last(&group_iter->group_list, &fsnotify_groups)) {
> + list_add_tail_rcu(&group->group_list, &fsnotify_groups);
> + break;
> + }
> + }
> out:
> mutex_unlock(&fsnotify_grp_mutex);
> fsnotify_recalc_global_mask();
What priority range do you need to cater for, and how many groups? I can
imagine for many groups and limit range a priority list might be better
suited.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists