diff options
| author | Andreas Gruenbacher <agruen@suse.de> | 2009-12-17 21:24:24 -0500 |
|---|---|---|
| committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:53 -0400 |
| commit | 72acc854427948efed7a83da27f7dc3239ac9afc (patch) | |
| tree | 69a8f479a644701a52abe07d7bf2751cdf4cc159 | |
| parent | 098cf2fc77ee190c92bf9d08d69a13305f2487ec (diff) | |
fsnotify: kill FSNOTIFY_EVENT_FILE
Some fsnotify operations send a struct file. This is more information than
we technically need. We instead send a struct path in all cases instead of
sometimes a path and sometimes a file.
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Eric Paris <eparis@redhat.com>
| -rw-r--r-- | fs/notify/fsnotify.c | 12 | ||||
| -rw-r--r-- | fs/notify/notification.c | 9 | ||||
| -rw-r--r-- | include/linux/fsnotify.h | 36 | ||||
| -rw-r--r-- | include/linux/fsnotify_backend.h | 5 |
4 files changed, 26 insertions, 36 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 78c440c343a8..60e84fd338dd 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
| @@ -79,15 +79,15 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode) | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /* Notify this dentry's parent about a child's events. */ | 81 | /* Notify this dentry's parent about a child's events. */ |
| 82 | void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) | 82 | void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) |
| 83 | { | 83 | { |
| 84 | struct dentry *parent; | 84 | struct dentry *parent; |
| 85 | struct inode *p_inode; | 85 | struct inode *p_inode; |
| 86 | bool send = false; | 86 | bool send = false; |
| 87 | bool should_update_children = false; | 87 | bool should_update_children = false; |
| 88 | 88 | ||
| 89 | if (file) | 89 | if (!dentry) |
| 90 | dentry = file->f_path.dentry; | 90 | dentry = path->dentry; |
| 91 | 91 | ||
| 92 | if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) | 92 | if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) |
| 93 | return; | 93 | return; |
| @@ -119,8 +119,8 @@ void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) | |||
| 119 | * specifies these are events which came from a child. */ | 119 | * specifies these are events which came from a child. */ |
| 120 | mask |= FS_EVENT_ON_CHILD; | 120 | mask |= FS_EVENT_ON_CHILD; |
| 121 | 121 | ||
| 122 | if (file) | 122 | if (path) |
| 123 | fsnotify(p_inode, mask, file, FSNOTIFY_EVENT_FILE, | 123 | fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH, |
| 124 | dentry->d_name.name, 0); | 124 | dentry->d_name.name, 0); |
| 125 | else | 125 | else |
| 126 | fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, | 126 | fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, |
| @@ -194,8 +194,6 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const | |||
| 194 | 194 | ||
| 195 | if (data_is == FSNOTIFY_EVENT_PATH) | 195 | if (data_is == FSNOTIFY_EVENT_PATH) |
| 196 | mnt = ((struct path *)data)->mnt; | 196 | mnt = ((struct path *)data)->mnt; |
| 197 | else if (data_is == FSNOTIFY_EVENT_FILE) | ||
| 198 | mnt = ((struct file *)data)->f_path.mnt; | ||
| 199 | 197 | ||
| 200 | /* if this inode's directed listeners don't care and nothing on the vfsmount | 198 | /* if this inode's directed listeners don't care and nothing on the vfsmount |
| 201 | * listeners list cares, nothing to do */ | 199 | * listeners list cares, nothing to do */ |
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index dafd0b7687b8..066f1f988bac 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
| @@ -390,15 +390,6 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, | |||
| 390 | event->data_type = data_type; | 390 | event->data_type = data_type; |
| 391 | 391 | ||
| 392 | switch (data_type) { | 392 | switch (data_type) { |
| 393 | case FSNOTIFY_EVENT_FILE: { | ||
| 394 | struct file *file = data; | ||
| 395 | struct path *path = &file->f_path; | ||
| 396 | event->path.dentry = path->dentry; | ||
| 397 | event->path.mnt = path->mnt; | ||
| 398 | path_get(&event->path); | ||
| 399 | event->data_type = FSNOTIFY_EVENT_PATH; | ||
| 400 | break; | ||
| 401 | } | ||
| 402 | case FSNOTIFY_EVENT_PATH: { | 393 | case FSNOTIFY_EVENT_PATH: { |
| 403 | struct path *path = data; | 394 | struct path *path = data; |
| 404 | event->path.dentry = path->dentry; | 395 | event->path.dentry = path->dentry; |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 04ea03ea8090..06d296d85ebf 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
| @@ -26,14 +26,12 @@ static inline void fsnotify_d_instantiate(struct dentry *entry, | |||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /* Notify this dentry's parent about a child's events. */ | 28 | /* Notify this dentry's parent about a child's events. */ |
| 29 | static inline void fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) | 29 | static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) |
| 30 | { | 30 | { |
| 31 | BUG_ON(file && dentry); | 31 | if (!dentry) |
| 32 | dentry = path->dentry; | ||
| 32 | 33 | ||
| 33 | if (file) | 34 | __fsnotify_parent(path, dentry, mask); |
| 34 | dentry = file->f_path.dentry; | ||
| 35 | |||
| 36 | __fsnotify_parent(file, dentry, mask); | ||
| 37 | } | 35 | } |
| 38 | 36 | ||
| 39 | /* | 37 | /* |
| @@ -160,14 +158,15 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | |||
| 160 | */ | 158 | */ |
| 161 | static inline void fsnotify_access(struct file *file) | 159 | static inline void fsnotify_access(struct file *file) |
| 162 | { | 160 | { |
| 163 | struct inode *inode = file->f_path.dentry->d_inode; | 161 | struct path *path = &file->f_path; |
| 162 | struct inode *inode = path->dentry->d_inode; | ||
| 164 | __u32 mask = FS_ACCESS; | 163 | __u32 mask = FS_ACCESS; |
| 165 | 164 | ||
| 166 | if (S_ISDIR(inode->i_mode)) | 165 | if (S_ISDIR(inode->i_mode)) |
| 167 | mask |= FS_IN_ISDIR; | 166 | mask |= FS_IN_ISDIR; |
| 168 | 167 | ||
| 169 | fsnotify_parent(file, NULL, mask); | 168 | fsnotify_parent(path, NULL, mask); |
| 170 | fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); | 169 | fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); |
| 171 | } | 170 | } |
| 172 | 171 | ||
| 173 | /* | 172 | /* |
| @@ -175,14 +174,15 @@ static inline void fsnotify_access(struct file *file) | |||
| 175 | */ | 174 | */ |
| 176 | static inline void fsnotify_modify(struct file *file) | 175 | static inline void fsnotify_modify(struct file *file) |
| 177 | { | 176 | { |
| 178 | struct inode *inode = file->f_path.dentry->d_inode; | 177 | struct path *path = &file->f_path; |
| 178 | struct inode *inode = path->dentry->d_inode; | ||
| 179 | __u32 mask = FS_MODIFY; | 179 | __u32 mask = FS_MODIFY; |
| 180 | 180 | ||
| 181 | if (S_ISDIR(inode->i_mode)) | 181 | if (S_ISDIR(inode->i_mode)) |
| 182 | mask |= FS_IN_ISDIR; | 182 | mask |= FS_IN_ISDIR; |
| 183 | 183 | ||
| 184 | fsnotify_parent(file, NULL, mask); | 184 | fsnotify_parent(path, NULL, mask); |
| 185 | fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); | 185 | fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | /* | 188 | /* |
| @@ -190,14 +190,15 @@ static inline void fsnotify_modify(struct file *file) | |||
| 190 | */ | 190 | */ |
| 191 | static inline void fsnotify_open(struct file *file) | 191 | static inline void fsnotify_open(struct file *file) |
| 192 | { | 192 | { |
| 193 | struct inode *inode = file->f_path.dentry->d_inode; | 193 | struct path *path = &file->f_path; |
| 194 | struct inode *inode = path->dentry->d_inode; | ||
| 194 | __u32 mask = FS_OPEN; | 195 | __u32 mask = FS_OPEN; |
| 195 | 196 | ||
| 196 | if (S_ISDIR(inode->i_mode)) | 197 | if (S_ISDIR(inode->i_mode)) |
| 197 | mask |= FS_IN_ISDIR; | 198 | mask |= FS_IN_ISDIR; |
| 198 | 199 | ||
| 199 | fsnotify_parent(file, NULL, mask); | 200 | fsnotify_parent(path, NULL, mask); |
| 200 | fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); | 201 | fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); |
| 201 | } | 202 | } |
| 202 | 203 | ||
| 203 | /* | 204 | /* |
| @@ -205,6 +206,7 @@ static inline void fsnotify_open(struct file *file) | |||
| 205 | */ | 206 | */ |
| 206 | static inline void fsnotify_close(struct file *file) | 207 | static inline void fsnotify_close(struct file *file) |
| 207 | { | 208 | { |
| 209 | struct path *path = &file->f_path; | ||
| 208 | struct inode *inode = file->f_path.dentry->d_inode; | 210 | struct inode *inode = file->f_path.dentry->d_inode; |
| 209 | fmode_t mode = file->f_mode; | 211 | fmode_t mode = file->f_mode; |
| 210 | __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; | 212 | __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; |
| @@ -212,8 +214,8 @@ static inline void fsnotify_close(struct file *file) | |||
| 212 | if (S_ISDIR(inode->i_mode)) | 214 | if (S_ISDIR(inode->i_mode)) |
| 213 | mask |= FS_IN_ISDIR; | 215 | mask |= FS_IN_ISDIR; |
| 214 | 216 | ||
| 215 | fsnotify_parent(file, NULL, mask); | 217 | fsnotify_parent(path, NULL, mask); |
| 216 | fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); | 218 | fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); |
| 217 | } | 219 | } |
| 218 | 220 | ||
| 219 | /* | 221 | /* |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index cf165857199b..7a6ba755acc3 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
| @@ -214,7 +214,6 @@ struct fsnotify_event { | |||
| 214 | #define FSNOTIFY_EVENT_NONE 0 | 214 | #define FSNOTIFY_EVENT_NONE 0 |
| 215 | #define FSNOTIFY_EVENT_PATH 1 | 215 | #define FSNOTIFY_EVENT_PATH 1 |
| 216 | #define FSNOTIFY_EVENT_INODE 2 | 216 | #define FSNOTIFY_EVENT_INODE 2 |
| 217 | #define FSNOTIFY_EVENT_FILE 3 | ||
| 218 | int data_type; /* which of the above union we have */ | 217 | int data_type; /* which of the above union we have */ |
| 219 | atomic_t refcnt; /* how many groups still are using/need to send this event */ | 218 | atomic_t refcnt; /* how many groups still are using/need to send this event */ |
| 220 | __u32 mask; /* the type of access, bitwise OR for FS_* event types */ | 219 | __u32 mask; /* the type of access, bitwise OR for FS_* event types */ |
| @@ -280,7 +279,7 @@ struct fsnotify_mark_entry { | |||
| 280 | /* main fsnotify call to send events */ | 279 | /* main fsnotify call to send events */ |
| 281 | extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, | 280 | extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, |
| 282 | const char *name, u32 cookie); | 281 | const char *name, u32 cookie); |
| 283 | extern void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask); | 282 | extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask); |
| 284 | extern void __fsnotify_inode_delete(struct inode *inode); | 283 | extern void __fsnotify_inode_delete(struct inode *inode); |
| 285 | extern u32 fsnotify_get_cookie(void); | 284 | extern u32 fsnotify_get_cookie(void); |
| 286 | 285 | ||
| @@ -393,7 +392,7 @@ static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int d | |||
| 393 | const char *name, u32 cookie) | 392 | const char *name, u32 cookie) |
| 394 | {} | 393 | {} |
| 395 | 394 | ||
| 396 | static inline void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) | 395 | static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) |
| 397 | {} | 396 | {} |
| 398 | 397 | ||
| 399 | static inline void __fsnotify_inode_delete(struct inode *inode) | 398 | static inline void __fsnotify_inode_delete(struct inode *inode) |
