summaryrefslogtreecommitdiffstats
path: root/fs/notify/inotify
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2019-01-10 12:04:31 -0500
committerJan Kara <jack@suse.cz>2019-02-06 09:25:11 -0500
commita0a92d261f2922f4b5d2c0a98d6c41a89c7f5edd (patch)
tree958b51acde8238d308c2ca0986feeb95dc1fd864 /fs/notify/inotify
parent45a9fb3725d8868a9b4192afd1a1f2bff1cc5ffb (diff)
fsnotify: move mask out of struct fsnotify_event
Common fsnotify_event helpers have no need for the mask field. It is only used by backend code, so move the field out of the abstract fsnotify_event struct and into the concrete backend event structs. This change packs struct inotify_event_info better on 64bit machine and will allow us to cram some more fields into struct fanotify_event_info. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/inotify')
-rw-r--r--fs/notify/inotify/inotify.h1
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c9
-rw-r--r--fs/notify/inotify/inotify_user.c5
3 files changed, 9 insertions, 6 deletions
diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h
index 7e4578d35b61..74ae60305189 100644
--- a/fs/notify/inotify/inotify.h
+++ b/fs/notify/inotify/inotify.h
@@ -5,6 +5,7 @@
5 5
6struct inotify_event_info { 6struct inotify_event_info {
7 struct fsnotify_event fse; 7 struct fsnotify_event fse;
8 u32 mask;
8 int wd; 9 int wd;
9 u32 sync_cookie; 10 u32 sync_cookie;
10 int name_len; 11 int name_len;
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index f4184b4f3815..fe97299975f2 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -43,11 +43,11 @@ static bool event_compare(struct fsnotify_event *old_fsn,
43{ 43{
44 struct inotify_event_info *old, *new; 44 struct inotify_event_info *old, *new;
45 45
46 if (old_fsn->mask & FS_IN_IGNORED)
47 return false;
48 old = INOTIFY_E(old_fsn); 46 old = INOTIFY_E(old_fsn);
49 new = INOTIFY_E(new_fsn); 47 new = INOTIFY_E(new_fsn);
50 if ((old_fsn->mask == new_fsn->mask) && 48 if (old->mask & FS_IN_IGNORED)
49 return false;
50 if ((old->mask == new->mask) &&
51 (old_fsn->inode == new_fsn->inode) && 51 (old_fsn->inode == new_fsn->inode) &&
52 (old->name_len == new->name_len) && 52 (old->name_len == new->name_len) &&
53 (!old->name_len || !strcmp(old->name, new->name))) 53 (!old->name_len || !strcmp(old->name, new->name)))
@@ -114,7 +114,8 @@ int inotify_handle_event(struct fsnotify_group *group,
114 } 114 }
115 115
116 fsn_event = &event->fse; 116 fsn_event = &event->fse;
117 fsnotify_init_event(fsn_event, inode, mask); 117 fsnotify_init_event(fsn_event, inode);
118 event->mask = mask;
118 event->wd = i_mark->wd; 119 event->wd = i_mark->wd;
119 event->sync_cookie = cookie; 120 event->sync_cookie = cookie;
120 event->name_len = len; 121 event->name_len = len;
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 798f1253141a..e2901fbb9f76 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -189,7 +189,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
189 */ 189 */
190 pad_name_len = round_event_name_len(fsn_event); 190 pad_name_len = round_event_name_len(fsn_event);
191 inotify_event.len = pad_name_len; 191 inotify_event.len = pad_name_len;
192 inotify_event.mask = inotify_mask_to_arg(fsn_event->mask); 192 inotify_event.mask = inotify_mask_to_arg(event->mask);
193 inotify_event.wd = event->wd; 193 inotify_event.wd = event->wd;
194 inotify_event.cookie = event->sync_cookie; 194 inotify_event.cookie = event->sync_cookie;
195 195
@@ -634,7 +634,8 @@ static struct fsnotify_group *inotify_new_group(unsigned int max_events)
634 return ERR_PTR(-ENOMEM); 634 return ERR_PTR(-ENOMEM);
635 } 635 }
636 group->overflow_event = &oevent->fse; 636 group->overflow_event = &oevent->fse;
637 fsnotify_init_event(group->overflow_event, NULL, FS_Q_OVERFLOW); 637 fsnotify_init_event(group->overflow_event, NULL);
638 oevent->mask = FS_Q_OVERFLOW;
638 oevent->wd = -1; 639 oevent->wd = -1;
639 oevent->sync_cookie = 0; 640 oevent->sync_cookie = 0;
640 oevent->name_len = 0; 641 oevent->name_len = 0;