lkml.org 
[lkml]   [2008]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH -v3 6/8] fsnotify: add group priorities
    From
    Date
    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.



    \
     
     \ /
      Last update: 2008-11-27 17:27    [W:3.091 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site