fsnotify: convert notification_mutex to a spinlock
[cascardo/linux.git] / fs / notify / inotify / inotify_user.c
index b8d08d0..69d1ea3 100644 (file)
@@ -115,10 +115,10 @@ static unsigned int inotify_poll(struct file *file, poll_table *wait)
        int ret = 0;
 
        poll_wait(file, &group->notification_waitq, wait);
-       mutex_lock(&group->notification_mutex);
+       spin_lock(&group->notification_lock);
        if (!fsnotify_notify_queue_is_empty(group))
                ret = POLLIN | POLLRDNORM;
-       mutex_unlock(&group->notification_mutex);
+       spin_unlock(&group->notification_lock);
 
        return ret;
 }
@@ -138,7 +138,7 @@ static int round_event_name_len(struct fsnotify_event *fsn_event)
  * enough to fit in "count". Return an error pointer if
  * not large enough.
  *
- * Called with the group->notification_mutex held.
+ * Called with the group->notification_lock held.
  */
 static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
                                            size_t count)
@@ -157,7 +157,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
        if (event_size > count)
                return ERR_PTR(-EINVAL);
 
-       /* held the notification_mutex the whole time, so this is the
+       /* held the notification_lock the whole time, so this is the
         * same event we peeked above */
        fsnotify_remove_first_event(group);
 
@@ -234,9 +234,9 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
 
        add_wait_queue(&group->notification_waitq, &wait);
        while (1) {
-               mutex_lock(&group->notification_mutex);
+               spin_lock(&group->notification_lock);
                kevent = get_one_event(group, count);
-               mutex_unlock(&group->notification_mutex);
+               spin_unlock(&group->notification_lock);
 
                pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent);
 
@@ -300,13 +300,13 @@ static long inotify_ioctl(struct file *file, unsigned int cmd,
 
        switch (cmd) {
        case FIONREAD:
-               mutex_lock(&group->notification_mutex);
+               spin_lock(&group->notification_lock);
                list_for_each_entry(fsn_event, &group->notification_list,
                                    list) {
                        send_len += sizeof(struct inotify_event);
                        send_len += round_event_name_len(fsn_event);
                }
-               mutex_unlock(&group->notification_mutex);
+               spin_unlock(&group->notification_lock);
                ret = put_user(send_len, (int __user *) p);
                break;
        }