Lines Matching refs:group
105 struct fsnotify_group *group = file->private_data;
108 poll_wait(file, &group->notification_waitq, wait);
109 spin_lock(&group->notification_lock);
110 if (!fsnotify_notify_queue_is_empty(group))
112 spin_unlock(&group->notification_lock);
132 * Called with the group->notification_lock held.
134 static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
140 if (fsnotify_notify_queue_is_empty(group))
143 event = fsnotify_peek_first_event(group);
145 pr_debug("%s: group=%p event=%p\n", __func__, group, event);
153 fsnotify_remove_first_event(group);
164 static ssize_t copy_event_to_user(struct fsnotify_group *group,
174 pr_debug("%s: group=%p event=%p\n", __func__, group, fsn_event);
217 struct fsnotify_group *group;
224 group = file->private_data;
226 add_wait_queue(&group->notification_waitq, &wait);
228 spin_lock(&group->notification_lock);
229 kevent = get_one_event(group, count);
230 spin_unlock(&group->notification_lock);
232 pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent);
238 ret = copy_event_to_user(group, kevent, buf);
239 fsnotify_destroy_event(group, kevent);
259 remove_wait_queue(&group->notification_waitq, &wait);
268 struct fsnotify_group *group = file->private_data;
270 pr_debug("%s: group=%p\n", __func__, group);
272 /* free this group, matching get was inotify_init->fsnotify_obtain_group */
273 fsnotify_destroy_group(group);
281 struct fsnotify_group *group;
287 group = file->private_data;
290 pr_debug("%s: group=%p cmd=%u\n", __func__, group, cmd);
294 spin_lock(&group->notification_lock);
295 list_for_each_entry(fsn_event, &group->notification_list,
300 spin_unlock(&group->notification_lock);
309 data = &group->inotify_data;
379 static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group *group,
382 struct idr *idr = &group->inotify_data.idr;
383 spinlock_t *idr_lock = &group->inotify_data.idr_lock;
400 static struct inotify_inode_mark *inotify_idr_find(struct fsnotify_group *group,
404 spinlock_t *idr_lock = &group->inotify_data.idr_lock;
407 i_mark = inotify_idr_find_locked(group, wd);
417 static void inotify_remove_from_idr(struct fsnotify_group *group,
420 struct idr *idr = &group->inotify_data.idr;
421 spinlock_t *idr_lock = &group->inotify_data.idr_lock;
433 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n",
434 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group);
439 found_i_mark = inotify_idr_find_locked(group, wd);
441 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n",
442 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group);
452 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p "
454 "found_i_mark->group=%p\n", __func__, i_mark,
455 i_mark->wd, i_mark->fsn_mark.group, found_i_mark,
456 found_i_mark->wd, found_i_mark->fsn_mark.group);
465 printk(KERN_ERR "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n",
466 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group);
486 struct fsnotify_group *group)
496 inotify_remove_from_idr(group, i_mark);
498 dec_inotify_watches(group->inotify_data.ucounts);
501 static int inotify_update_existing_watch(struct fsnotify_group *group,
515 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
556 static int inotify_new_watch(struct fsnotify_group *group,
563 struct idr *idr = &group->inotify_data.idr;
564 spinlock_t *idr_lock = &group->inotify_data.idr_lock;
572 fsnotify_init_mark(&tmp_i_mark->fsn_mark, group);
581 if (!inc_inotify_watches(group->inotify_data.ucounts)) {
582 inotify_remove_from_idr(group, tmp_i_mark);
591 inotify_remove_from_idr(group, tmp_i_mark);
606 static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg)
610 mutex_lock(&group->mark_mutex);
612 ret = inotify_update_existing_watch(group, inode, arg);
615 ret = inotify_new_watch(group, inode, arg);
616 mutex_unlock(&group->mark_mutex);
623 struct fsnotify_group *group;
626 group = fsnotify_alloc_group(&inotify_fsnotify_ops);
627 if (IS_ERR(group))
628 return group;
632 fsnotify_destroy_group(group);
635 group->overflow_event = &oevent->fse;
636 fsnotify_init_event(group->overflow_event, 0);
642 group->max_events = max_events;
643 group->memcg = get_mem_cgroup_from_mm(current->mm);
645 spin_lock_init(&group->inotify_data.idr_lock);
646 idr_init(&group->inotify_data.idr);
647 group->inotify_data.ucounts = inc_ucount(current_user_ns(),
651 if (!group->inotify_data.ucounts) {
652 fsnotify_destroy_group(group);
656 return group;
663 struct fsnotify_group *group;
673 /* fsnotify_obtain_group took a reference to group, we put this when we kill the file in the end */
674 group = inotify_new_group(inotify_max_queued_events);
675 if (IS_ERR(group))
676 return PTR_ERR(group);
678 ret = anon_inode_getfd("inotify", &inotify_fops, group,
681 fsnotify_destroy_group(group);
699 struct fsnotify_group *group;
748 /* inode held in place by reference to path; group by fget on fd */
750 group = f.file->private_data;
753 ret = inotify_update_watch(group, inode, mask);
762 struct fsnotify_group *group;
775 group = f.file->private_data;
777 i_mark = inotify_idr_find(group, wd);
783 fsnotify_destroy_mark(&i_mark->fsn_mark, group);