diff options
| author | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:38 -0400 |
|---|---|---|
| committer | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:52 -0400 |
| commit | 7f6b6117e1803777fcf48fe31bd236a7fbf740db (patch) | |
| tree | e86b8bd3a16155447a215a758960092021006311 | |
| parent | 3a9b16b407f10b2a771bcae13fb5791e527d6bcf (diff) | |
inotify: use the mark in handler functions
inotify now gets a mark in the should_send_event and handle_event
functions. Rather than look up the mark themselves inotify should just use
the mark it was handed.
Signed-off-by: Eric Paris <eparis@redhat.com>
| -rw-r--r-- | fs/notify/inotify/inotify_fsnotify.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c index dbd76bbb3e21..aa3f93c03e0f 100644 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c | |||
| @@ -93,7 +93,6 @@ static int inotify_handle_event(struct fsnotify_group *group, | |||
| 93 | struct fsnotify_mark *mark, | 93 | struct fsnotify_mark *mark, |
| 94 | struct fsnotify_event *event) | 94 | struct fsnotify_event *event) |
| 95 | { | 95 | { |
| 96 | struct fsnotify_mark *fsn_mark; | ||
| 97 | struct inotify_inode_mark *i_mark; | 96 | struct inotify_inode_mark *i_mark; |
| 98 | struct inode *to_tell; | 97 | struct inode *to_tell; |
| 99 | struct inotify_event_private_data *event_priv; | 98 | struct inotify_event_private_data *event_priv; |
| @@ -106,11 +105,7 @@ static int inotify_handle_event(struct fsnotify_group *group, | |||
| 106 | 105 | ||
| 107 | to_tell = event->to_tell; | 106 | to_tell = event->to_tell; |
| 108 | 107 | ||
| 109 | fsn_mark = fsnotify_find_inode_mark(group, to_tell); | 108 | i_mark = container_of(mark, struct inotify_inode_mark, |
| 110 | /* race with watch removal? We already passes should_send */ | ||
| 111 | if (unlikely(!fsn_mark)) | ||
| 112 | return 0; | ||
| 113 | i_mark = container_of(fsn_mark, struct inotify_inode_mark, | ||
| 114 | fsn_mark); | 109 | fsn_mark); |
| 115 | wd = i_mark->wd; | 110 | wd = i_mark->wd; |
| 116 | 111 | ||
| @@ -132,14 +127,8 @@ static int inotify_handle_event(struct fsnotify_group *group, | |||
| 132 | ret = PTR_ERR(added_event); | 127 | ret = PTR_ERR(added_event); |
| 133 | } | 128 | } |
| 134 | 129 | ||
| 135 | if (fsn_mark->mask & IN_ONESHOT) | 130 | if (mark->mask & IN_ONESHOT) |
| 136 | fsnotify_destroy_mark(fsn_mark); | 131 | fsnotify_destroy_mark(mark); |
| 137 | |||
| 138 | /* | ||
| 139 | * If we hold the fsn_mark until after the event is on the queue | ||
| 140 | * IN_IGNORED won't be able to pass this event in the queue | ||
| 141 | */ | ||
| 142 | fsnotify_put_mark(fsn_mark); | ||
| 143 | 132 | ||
| 144 | return ret; | 133 | return ret; |
| 145 | } | 134 | } |
| @@ -153,20 +142,15 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode | |||
| 153 | struct vfsmount *mnt, struct fsnotify_mark *mark, | 142 | struct vfsmount *mnt, struct fsnotify_mark *mark, |
| 154 | __u32 mask, void *data, int data_type) | 143 | __u32 mask, void *data, int data_type) |
| 155 | { | 144 | { |
| 156 | struct fsnotify_mark *fsn_mark; | ||
| 157 | bool send; | 145 | bool send; |
| 158 | 146 | ||
| 159 | pr_debug("%s: group=%p inode=%p mask=%x data=%p data_type=%d\n", | 147 | pr_debug("%s: group=%p inode=%p mask=%x data=%p data_type=%d\n", |
| 160 | __func__, group, inode, mask, data, data_type); | 148 | __func__, group, inode, mask, data, data_type); |
| 161 | 149 | ||
| 162 | fsn_mark = fsnotify_find_inode_mark(group, inode); | ||
| 163 | if (!fsn_mark) | ||
| 164 | return false; | ||
| 165 | |||
| 166 | mask = (mask & ~FS_EVENT_ON_CHILD); | 150 | mask = (mask & ~FS_EVENT_ON_CHILD); |
| 167 | send = (fsn_mark->mask & mask); | 151 | send = (mark->mask & mask); |
| 168 | 152 | ||
| 169 | if (send && (fsn_mark->mask & FS_EXCL_UNLINK) && | 153 | if (send && (mark->mask & FS_EXCL_UNLINK) && |
| 170 | (data_type == FSNOTIFY_EVENT_FILE)) { | 154 | (data_type == FSNOTIFY_EVENT_FILE)) { |
| 171 | struct file *file = data; | 155 | struct file *file = data; |
| 172 | 156 | ||
| @@ -174,9 +158,6 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode | |||
| 174 | send = false; | 158 | send = false; |
| 175 | } | 159 | } |
| 176 | 160 | ||
| 177 | /* find took a reference */ | ||
| 178 | fsnotify_put_mark(fsn_mark); | ||
| 179 | |||
| 180 | return send; | 161 | return send; |
| 181 | } | 162 | } |
| 182 | 163 | ||
