fsnotify: kill FSNOTIFY_EVENT_FILE
Subsystems (5)
Eric Paris
maintainerPATCH 1/6 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.
---
fs/notify/fsnotify.c | 12 +++++------- fs/notify/notification.c | 9 --------- include/linux/fsnotify.h | 36 +++++++++++++++++++----------------- include/linux/fsnotify_backend.h | 5 ++--- 4 files changed, 26 insertions(+), 36 deletions(-)
fs/notify/fsnotify.c +5 -7
@@ -78,15 +78,15 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode) }/* Notify this dentry's parent about a child's events. */ -void __fsnotify_parent (struct file *file,struct dentry *dentry,__u32 mask) +void __fsnotify_parent (struct path *path,struct dentry *dentry,__u32 mask) {struct dentry *parent;struct inode *p_inode;bool send = false;bool should_update_children = false; -if (file) - dentry = file->f_path.dentry; +if (!dentry) + dentry = path->dentry;if (!(dentry->d_flags &DCACHE_FSNOTIFY_PARENT_WATCHED ))return ;
@@ -118,8 +118,8 @@ void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)* specifies these are events which came from a child. */ mask |=FS_EVENT_ON_CHILD ; -if (file) -fsnotify (p_inode, mask, file,FSNOTIFY_EVENT_FILE , +if (path) +fsnotify (p_inode, mask, path,FSNOTIFY_EVENT_PATH , dentry->d_name.name,0 );else fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE,
@@ -193,8 +193,6 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, constif (data_is ==FSNOTIFY_EVENT_PATH ) mnt = ((struct path *)data)->mnt; -else if (data_is ==FSNOTIFY_EVENT_FILE ) - mnt = ((struct file *)data)->f_path.mnt;/* if this inode's directed listeners don't care and nothing on the vfsmount * listeners list cares, nothing to do */
fs/notify/notification.c +0 -9
@@ -390,15 +390,6 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, event->data_type = data_type;switch (data_type) { -case FSNOTIFY_EVENT_FILE : { -struct file *file = data; -struct path *path = &file->f_path; - event->path.dentry = path->dentry; - event->path.mnt = path->mnt; -path_get (&event->path); - event->data_type =FSNOTIFY_EVENT_PATH ; -break ; - }case FSNOTIFY_EVENT_PATH : {struct path *path = data; event->path.dentry = path->dentry;
include/linux/fsnotify.h +19 -17
@@ -29,14 +29,12 @@ static inline void fsnotify_d_instantiate(struct dentry *entry, }/* Notify this dentry's parent about a child's events. */ -static inline void fsnotify_parent (struct file *file,struct dentry *dentry,__u32 mask) +static inline void fsnotify_parent (struct path *path,struct dentry *dentry,__u32 mask) { -BUG_ON (file && dentry); +if (!dentry) + dentry = path->dentry; -if (file) - dentry = file->f_path.dentry; - -__fsnotify_parent (file, dentry, mask); +__fsnotify_parent (path, dentry, mask);inotify_dentry_parent_queue_event (dentry, mask,0 , dentry->d_name.name); }
@@ -190,7 +188,8 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)*/ static inline void fsnotify_access (struct file *file) { -struct inode *inode = file->f_path.dentry->d_inode; +struct path *path = &file->f_path; +struct inode *inode = path->dentry->d_inode;__u32 mask =FS_ACCESS ;if (S_ISDIR (inode->i_mode))
@@ -198,8 +197,8 @@ static inline void fsnotify_access(struct file *file)inotify_inode_queue_event (inode, mask,0 ,NULL ,NULL ); -fsnotify_parent (file,NULL , mask); -fsnotify (inode, mask, file,FSNOTIFY_EVENT_FILE ,NULL ,0 ); +fsnotify_parent (path,NULL , mask); +fsnotify (inode, mask, path,FSNOTIFY_EVENT_PATH ,NULL ,0 ); }/*
@@ -207,7 +206,8 @@ static inline void fsnotify_access(struct file *file)*/ static inline void fsnotify_modify (struct file *file) { -struct inode *inode = file->f_path.dentry->d_inode; +struct path *path = &file->f_path; +struct inode *inode = path->dentry->d_inode;__u32 mask =FS_MODIFY ;if (S_ISDIR (inode->i_mode))
@@ -215,8 +215,8 @@ static inline void fsnotify_modify(struct file *file)inotify_inode_queue_event (inode, mask,0 ,NULL ,NULL ); -fsnotify_parent (file,NULL , mask); -fsnotify (inode, mask, file,FSNOTIFY_EVENT_FILE ,NULL ,0 ); +fsnotify_parent (path,NULL , mask); +fsnotify (inode, mask, path,FSNOTIFY_EVENT_PATH ,NULL ,0 ); }/*
@@ -224,7 +224,8 @@ static inline void fsnotify_modify(struct file *file)*/ static inline void fsnotify_open (struct file *file) { -struct inode *inode = file->f_path.dentry->d_inode; +struct path *path = &file->f_path; +struct inode *inode = path->dentry->d_inode;__u32 mask =FS_OPEN ;if (S_ISDIR (inode->i_mode))
@@ -232,8 +233,8 @@ static inline void fsnotify_open(struct file *file)inotify_inode_queue_event (inode, mask,0 ,NULL ,NULL ); -fsnotify_parent (file,NULL , mask); -fsnotify (inode, mask, file,FSNOTIFY_EVENT_FILE ,NULL ,0 ); +fsnotify_parent (path,NULL , mask); +fsnotify (inode, mask, path,FSNOTIFY_EVENT_PATH ,NULL ,0 ); }/*
@@ -241,6 +242,7 @@ static inline void fsnotify_open(struct file *file)*/ static inline void fsnotify_close (struct file *file) { +struct path *path = &file->f_path;struct inode *inode = file->f_path.dentry->d_inode;fmode_t mode = file->f_mode;__u32 mask = (mode &FMODE_WRITE ) ?FS_CLOSE_WRITE :FS_CLOSE_NOWRITE ;
@@ -250,8 +252,8 @@ static inline void fsnotify_close(struct file *file)inotify_inode_queue_event (inode, mask,0 ,NULL ,NULL ); -fsnotify_parent (file,NULL , mask); -fsnotify (inode, mask, file,FSNOTIFY_EVENT_FILE ,NULL ,0 ); +fsnotify_parent (path,NULL , mask); +fsnotify (inode, mask, path,FSNOTIFY_EVENT_PATH ,NULL ,0 ); }/*
include/linux/fsnotify_backend.h +2 -3
@@ -214,7 +214,6 @@ struct fsnotify_event {#define FSNOTIFY_EVENT_NONE 0#define FSNOTIFY_EVENT_PATH 1#define FSNOTIFY_EVENT_INODE 2 -#define FSNOTIFY_EVENT_FILE 3int data_type;/* which of the above union we have */ atomic_t refcnt;/* how many groups still are using/need to send this event */ __u32 mask;/* the type of access, bitwise OR for FS_* event types */
@@ -280,7 +279,7 @@ struct fsnotify_mark_entry {/* main fsnotify call to send events */ extern void fsnotify (struct inode *to_tell,__u32 mask,void *data,int data_is,const char *name,u32 cookie); -extern void __fsnotify_parent (struct file *file,struct dentry *dentry,__u32 mask); +extern void __fsnotify_parent (struct path *path,struct dentry *dentry,__u32 mask);extern void __fsnotify_inode_delete (struct inode *inode);extern u32 fsnotify_get_cookie (void );
@@ -393,7 +392,7 @@ static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int d const char *name, u32 cookie) {} -static inline void __fsnotify_parent (struct file *file,struct dentry *dentry,__u32 mask) +static inline void __fsnotify_parent (struct path *path,struct dentry *dentry,__u32 mask) {}static inline void __fsnotify_inode_delete (struct inode *inode)
Eric Paris
maintainerPATCH 2/6 fsnotify: rename fsnotify_mark_entry to just fsnotify_mark
The name is long and it serves no real purpose. So rename fsnotify_mark_entry to just fsnotify_mark.
---
fs/inode.c | 2 + fs/notify/dnotify/dnotify.c | 24 +++++++++-------- fs/notify/group.c | 8 +++--- fs/notify/inode_mark.c | 48 +++++++++++++++++----------------- fs/notify/inotify/inotify.h | 6 ++-- fs/notify/inotify/inotify_fsnotify.c | 8 +++--- fs/notify/inotify/inotify_user.c | 8 +++--- include/linux/fs.h | 2 + include/linux/fsnotify.h | 20 +++++++------- include/linux/fsnotify_backend.h | 38 +++++++++++++-------------- kernel/audit_tree.c | 14 +++++----- kernel/audit_watch.c | 8 +++--- kernel/auditsc.c | 4 +-- 13 files changed, 95 insertions(+), 95 deletions(-)
fs/inode.c +1 -1
@@ -270,7 +270,7 @@ void inode_init_once(struct inode *inode)mutex_init (&inode->inotify_mutex);#endif #ifdef CONFIG_FSNOTIFY -INIT_HLIST_HEAD (&inode->i_fsnotify_mark_entries); +INIT_HLIST_HEAD (&inode->i_fsnotify_marks);#endif }EXPORT_SYMBOL (inode_init_once);
fs/notify/dnotify/dnotify.c +12 -12
@@ -34,12 +34,12 @@ static struct fsnotify_group *dnotify_group __read_mostly;static DEFINE_MUTEX (dnotify_mark_mutex);/* -* dnotify will attach one of these to each inode (i_fsnotify_mark_entries) which +* dnotify will attach one of these to each inode (i_fsnotify_marks) which * is being watched by dnotify. If multiple userspace applications are watching * the same directory with dnotify their information is chained in dn */ struct dnotify_mark_entry { -struct fsnotify_mark_entry fsn_entry; +struct fsnotify_mark fsn_entry;struct dnotify_struct *dn; };
@@ -51,7 +51,7 @@ struct dnotify_mark_entry {* it calls the fsnotify function so it can update the set of all events relevant * to this inode. */ -static void dnotify_recalc_inode_mask (struct fsnotify_mark_entry *entry) +static void dnotify_recalc_inode_mask (struct fsnotify_mark *entry) {__u32 new_mask, old_mask;struct dnotify_struct *dn;
@@ -85,7 +85,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark_entry *entry)static int dnotify_handle_event (struct fsnotify_group *group,struct fsnotify_event *event) { -struct fsnotify_mark_entry *entry =NULL ; +struct fsnotify_mark *entry =NULL ;struct dnotify_mark_entry *dnentry;struct inode *to_tell;struct dnotify_struct *dn;
@@ -136,7 +136,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group, struct inode *inode, struct vfsmount *mnt, __u32 mask, void *data, int data_type) { - struct fsnotify_mark_entry *entry; + struct fsnotify_mark *entry;bool send;/* !dir_notify_enable should never get here, don't waste time checking
@@ -163,7 +163,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,return send; } -static void dnotify_free_mark (struct fsnotify_mark_entry *entry) +static void dnotify_free_mark (struct fsnotify_mark *entry) { struct dnotify_mark_entry *dnentry = container_of(entry, struct dnotify_mark_entry,
@@ -184,14 +184,14 @@ static struct fsnotify_ops dnotify_fsnotify_ops = {/* * Called every time a file is closed. Looks first for a dnotify mark on the -* inode. If one is found run all of the ->dn entries attached to that +* inode. If one is found run all of the ->dn structures attached to that * mark for one relevant to this process closing the file and remove that * dnotify_struct. If that was the last dnotify_struct also remove the -* fsnotify_mark_entry. +* fsnotify_mark. */ void dnotify_flush (struct file *filp,fl_owner_t id) { -struct fsnotify_mark_entry *entry; +struct fsnotify_mark *entry;struct dnotify_mark_entry *dnentry;struct dnotify_struct *dn;struct dnotify_struct **prev;
@@ -260,7 +260,7 @@ static __u32 convert_arg(unsigned long arg)/* * If multiple processes watch the same inode with dnotify there is only one -* dnotify mark in inode->i_fsnotify_mark_entries but we chain a dnotify_struct +* dnotify mark in inode->i_fsnotify_marks but we chain a dnotify_struct * onto that mark. This function either attaches the new dnotify_struct onto * that list, or it |= the mask onto an existing dnofiy_struct. */
@@ -298,7 +298,7 @@ static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnentint fcntl_dirnotify (int fd,struct file *filp,unsigned long arg) {struct dnotify_mark_entry *new_dnentry, *dnentry; -struct fsnotify_mark_entry *new_entry, *entry; +struct fsnotify_mark *new_entry, *entry;struct dnotify_struct *dn;struct inode *inode;fl_owner_t id = current->files;
@@ -378,7 +378,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)/* if (f != filp) means that we lost a race and another task/thread * actually closed the fd we are still playing with before we grabbed * the dnotify_mark_mutex and entry->lock. Since closing the fd is the -* only time we clean up the mark entries we need to get our mark off +* only time we clean up the marks we need to get our mark off * the list. */ if (f != filp) {/* if we added ourselves, shoot ourselves, it's possible that
fs/notify/group.c +4 -4
@@ -74,10 +74,10 @@ void fsnotify_recalc_group_mask(struct fsnotify_group *group) {__u32 mask =0 ;__u32 old_mask = group->mask; -struct fsnotify_mark_entry *entry; +struct fsnotify_mark *entry;spin_lock (&group->mark_lock); -list_for_each_entry (entry, &group->mark_entries, g_list) +list_for_each_entry (entry, &group->marks_list, g_list) mask |= entry->mask;spin_unlock (&group->mark_lock);
@@ -133,7 +133,7 @@ void fsnotify_final_destroy_group(struct fsnotify_group *group)*/ static void fsnotify_destroy_group (struct fsnotify_group *group) { -/* clear all inode mark entries for this group */ +/* clear all inode marks for this group */ fsnotify_clear_marks_by_group (group);/* past the point of no return, matches the initial value of 1 */
@@ -224,7 +224,7 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)INIT_LIST_HEAD (&group->vfsmount_group_list);spin_lock_init (&group->mark_lock); -INIT_LIST_HEAD (&group->mark_entries); +INIT_LIST_HEAD (&group->marks_list); group->ops = ops;
fs/notify/inode_mark.c +24 -24
154 lines not on this page · raw message
fs/notify/inotify/inotify.h +3 -3
@@ -10,12 +10,12 @@ struct inotify_event_private_data { };struct inotify_inode_mark_entry { -/* fsnotify_mark_entry MUST be the first thing */ -struct fsnotify_mark_entry fsn_entry; +/* fsnotify_mark MUST be the first thing */ +struct fsnotify_mark fsn_entry;int wd; }; -extern void inotify_ignored_and_remove_idr (struct fsnotify_mark_entry *entry, +extern void inotify_ignored_and_remove_idr (struct fsnotify_mark *entry,struct fsnotify_group *group);extern void inotify_free_event_priv (struct fsnotify_event_private_data *event_priv);
fs/notify/inotify/inotify_fsnotify.c +4 -4
@@ -87,7 +87,7 @@ static int inotify_merge(struct list_head *list, struct fsnotify_event *event)static int inotify_handle_event (struct fsnotify_group *group,struct fsnotify_event *event) { -struct fsnotify_mark_entry *entry; +struct fsnotify_mark *entry;struct inotify_inode_mark_entry *ientry;struct inode *to_tell;struct inotify_event_private_data *event_priv;
@@ -134,7 +134,7 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_evreturn ret; } -static void inotify_freeing_mark (struct fsnotify_mark_entry *entry,struct fsnotify_group *group) +static void inotify_freeing_mark (struct fsnotify_mark *entry,struct fsnotify_group *group) {inotify_ignored_and_remove_idr (entry, group); }
@@ -143,7 +143,7 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode struct vfsmount *mnt, __u32 mask, void *data, int data_type) { - struct fsnotify_mark_entry *entry; + struct fsnotify_mark *entry;bool send;spin_lock (&inode->i_lock);
@@ -170,7 +170,7 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode*/ static int idr_callback (int id,void *p,void *data) { -struct fsnotify_mark_entry *entry; +struct fsnotify_mark *entry;struct inotify_inode_mark_entry *ientry;static bool warned = false;
fs/notify/inotify/inotify_user.c +4 -4
@@ -394,7 +394,7 @@ static struct inotify_inode_mark_entry *inotify_idr_find_locked(struct fsnotify_ ientry =idr_find (idr, wd);if (ientry) { -struct fsnotify_mark_entry *fsn_entry = &ientry->fsn_entry; +struct fsnotify_mark *fsn_entry = &ientry->fsn_entry;fsnotify_get_mark (fsn_entry);/* One ref for being in the idr, one ref we just took */
@@ -510,7 +510,7 @@ out:/* * Send IN_IGNORED for this wd, remove this wd from the idr. */ -void inotify_ignored_and_remove_idr (struct fsnotify_mark_entry *entry, +void inotify_ignored_and_remove_idr (struct fsnotify_mark *entry,struct fsnotify_group *group) {struct inotify_inode_mark_entry *ientry;
@@ -552,7 +552,7 @@ skip_send_ignore: }/* ding dong the mark is dead */ -static void inotify_free_mark (struct fsnotify_mark_entry *entry) +static void inotify_free_mark (struct fsnotify_mark *entry) {struct inotify_inode_mark_entry *ientry;
@@ -565,7 +565,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group, struct inode *inode, u32 arg) { -struct fsnotify_mark_entry *entry; +struct fsnotify_mark *entry;struct inotify_inode_mark_entry *ientry;__u32 old_mask, new_mask;__u32 mask;
include/linux/fs.h +1 -1
@@ -762,7 +762,7 @@ struct inode {#ifdef CONFIG_FSNOTIFY __u32 i_fsnotify_mask;/* all events this inode cares about */ -struct hlist_head i_fsnotify_mark_entries;/* fsnotify mark entries */ +struct hlist_head i_fsnotify_marks;#endif #ifdef CONFIG_INOTIFY
include/linux/fsnotify.h +10 -10
@@ -20,12 +20,12 @@* fsnotify_d_instantiate - instantiate a dentry for inode * Called with dcache_lock held. */ -static inline void fsnotify_d_instantiate (struct dentry *entry, +static inline void fsnotify_d_instantiate (struct dentry *dentry,struct inode *inode) { -__fsnotify_d_instantiate (entry, inode); +__fsnotify_d_instantiate (dentry, inode); -inotify_d_instantiate (entry, inode); +inotify_d_instantiate (dentry, inode); }/* Notify this dentry's parent about a child's events. */
@@ -40,18 +40,18 @@ static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u }/* -* fsnotify_d_move - entry has been moved -* Called with dcache_lock and entry->d_lock held. +* fsnotify_d_move - dentry has been moved +* Called with dcache_lock and dentry->d_lock held. */ -static inline void fsnotify_d_move (struct dentry *entry) +static inline void fsnotify_d_move (struct dentry *dentry) {/* -* On move we need to update entry->d_flags to indicate if the new parent -* cares about events from this entry. +* On move we need to update dentry->d_flags to indicate if the new parent +* cares about events from this dentry. */ -__fsnotify_update_dcache_flags (entry); +__fsnotify_update_dcache_flags (dentry); -inotify_d_move (entry); +inotify_d_move (dentry); }/*
include/linux/fsnotify_backend.h +19 -19
@@ -62,7 +62,7 @@struct fsnotify_group ;struct fsnotify_event ; -struct fsnotify_mark_entry ; +struct fsnotify_mark ;struct fsnotify_event_private_data ;/*
@@ -83,7 +83,7 @@ struct fsnotify_ops { int data_type);int (*handle_event)(struct fsnotify_group *group,struct fsnotify_event *event);void (*free_group_priv)(struct fsnotify_group *group); -void (*freeing_mark)(struct fsnotify_mark_entry *entry,struct fsnotify_group *group); +void (*freeing_mark)(struct fsnotify_mark *entry,struct fsnotify_group *group);void (*free_event_priv)(struct fsnotify_event_private_data *priv); };
@@ -133,12 +133,12 @@ struct fsnotify_group {unsigned int q_len;/* events on the queue */ unsigned int max_events;/* maximum events allowed on the list */ -/* stores all fastapth entries assoc with this group so they can be cleaned on unregister */ -spinlock_t mark_lock;/* protect mark_entries list */ +/* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ +spinlock_t mark_lock;/* protect marks_list */ atomic_t num_marks;/* 1 for each mark entry and 1 for not being * past the point of no return when freeing * a group */ -struct list_head mark_entries;/* all inode mark entries for this group */ +struct list_head marks_list;/* all inode marks for this group */ /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */ bool on_inode_group_list;
@@ -226,20 +226,20 @@ struct fsnotify_event { };/* -* Inode specific fields in an fsnotify_mark_entry +* Inode specific fields in an fsnotify_mark */ struct fsnotify_inode_mark {struct inode *inode;/* inode this entry is associated with */ -struct hlist_node i_list;/* list of mark_entries by inode->i_fsnotify_mark_entries */ +struct hlist_node i_list;/* list of marks by inode->i_fsnotify_marks */ struct list_head free_i_list;/* tmp list used when freeing this mark */ };/* -* Mount point specific fields in an fsnotify_mark_entry +* Mount point specific fields in an fsnotify_mark */ struct fsnotify_vfsmount_mark {struct vfsmount *mnt;/* inode this entry is associated with */ -struct hlist_node m_list;/* list of mark_entries by inode->i_fsnotify_mark_entries */ +struct hlist_node m_list;/* list of marks by inode->i_fsnotify_marks */ struct list_head free_m_list;/* tmp list used when freeing this mark */ };
@@ -253,13 +253,13 @@ struct fsnotify_vfsmount_mark {* (such as dnotify) will flush these when the open fd is closed and not at * inode eviction or modification. */ -struct fsnotify_mark_entry { +struct fsnotify_mark {__u32 mask;/* mask this mark entry is for */ /* we hold ref for each i_list and g_list. also one ref for each 'thing' * in kernel that found and may be using this mark. */ atomic_t refcnt;/* active things looking at this mark */ struct fsnotify_group *group;/* group this mark entry is for */ -struct list_head g_list;/* list of mark_entries by group->i_fsnotify_mark_entries */ +struct list_head g_list;/* list of marks by group->i_fsnotify_marks */ spinlock_t lock;/* protect group and inode */ union {struct fsnotify_inode_mark i;
@@ -269,7 +269,7 @@ struct fsnotify_mark_entry {#define FSNOTIFY_MARK_FLAG_INODE 0x01#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02unsigned int flags;/* vfsmount or inode mark? */ -void (*free_mark)(struct fsnotify_mark_entry *entry);/* called on final put+free */ +void (*free_mark)(struct fsnotify_mark *entry);/* called on final put+free */ };#ifdef CONFIG_FSNOTIFY
@@ -361,19 +361,19 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group/* run all marks associated with an inode and update inode->i_fsnotify_mask */ extern void fsnotify_recalc_inode_mask (struct inode *inode); -extern void fsnotify_init_mark (struct fsnotify_mark_entry *entry,void (*free_mark)(struct fsnotify_mark_entry *entry)); +extern void fsnotify_init_mark (struct fsnotify_mark *entry,void (*free_mark)(struct fsnotify_mark *entry));/* find (and take a reference) to a mark associated with group and inode */ -extern struct fsnotify_mark_entry *fsnotify_find_mark_entry (struct fsnotify_group *group,struct inode *inode); +extern struct fsnotify_mark *fsnotify_find_mark_entry (struct fsnotify_group *group,struct inode *inode);/* copy the values from old into new */ -extern void fsnotify_duplicate_mark (struct fsnotify_mark_entry *new,struct fsnotify_mark_entry *old); +extern void fsnotify_duplicate_mark (struct fsnotify_mark *new,struct fsnotify_mark *old);/* attach the mark to both the group and the inode */ -extern int fsnotify_add_mark (struct fsnotify_mark_entry *entry,struct fsnotify_group *group,struct inode *inode,int allow_dups); +extern int fsnotify_add_mark (struct fsnotify_mark *entry,struct fsnotify_group *group,struct inode *inode,int allow_dups);/* given a mark, flag it to be freed when all references are dropped */ -extern void fsnotify_destroy_mark_by_entry (struct fsnotify_mark_entry *entry); +extern void fsnotify_destroy_mark_by_entry (struct fsnotify_mark *entry);/* run all the marks in a group, and flag them to be freed */ extern void fsnotify_clear_marks_by_group (struct fsnotify_group *group); -extern void fsnotify_get_mark (struct fsnotify_mark_entry *entry); -extern void fsnotify_put_mark (struct fsnotify_mark_entry *entry); +extern void fsnotify_get_mark (struct fsnotify_mark *entry); +extern void fsnotify_put_mark (struct fsnotify_mark *entry);extern void fsnotify_unmount_inodes (struct list_head *list);/* put here because inotify does some weird stuff when destroying watches */
kernel/audit_tree.c +7 -7
@@ -21,7 +21,7 @@ struct audit_tree {struct audit_chunk {struct list_head hash; -struct fsnotify_mark_entry mark; +struct fsnotify_mark mark;struct list_head trees;/* with root here */ int dead;int count;
@@ -133,7 +133,7 @@ static void __put_chunk(struct rcu_head *rcu)audit_put_chunk (chunk); } -static void audit_tree_destroy_watch (struct fsnotify_mark_entry *entry) +static void audit_tree_destroy_watch (struct fsnotify_mark *entry) { struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);call_rcu (&chunk->head, __put_chunk);
@@ -175,7 +175,7 @@ static inline struct list_head *chunk_hash(const struct inode *inode)/* hash_lock & entry->lock is held by caller */ static void insert_hash (struct audit_chunk *chunk) { -struct fsnotify_mark_entry *entry = &chunk->mark; +struct fsnotify_mark *entry = &chunk->mark;struct list_head *list;if (!entry->i.inode)
@@ -221,7 +221,7 @@ static struct audit_chunk *find_chunk(struct node *p)static void untag_chunk (struct node *p) {struct audit_chunk *chunk =find_chunk (p); -struct fsnotify_mark_entry *entry = &chunk->mark; +struct fsnotify_mark *entry = &chunk->mark;struct audit_chunk *new;struct audit_tree *owner;int size = chunk->count -1 ;
@@ -315,7 +315,7 @@ out:static int create_chunk (struct inode *inode,struct audit_tree *tree) { -struct fsnotify_mark_entry *entry; +struct fsnotify_mark *entry;struct audit_chunk *chunk =alloc_chunk (1 );if (!chunk)return -ENOMEM ;
@@ -353,7 +353,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)/* the first tagged inode becomes root of tree */ static int tag_chunk (struct inode *inode,struct audit_tree *tree) { -struct fsnotify_mark_entry *old_entry, *chunk_entry; +struct fsnotify_mark *old_entry, *chunk_entry;struct audit_tree *owner;struct audit_chunk *chunk, *old;struct node *p;
@@ -950,7 +950,7 @@ static int audit_tree_handle_event(struct fsnotify_group *group, struct fsnotifyreturn -EOPNOTSUPP ; } -static void audit_tree_freeing_mark (struct fsnotify_mark_entry *entry,struct fsnotify_group *group) +static void audit_tree_freeing_mark (struct fsnotify_mark *entry,struct fsnotify_group *group) { struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);
kernel/audit_watch.c +4 -4
@@ -55,7 +55,7 @@ struct audit_watch {struct audit_parent {struct list_head watches;/* anchor for audit_watch->wlist */ -struct fsnotify_mark_entry mark;/* fsnotify mark on the inode */ +struct fsnotify_mark mark;/* fsnotify mark on the inode */ };/* fsnotify handle. */
@@ -71,7 +71,7 @@ static void audit_free_parent(struct audit_parent *parent)kfree (parent); } -static void audit_watch_free_mark (struct fsnotify_mark_entry *entry) +static void audit_watch_free_mark (struct fsnotify_mark *entry) {struct audit_parent *parent;
@@ -98,7 +98,7 @@ static void audit_put_parent(struct audit_parent *parent)static inline struct audit_parent *audit_find_parent (struct inode *inode) {struct audit_parent *parent =NULL ; -struct fsnotify_mark_entry *entry; +struct fsnotify_mark *entry;spin_lock (&inode->i_lock); entry =fsnotify_find_mark_entry (audit_watch_group, inode);
@@ -516,7 +516,7 @@ static bool audit_watch_should_send_event(struct fsnotify_group *group, struct i struct vfsmount *mnt, __u32 mask, void *data, int data_type) { - struct fsnotify_mark_entry *entry; + struct fsnotify_mark *entry;bool send;spin_lock (&inode->i_lock);
kernel/auditsc.c +2 -2
@@ -1725,7 +1725,7 @@ static inline void handle_one(const struct inode *inode)struct audit_tree_refs *p;struct audit_chunk *chunk;int count; -if (likely (hlist_empty (&inode->i_fsnotify_mark_entries))) +if (likely (hlist_empty (&inode->i_fsnotify_marks)))return ; context = current->audit_context; p = context->trees;
@@ -1768,7 +1768,7 @@ retry: seq =read_seqbegin (&rename_lock);for (;;) {struct inode *inode = d->d_inode; -if (inode &&unlikely (!hlist_empty (&inode->i_fsnotify_mark_entries))) { +if (inode &&unlikely (!hlist_empty (&inode->i_fsnotify_marks))) {struct audit_chunk *chunk; chunk =audit_tree_lookup (inode);if (chunk) {
Eric Paris
maintainerPATCH 3/6 fsnotify: rename fsnotify_find_mark_entry to fsnotify_find_mark
In reply to Eric Paristhe _entry portion of fsnotify functions is useless. Drop it.
---
fs/notify/dnotify/dnotify.c | 14 +++++++------- fs/notify/inode_mark.c | 14 +++++++------- fs/notify/inotify/inotify_fsnotify.c | 4 ++-- fs/notify/inotify/inotify_user.c | 6 +++--- include/linux/fsnotify_backend.h | 4 ++-- kernel/audit_tree.c | 12 ++++++------ kernel/audit_watch.c | 8 ++++---- 7 files changed, 31 insertions(+), 31 deletions(-)
fs/notify/dnotify/dnotify.c +7 -7
@@ -96,7 +96,7 @@ static int dnotify_handle_event(struct fsnotify_group *group, to_tell = event->to_tell;spin_lock (&to_tell->i_lock); - entry =fsnotify_find_mark_entry (group, to_tell); + entry =fsnotify_find_mark (group, to_tell);spin_unlock (&to_tell->i_lock);/* unlikely since we alreay passed dnotify_should_send_event() */
@@ -148,7 +148,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,return false;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark_entry (group, inode); + entry =fsnotify_find_mark (group, inode);spin_unlock (&inode->i_lock);/* no mark means no dnotify watch */
@@ -158,7 +158,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group, mask = (mask & ~FS_EVENT_ON_CHILD ); send = (mask & entry->mask); -fsnotify_put_mark (entry);/* matches fsnotify_find_mark_entry */ +fsnotify_put_mark (entry);/* matches fsnotify_find_mark */ return send; }
@@ -202,7 +202,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)return ;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark_entry (dnotify_group, inode); + entry =fsnotify_find_mark (dnotify_group, inode);spin_unlock (&inode->i_lock);if (!entry)return ;
@@ -226,7 +226,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)/* nothing else could have found us thanks to the dnotify_mark_mutex */ if (dnentry->dn ==NULL ) -fsnotify_destroy_mark_by_entry (entry); +fsnotify_destroy_mark (entry);fsnotify_recalc_group_mask (dnotify_group);
@@ -357,7 +357,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)/* add the new_entry or find an old one. */ spin_lock (&inode->i_lock); - entry =fsnotify_find_mark_entry (dnotify_group, inode); + entry =fsnotify_find_mark (dnotify_group, inode);spin_unlock (&inode->i_lock);if (entry) { dnentry = container_of(entry, struct dnotify_mark_entry, fsn_entry);
@@ -414,7 +414,7 @@ out:spin_unlock (&entry->lock);if (destroy) -fsnotify_destroy_mark_by_entry (entry); +fsnotify_destroy_mark (entry);fsnotify_recalc_group_mask (dnotify_group);
fs/notify/inode_mark.c +7 -7
@@ -56,7 +56,7 @@* - The inode is unlinked for the last time. (fsnotify_inode_remove) * - The inode is being evicted from cache. (fsnotify_inode_delete) * - The fs the inode is on is unmounted. (fsnotify_inode_delete/fsnotify_unmount_inodes) -* - Something explicitly requests that it be removed. (fsnotify_destroy_mark_by_entry) +* - Something explicitly requests that it be removed. (fsnotify_destroy_mark) * - The fsnotify_group associated with the mark is going away and all such marks * need to be cleaned up. (fsnotify_clear_marks_by_group) *
@@ -141,7 +141,7 @@ void fsnotify_recalc_inode_mask(struct inode *inode)* The caller had better be holding a reference to this mark so we don't actually * do the final put under the entry->lock */ -void fsnotify_destroy_mark_by_entry (struct fsnotify_mark *entry) +void fsnotify_destroy_mark (struct fsnotify_mark *entry) {struct fsnotify_group *group;struct inode *inode;
@@ -234,7 +234,7 @@ void fsnotify_clear_marks_by_group(struct fsnotify_group *group)spin_unlock (&group->mark_lock);list_for_each_entry_safe (entry, lentry, &free_list, free_g_list) { -fsnotify_destroy_mark_by_entry (entry); +fsnotify_destroy_mark (entry);fsnotify_put_mark (entry); } }
@@ -257,7 +257,7 @@ void fsnotify_clear_marks_by_inode(struct inode *inode)spin_unlock (&inode->i_lock);list_for_each_entry_safe (entry, lentry, &free_list, i.free_i_list) { -fsnotify_destroy_mark_by_entry (entry); +fsnotify_destroy_mark (entry);fsnotify_put_mark (entry); } }
@@ -266,8 +266,8 @@ void fsnotify_clear_marks_by_inode(struct inode *inode)* given a group and inode, find the mark associated with that combination. * if found take a reference to that mark and return it, else return NULL */ -struct fsnotify_mark *fsnotify_find_mark_entry (struct fsnotify_group *group, -struct inode *inode) +struct fsnotify_mark *fsnotify_find_mark (struct fsnotify_group *group, +struct inode *inode) {struct fsnotify_mark *entry;struct hlist_node *pos;
@@ -350,7 +350,7 @@ int fsnotify_add_mark(struct fsnotify_mark *entry,spin_lock (&inode->i_lock);if (!allow_dups) - lentry =fsnotify_find_mark_entry (group, inode); + lentry =fsnotify_find_mark (group, inode);if (!lentry) { entry->group = group; entry->i.inode = inode;
fs/notify/inotify/inotify_fsnotify.c +2 -2
@@ -97,7 +97,7 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_ev to_tell = event->to_tell;spin_lock (&to_tell->i_lock); - entry =fsnotify_find_mark_entry (group, to_tell); + entry =fsnotify_find_mark (group, to_tell);spin_unlock (&to_tell->i_lock);/* race with watch removal? We already passes should_send */ if (unlikely (!entry))
@@ -147,7 +147,7 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inodebool send;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark_entry (group, inode); + entry =fsnotify_find_mark (group, inode);spin_unlock (&inode->i_lock);if (!entry)return false;
fs/notify/inotify/inotify_user.c +3 -3
@@ -578,7 +578,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,return -EINVAL ;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark_entry (group, inode); + entry =fsnotify_find_mark (group, inode);spin_unlock (&inode->i_lock);if (!entry)return -ENOENT ;
@@ -618,7 +618,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,/* return the wd */ ret = ientry->wd; -/* match the get from fsnotify_find_mark_entry() */ +/* match the get from fsnotify_find_mark() */ fsnotify_put_mark (entry);return ret;
@@ -861,7 +861,7 @@ SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd) ret =0 ; -fsnotify_destroy_mark_by_entry (&ientry->fsn_entry); +fsnotify_destroy_mark (&ientry->fsn_entry);/* match ref taken by inotify_idr_find */ fsnotify_put_mark (&ientry->fsn_entry);
include/linux/fsnotify_backend.h +2 -2
@@ -363,13 +363,13 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_groupextern void fsnotify_recalc_inode_mask (struct inode *inode);extern void fsnotify_init_mark (struct fsnotify_mark *entry,void (*free_mark)(struct fsnotify_mark *entry));/* find (and take a reference) to a mark associated with group and inode */ -extern struct fsnotify_mark *fsnotify_find_mark_entry (struct fsnotify_group *group,struct inode *inode); +extern struct fsnotify_mark *fsnotify_find_mark (struct fsnotify_group *group,struct inode *inode);/* copy the values from old into new */ extern void fsnotify_duplicate_mark (struct fsnotify_mark *new,struct fsnotify_mark *old);/* attach the mark to both the group and the inode */ extern int fsnotify_add_mark (struct fsnotify_mark *entry,struct fsnotify_group *group,struct inode *inode,int allow_dups);/* given a mark, flag it to be freed when all references are dropped */ -extern void fsnotify_destroy_mark_by_entry (struct fsnotify_mark *entry); +extern void fsnotify_destroy_mark (struct fsnotify_mark *entry);/* run all the marks in a group, and flag them to be freed */ extern void fsnotify_clear_marks_by_group (struct fsnotify_group *group);extern void fsnotify_get_mark (struct fsnotify_mark *entry);
kernel/audit_tree.c +6 -6
@@ -249,7 +249,7 @@ static void untag_chunk(struct node *p)list_del_rcu (&chunk->hash);spin_unlock (&hash_lock);spin_unlock (&entry->lock); -fsnotify_destroy_mark_by_entry (entry); +fsnotify_destroy_mark (entry);fsnotify_put_mark (entry); goto out; }
@@ -292,7 +292,7 @@ static void untag_chunk(struct node *p) owner->root = new;spin_unlock (&hash_lock);spin_unlock (&entry->lock); -fsnotify_destroy_mark_by_entry (entry); +fsnotify_destroy_mark (entry);fsnotify_put_mark (entry); goto out;
@@ -332,7 +332,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)spin_unlock (&hash_lock); chunk->dead =1 ;spin_unlock (&entry->lock); -fsnotify_destroy_mark_by_entry (entry); +fsnotify_destroy_mark (entry);fsnotify_put_mark (entry);return 0 ; }
@@ -360,7 +360,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)int n;spin_lock (&inode->i_lock); - old_entry =fsnotify_find_mark_entry (audit_tree_group, inode); + old_entry =fsnotify_find_mark (audit_tree_group, inode);spin_unlock (&inode->i_lock);if (!old_entry)return create_chunk (inode, tree);
@@ -411,7 +411,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)spin_unlock (&chunk_entry->lock);spin_unlock (&old_entry->lock); -fsnotify_destroy_mark_by_entry (chunk_entry); +fsnotify_destroy_mark (chunk_entry);fsnotify_put_mark (chunk_entry);fsnotify_put_mark (old_entry);
@@ -442,7 +442,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)spin_unlock (&hash_lock);spin_unlock (&chunk_entry->lock);spin_unlock (&old_entry->lock); -fsnotify_destroy_mark_by_entry (old_entry); +fsnotify_destroy_mark (old_entry);fsnotify_put_mark (old_entry);return 0 ; }
kernel/audit_watch.c +4 -4
@@ -101,7 +101,7 @@ static inline struct audit_parent *audit_find_parent(struct inode *inode)struct fsnotify_mark *entry;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark_entry (audit_watch_group, inode); + entry =fsnotify_find_mark (audit_watch_group, inode);spin_unlock (&inode->i_lock);if (entry)
@@ -353,7 +353,7 @@ static void audit_remove_parent_watches(struct audit_parent *parent) }mutex_unlock (&audit_filter_mutex); -fsnotify_destroy_mark_by_entry (&parent->mark); +fsnotify_destroy_mark (&parent->mark);fsnotify_recalc_group_mask (audit_watch_group);
@@ -503,7 +503,7 @@ void audit_remove_watch_rule(struct audit_krule *krule)if (list_empty (&parent->watches)) {audit_get_parent (parent); -fsnotify_destroy_mark_by_entry (&parent->mark); +fsnotify_destroy_mark (&parent->mark);audit_put_parent (parent); } }
@@ -520,7 +520,7 @@ static bool audit_watch_should_send_event(struct fsnotify_group *group, struct ibool send;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark_entry (group, inode); + entry =fsnotify_find_mark (group, inode);spin_unlock (&inode->i_lock);if (!entry)return false;
Eric Paris
maintainerPATCH 4/6 fsnotify: rename mark_entry to just mark
In reply to Eric Parispreviously I used mark_entry when talking about marks on inodes. The _entry is pretty useless. Just use "mark" instead.
---
fs/notify/group.c | 6 +- fs/notify/inode_mark.c | 148 +++++++++++++++++++------------------- include/linux/fsnotify_backend.h | 26 +++---- 3 files changed, 90 insertions(+), 90 deletions(-)
fs/notify/group.c +3 -3
@@ -74,11 +74,11 @@ void fsnotify_recalc_group_mask(struct fsnotify_group *group) {__u32 mask =0 ;__u32 old_mask = group->mask; -struct fsnotify_mark *entry; +struct fsnotify_mark *mark;spin_lock (&group->mark_lock); -list_for_each_entry (entry, &group->marks_list, g_list) - mask |= entry->mask; +list_for_each_entry (mark, &group->marks_list, g_list) + mask |= mark->mask;spin_unlock (&group->mark_lock); group->mask = mask;
fs/notify/inode_mark.c +74 -74
312 lines not on this page · raw message
include/linux/fsnotify_backend.h +13 -13
@@ -83,7 +83,7 @@ struct fsnotify_ops { int data_type);int (*handle_event)(struct fsnotify_group *group,struct fsnotify_event *event);void (*free_group_priv)(struct fsnotify_group *group); -void (*freeing_mark)(struct fsnotify_mark *entry,struct fsnotify_group *group); +void (*freeing_mark)(struct fsnotify_mark *mark,struct fsnotify_group *group);void (*free_event_priv)(struct fsnotify_event_private_data *priv); };
@@ -135,7 +135,7 @@ struct fsnotify_group {/* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ spinlock_t mark_lock;/* protect marks_list */ -atomic_t num_marks;/* 1 for each mark entry and 1 for not being +atomic_t num_marks;/* 1 for each mark and 1 for not being * past the point of no return when freeing * a group */ struct list_head marks_list;/* all inode marks for this group */
@@ -229,7 +229,7 @@ struct fsnotify_event {* Inode specific fields in an fsnotify_mark */ struct fsnotify_inode_mark { -struct inode *inode;/* inode this entry is associated with */ +struct inode *inode;/* inode this mark is associated with */ struct hlist_node i_list;/* list of marks by inode->i_fsnotify_marks */ struct list_head free_i_list;/* tmp list used when freeing this mark */ };
@@ -238,13 +238,13 @@ struct fsnotify_inode_mark {* Mount point specific fields in an fsnotify_mark */ struct fsnotify_vfsmount_mark { -struct vfsmount *mnt;/* inode this entry is associated with */ +struct vfsmount *mnt;/* vfsmount this mark is associated with */ struct hlist_node m_list;/* list of marks by inode->i_fsnotify_marks */ struct list_head free_m_list;/* tmp list used when freeing this mark */ };/* -* a mark is simply an entry attached to an in core inode which allows an +* a mark is simply an object attached to an in core inode which allows an * fsnotify listener to indicate they are either no longer interested in events * of a type matching mask or only interested in those events. *
@@ -254,11 +254,11 @@ struct fsnotify_vfsmount_mark {* inode eviction or modification. */ struct fsnotify_mark { -__u32 mask;/* mask this mark entry is for */ +__u32 mask;/* mask this mark is for */ /* we hold ref for each i_list and g_list. also one ref for each 'thing' * in kernel that found and may be using this mark. */ atomic_t refcnt;/* active things looking at this mark */ -struct fsnotify_group *group;/* group this mark entry is for */ +struct fsnotify_group *group;/* group this mark is for */ struct list_head g_list;/* list of marks by group->i_fsnotify_marks */ spinlock_t lock;/* protect group and inode */ union {
@@ -269,7 +269,7 @@ struct fsnotify_mark {#define FSNOTIFY_MARK_FLAG_INODE 0x01#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02unsigned int flags;/* vfsmount or inode mark? */ -void (*free_mark)(struct fsnotify_mark *entry);/* called on final put+free */ +void (*free_mark)(struct fsnotify_mark *mark);/* called on final put+free */ };#ifdef CONFIG_FSNOTIFY
@@ -361,19 +361,19 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group/* run all marks associated with an inode and update inode->i_fsnotify_mask */ extern void fsnotify_recalc_inode_mask (struct inode *inode); -extern void fsnotify_init_mark (struct fsnotify_mark *entry,void (*free_mark)(struct fsnotify_mark *entry)); +extern void fsnotify_init_mark (struct fsnotify_mark *mark,void (*free_mark)(struct fsnotify_mark *mark));/* find (and take a reference) to a mark associated with group and inode */ extern struct fsnotify_mark *fsnotify_find_mark (struct fsnotify_group *group,struct inode *inode);/* copy the values from old into new */ extern void fsnotify_duplicate_mark (struct fsnotify_mark *new,struct fsnotify_mark *old);/* attach the mark to both the group and the inode */ -extern int fsnotify_add_mark (struct fsnotify_mark *entry,struct fsnotify_group *group,struct inode *inode,int allow_dups); +extern int fsnotify_add_mark (struct fsnotify_mark *mark,struct fsnotify_group *group,struct inode *inode,int allow_dups);/* given a mark, flag it to be freed when all references are dropped */ -extern void fsnotify_destroy_mark (struct fsnotify_mark *entry); +extern void fsnotify_destroy_mark (struct fsnotify_mark *mark);/* run all the marks in a group, and flag them to be freed */ extern void fsnotify_clear_marks_by_group (struct fsnotify_group *group); -extern void fsnotify_get_mark (struct fsnotify_mark *entry); -extern void fsnotify_put_mark (struct fsnotify_mark *entry); +extern void fsnotify_get_mark (struct fsnotify_mark *mark); +extern void fsnotify_put_mark (struct fsnotify_mark *mark);extern void fsnotify_unmount_inodes (struct list_head *list);/* put here because inotify does some weird stuff when destroying watches */
Eric Paris
maintainerPATCH 5/6 inotify: rename mark_entry to just mark
In reply to Eric Parisrename anything in inotify that deals with mark_entry to just be mark. It makes a lot more sense.
---
fs/notify/inotify/inotify.h | 7 + fs/notify/inotify/inotify_fsnotify.c | 48 ++++----- fs/notify/inotify/inotify_user.c | 192 +++++++++++++++++----------------- 3 files changed, 123 insertions(+), 124 deletions(-)
fs/notify/inotify/inotify.h +3 -4
@@ -9,13 +9,12 @@ struct inotify_event_private_data {int wd; }; -struct inotify_inode_mark_entry { -/* fsnotify_mark MUST be the first thing */ -struct fsnotify_mark fsn_entry; +struct inotify_inode_mark { +struct fsnotify_mark fsn_mark;int wd; }; -extern void inotify_ignored_and_remove_idr (struct fsnotify_mark *entry, +extern void inotify_ignored_and_remove_idr (struct fsnotify_mark *fsn_mark,struct fsnotify_group *group);extern void inotify_free_event_priv (struct fsnotify_event_private_data *event_priv);
fs/notify/inotify/inotify_fsnotify.c +24 -24
110 lines not on this page · raw message
fs/notify/inotify/inotify_user.c +96 -96
419 lines not on this page · raw message
Eric Paris
maintainerPATCH 6/6 dnotify: rename mark_entry to mark
In reply to Eric Parisnomenclature change. Used to call things 'entries' but now we just call them 'marks.' Do those changes for dnotify.
---
fs/notify/dnotify/dnotify.c | 170 ++++++++++++++++++++++--------------------- 1 files changed, 85 insertions(+), 85 deletions(-)
fs/notify/dnotify/dnotify.c +85 -85
@@ -29,7 +29,7 @@int dir_notify_enable__read_mostly =1 ;static struct kmem_cache *dnotify_struct_cache__read_mostly ; -static struct kmem_cache *dnotify_mark_entry_cache__read_mostly ; +static struct kmem_cache *dnotify_mark_cache__read_mostly ;static struct fsnotify_group *dnotify_group__read_mostly ;static DEFINE_MUTEX (dnotify_mark_mutex);
@@ -38,8 +38,8 @@ static DEFINE_MUTEX(dnotify_mark_mutex);* is being watched by dnotify. If multiple userspace applications are watching * the same directory with dnotify their information is chained in dn */ -struct dnotify_mark_entry { -struct fsnotify_mark fsn_entry; +struct dnotify_mark { +struct fsnotify_mark fsn_mark;struct dnotify_struct *dn; };
@@ -51,27 +51,27 @@ struct dnotify_mark_entry {* it calls the fsnotify function so it can update the set of all events relevant * to this inode. */ -static void dnotify_recalc_inode_mask (struct fsnotify_mark *entry) +static void dnotify_recalc_inode_mask (struct fsnotify_mark *fsn_mark) {__u32 new_mask, old_mask;struct dnotify_struct *dn; -struct dnotify_mark_entry *dnentry =container_of (entry, - struct dnotify_mark_entry, - fsn_entry); +struct dnotify_mark *dn_mark =container_of (fsn_mark, + struct dnotify_mark, + fsn_mark); -assert_spin_locked (&entry->lock); +assert_spin_locked (&fsn_mark->lock); - old_mask = entry->mask; + old_mask = fsn_mark->mask; new_mask =0 ; -for (dn = dnentry->dn; dn !=NULL ; dn = dn->dn_next) +for (dn = dn_mark->dn; dn !=NULL ; dn = dn->dn_next) new_mask |= (dn->dn_mask & ~FS_DN_MULTISHOT ); - entry->mask = new_mask; + fsn_mark->mask = new_mask;if (old_mask == new_mask)return ; -if (entry->i.inode) -fsnotify_recalc_inode_mask (entry->i.inode); +if (fsn_mark->i.inode) +fsnotify_recalc_inode_mask (fsn_mark->i.inode); }/*
@@ -85,8 +85,8 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *entry)static int dnotify_handle_event (struct fsnotify_group *group,struct fsnotify_event *event) { -struct fsnotify_mark *entry =NULL ; -struct dnotify_mark_entry *dnentry; +struct fsnotify_mark *fsn_mark =NULL ; +struct dnotify_mark *dn_mark;struct inode *to_tell;struct dnotify_struct *dn;struct dnotify_struct **prev;
@@ -96,16 +96,16 @@ static int dnotify_handle_event(struct fsnotify_group *group, to_tell = event->to_tell;spin_lock (&to_tell->i_lock); - entry =fsnotify_find_mark (group, to_tell); + fsn_mark =fsnotify_find_mark (group, to_tell);spin_unlock (&to_tell->i_lock);/* unlikely since we alreay passed dnotify_should_send_event() */ -if (unlikely (!entry)) +if (unlikely (!fsn_mark))return 0 ; - dnentry = container_of(entry, struct dnotify_mark_entry, fsn_entry); + dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); -spin_lock (&entry->lock); - prev = &dnentry->dn; +spin_lock (&fsn_mark->lock); + prev = &dn_mark->dn;while ((dn = *prev) !=NULL ) {if ((dn->dn_mask & test_mask) ==0 ) { prev = &dn->dn_next;
@@ -118,12 +118,12 @@ static int dnotify_handle_event(struct fsnotify_group *group,else { *prev = dn->dn_next;kmem_cache_free (dnotify_struct_cache, dn); -dnotify_recalc_inode_mask (entry); +dnotify_recalc_inode_mask (fsn_mark); } } -spin_unlock (&entry->lock); -fsnotify_put_mark (entry); +spin_unlock (&fsn_mark->lock); +fsnotify_put_mark (fsn_mark);return 0 ; }
@@ -136,7 +136,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group, struct inode *inode, struct vfsmount *mnt, __u32 mask, void *data, int data_type) { - struct fsnotify_mark *entry; + struct fsnotify_mark *fsn_mark;bool send;/* !dir_notify_enable should never get here, don't waste time checking
@@ -148,30 +148,30 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,return false;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark (group, inode); + fsn_mark =fsnotify_find_mark (group, inode);spin_unlock (&inode->i_lock);/* no mark means no dnotify watch */ -if (!entry) +if (!fsn_mark)return false; mask = (mask & ~FS_EVENT_ON_CHILD ); - send = (mask & entry->mask); + send = (mask & fsn_mark->mask); -fsnotify_put_mark (entry);/* matches fsnotify_find_mark */ +fsnotify_put_mark (fsn_mark);/* matches fsnotify_find_mark */ return send; } -static void dnotify_free_mark (struct fsnotify_mark *entry) +static void dnotify_free_mark (struct fsnotify_mark *fsn_mark) { -struct dnotify_mark_entry *dnentry =container_of (entry, - struct dnotify_mark_entry, - fsn_entry); +struct dnotify_mark *dn_mark =container_of (fsn_mark, + struct dnotify_mark, + fsn_mark); -BUG_ON (dnentry->dn); +BUG_ON (dn_mark->dn); -kmem_cache_free (dnotify_mark_entry_cache, dnentry); +kmem_cache_free (dnotify_mark_cache, dn_mark); }static struct fsnotify_ops dnotify_fsnotify_ops = {
@@ -191,8 +191,8 @@ static struct fsnotify_ops dnotify_fsnotify_ops = {*/ void dnotify_flush (struct file *filp,fl_owner_t id) { -struct fsnotify_mark *entry; -struct dnotify_mark_entry *dnentry; +struct fsnotify_mark *fsn_mark; +struct dnotify_mark *dn_mark;struct dnotify_struct *dn;struct dnotify_struct **prev;struct inode *inode;
@@ -202,37 +202,37 @@ void dnotify_flush(struct file *filp, fl_owner_t id)return ;spin_lock (&inode->i_lock); - entry =fsnotify_find_mark (dnotify_group, inode); + fsn_mark =fsnotify_find_mark (dnotify_group, inode);spin_unlock (&inode->i_lock); -if (!entry) +if (!fsn_mark)return ; - dnentry = container_of(entry, struct dnotify_mark_entry, fsn_entry); + dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);mutex_lock (&dnotify_mark_mutex); -spin_lock (&entry->lock); - prev = &dnentry->dn; +spin_lock (&fsn_mark->lock); + prev = &dn_mark->dn;while ((dn = *prev) !=NULL ) {if ((dn->dn_owner == id) && (dn->dn_filp == filp)) { *prev = dn->dn_next;kmem_cache_free (dnotify_struct_cache, dn); -dnotify_recalc_inode_mask (entry); +dnotify_recalc_inode_mask (fsn_mark);break ; } prev = &dn->dn_next; } -spin_unlock (&entry->lock); +spin_unlock (&fsn_mark->lock);/* nothing else could have found us thanks to the dnotify_mark_mutex */ -if (dnentry->dn ==NULL ) -fsnotify_destroy_mark (entry); +if (dn_mark->dn ==NULL ) +fsnotify_destroy_mark (fsn_mark);fsnotify_recalc_group_mask (dnotify_group);mutex_unlock (&dnotify_mark_mutex); -fsnotify_put_mark (entry); +fsnotify_put_mark (fsn_mark); }/* this conversion is done only at watch creation */
@@ -264,12 +264,12 @@ static __u32 convert_arg(unsigned long arg)* onto that mark. This function either attaches the new dnotify_struct onto * that list, or it |= the mask onto an existing dnofiy_struct. */ -static int attach_dn (struct dnotify_struct *dn,struct dnotify_mark_entry *dnentry, +static int attach_dn (struct dnotify_struct *dn,struct dnotify_mark *dn_mark,fl_owner_t id,int fd,struct file *filp,__u32 mask) {struct dnotify_struct *odn; - odn = dnentry->dn; + odn = dn_mark->dn;while (odn !=NULL ) {/* adding more events to existing dnofiy_struct? */ if ((odn->dn_owner == id) && (odn->dn_filp == filp)) {
@@ -284,8 +284,8 @@ static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnent dn->dn_fd = fd; dn->dn_filp = filp; dn->dn_owner = id; - dn->dn_next = dnentry->dn; - dnentry->dn = dn; + dn->dn_next = dn_mark->dn; + dn_mark->dn = dn;return 0 ; }
@@ -297,8 +297,8 @@ static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnent*/ int fcntl_dirnotify (int fd,struct file *filp,unsigned long arg) { -struct dnotify_mark_entry *new_dnentry, *dnentry; -struct fsnotify_mark *new_entry, *entry; +struct dnotify_mark *new_dn_mark, *dn_mark; +struct fsnotify_mark *new_fsn_mark, *fsn_mark;struct dnotify_struct *dn;struct inode *inode;fl_owner_t id = current->files;
@@ -307,7 +307,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)__u32 mask;/* we use these to tell if we need to kfree */ - new_entry =NULL ; + new_fsn_mark =NULL ; dn =NULL ;if (!dir_notify_enable) {
@@ -337,8 +337,8 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) }/* new fsnotify mark, we expect most fcntl calls to add a new mark */ - new_dnentry =kmem_cache_alloc (dnotify_mark_entry_cache,GFP_KERNEL ); -if (!new_dnentry) { + new_dn_mark =kmem_cache_alloc (dnotify_mark_cache,GFP_KERNEL ); +if (!new_dn_mark) { error = -ENOMEM ; goto out_err; }
@@ -346,29 +346,29 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)/* convert the userspace DN_* "arg" to the internal FS_* defines in fsnotify */ mask =convert_arg (arg); -/* set up the new_entry and new_dnentry */ - new_entry = &new_dnentry->fsn_entry; -fsnotify_init_mark (new_entry, dnotify_free_mark); - new_entry->mask = mask; - new_dnentry->dn =NULL ; +/* set up the new_fsn_mark and new_dn_mark */ + new_fsn_mark = &new_dn_mark->fsn_mark; +fsnotify_init_mark (new_fsn_mark, dnotify_free_mark); + new_fsn_mark->mask = mask; + new_dn_mark->dn =NULL ;/* this is needed to prevent the fcntl/close race described below */ mutex_lock (&dnotify_mark_mutex); -/* add the new_entry or find an old one. */ +/* add the new_fsn_mark or find an old one. */ spin_lock (&inode->i_lock); - entry =fsnotify_find_mark (dnotify_group, inode); + fsn_mark =fsnotify_find_mark (dnotify_group, inode);spin_unlock (&inode->i_lock); -if (entry) { - dnentry = container_of(entry, struct dnotify_mark_entry, fsn_entry); -spin_lock (&entry->lock); +if (fsn_mark) { + dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); +spin_lock (&fsn_mark->lock); }else { -fsnotify_add_mark (new_entry, dnotify_group, inode,0 ); -spin_lock (&new_entry->lock); - entry = new_entry; - dnentry = new_dnentry; -/* we used new_entry, so don't free it */ - new_entry =NULL ; +fsnotify_add_mark (new_fsn_mark, dnotify_group, inode,0 ); +spin_lock (&new_fsn_mark->lock); + fsn_mark = new_fsn_mark; + dn_mark = new_dn_mark; +/* we used new_fsn_mark, so don't free it */ + new_fsn_mark =NULL ; }rcu_read_lock ();
@@ -377,17 +377,17 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)/* if (f != filp) means that we lost a race and another task/thread * actually closed the fd we are still playing with before we grabbed -* the dnotify_mark_mutex and entry->lock. Since closing the fd is the +* the dnotify_mark_mutex and fsn_mark->lock. Since closing the fd is the * only time we clean up the marks we need to get our mark off * the list. */ if (f != filp) {/* if we added ourselves, shoot ourselves, it's possible that -* the flush actually did shoot this entry. That's fine too +* the flush actually did shoot this fsn_mark. That's fine too * since multiple calls to destroy_mark is perfectly safe, if -* we found a dnentry already attached to the inode, just sod +* we found a dn_mark already attached to the inode, just sod * off silently as the flush at close time dealt with it. */ -if (dnentry == new_dnentry) +if (dn_mark == new_dn_mark) destroy =1 ; goto out; }
@@ -395,13 +395,13 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) error =__f_setown (filp,task_pid (current),PIDTYPE_PID ,0 );if (error) {/* if we added, we must shoot */ -if (dnentry == new_dnentry) +if (dn_mark == new_dn_mark) destroy =1 ; goto out; } - error =attach_dn (dn, dnentry, id, fd, filp, mask); -/* !error means that we attached the dn to the dnentry, so don't free it */ + error =attach_dn (dn, dn_mark, id, fd, filp, mask); +/* !error means that we attached the dn to the dn_mark, so don't free it */ if (!error) dn =NULL ;/* -EEXIST means that we didn't add this new dn and used an old one.
@@ -409,20 +409,20 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)else if (error == -EEXIST ) error =0 ; -dnotify_recalc_inode_mask (entry); +dnotify_recalc_inode_mask (fsn_mark); out: -spin_unlock (&entry->lock); +spin_unlock (&fsn_mark->lock);if (destroy) -fsnotify_destroy_mark (entry); +fsnotify_destroy_mark (fsn_mark);fsnotify_recalc_group_mask (dnotify_group);mutex_unlock (&dnotify_mark_mutex); -fsnotify_put_mark (entry); +fsnotify_put_mark (fsn_mark); out_err: -if (new_entry) -fsnotify_put_mark (new_entry); +if (new_fsn_mark) +fsnotify_put_mark (new_fsn_mark);if (dn)kmem_cache_free (dnotify_struct_cache, dn);return error;
@@ -431,7 +431,7 @@ out_err:static int __init dnotify_init (void ) { dnotify_struct_cache =KMEM_CACHE (dnotify_struct,SLAB_PANIC ); - dnotify_mark_entry_cache =KMEM_CACHE (dnotify_mark_entry,SLAB_PANIC ); + dnotify_mark_cache =KMEM_CACHE (dnotify_mark,SLAB_PANIC ); dnotify_group =fsnotify_alloc_group (&dnotify_fsnotify_ops);if (IS_ERR (dnotify_group))