Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fsnotify: rename mark_entry to just mark

previously I used mark_entry when talking about marks on inodes. The
_entry is pretty useless. Just use "mark" instead.

Signed-off-by: Eric Paris <eparis@redhat.com>

+90 -90
+3 -3
fs/notify/group.c
··· 74 74 { 75 75 __u32 mask = 0; 76 76 __u32 old_mask = group->mask; 77 - struct fsnotify_mark *entry; 77 + struct fsnotify_mark *mark; 78 78 79 79 spin_lock(&group->mark_lock); 80 - list_for_each_entry(entry, &group->marks_list, g_list) 81 - mask |= entry->mask; 80 + list_for_each_entry(mark, &group->marks_list, g_list) 81 + mask |= mark->mask; 82 82 spin_unlock(&group->mark_lock); 83 83 84 84 group->mask = mask;
+74 -74
fs/notify/inode_mark.c
··· 30 30 * There are 3 spinlocks involved with fsnotify inode marks and they MUST 31 31 * be taken in order as follows: 32 32 * 33 - * entry->lock 33 + * mark->lock 34 34 * group->mark_lock 35 35 * inode->i_lock 36 36 * 37 - * entry->lock protects 2 things, entry->group and entry->inode. You must hold 37 + * mark->lock protects 2 things, mark->group and mark->inode. You must hold 38 38 * that lock to dereference either of these things (they could be NULL even with 39 39 * the lock) 40 40 * 41 41 * group->mark_lock protects the marks_list anchored inside a given group 42 - * and each entry is hooked via the g_list. It also sorta protects the 42 + * and each mark is hooked via the g_list. It also sorta protects the 43 43 * free_g_list, which when used is anchored by a private list on the stack of the 44 44 * task which held the group->mark_lock. 45 45 * 46 46 * inode->i_lock protects the i_fsnotify_marks list anchored inside a 47 - * given inode and each entry is hooked via the i_list. (and sorta the 47 + * given inode and each mark is hooked via the i_list. (and sorta the 48 48 * free_i_list) 49 49 * 50 50 * ··· 95 95 #include <linux/fsnotify_backend.h> 96 96 #include "fsnotify.h" 97 97 98 - void fsnotify_get_mark(struct fsnotify_mark *entry) 98 + void fsnotify_get_mark(struct fsnotify_mark *mark) 99 99 { 100 - atomic_inc(&entry->refcnt); 100 + atomic_inc(&mark->refcnt); 101 101 } 102 102 103 - void fsnotify_put_mark(struct fsnotify_mark *entry) 103 + void fsnotify_put_mark(struct fsnotify_mark *mark) 104 104 { 105 - if (atomic_dec_and_test(&entry->refcnt)) 106 - entry->free_mark(entry); 105 + if (atomic_dec_and_test(&mark->refcnt)) 106 + mark->free_mark(mark); 107 107 } 108 108 109 109 /* ··· 111 111 */ 112 112 static void fsnotify_recalc_inode_mask_locked(struct inode *inode) 113 113 { 114 - struct fsnotify_mark *entry; 114 + struct fsnotify_mark *mark; 115 115 struct hlist_node *pos; 116 116 __u32 new_mask = 0; 117 117 118 118 assert_spin_locked(&inode->i_lock); 119 119 120 - hlist_for_each_entry(entry, pos, &inode->i_fsnotify_marks, i.i_list) 121 - new_mask |= entry->mask; 120 + hlist_for_each_entry(mark, pos, &inode->i_fsnotify_marks, i.i_list) 121 + new_mask |= mark->mask; 122 122 inode->i_fsnotify_mask = new_mask; 123 123 } 124 124 ··· 138 138 /* 139 139 * Any time a mark is getting freed we end up here. 140 140 * The caller had better be holding a reference to this mark so we don't actually 141 - * do the final put under the entry->lock 141 + * do the final put under the mark->lock 142 142 */ 143 - void fsnotify_destroy_mark(struct fsnotify_mark *entry) 143 + void fsnotify_destroy_mark(struct fsnotify_mark *mark) 144 144 { 145 145 struct fsnotify_group *group; 146 146 struct inode *inode; 147 147 148 - spin_lock(&entry->lock); 148 + spin_lock(&mark->lock); 149 149 150 - group = entry->group; 151 - inode = entry->i.inode; 150 + group = mark->group; 151 + inode = mark->i.inode; 152 152 153 153 BUG_ON(group && !inode); 154 154 BUG_ON(!group && inode); 155 155 156 156 /* if !group something else already marked this to die */ 157 157 if (!group) { 158 - spin_unlock(&entry->lock); 158 + spin_unlock(&mark->lock); 159 159 return; 160 160 } 161 161 162 162 /* 1 from caller and 1 for being on i_list/g_list */ 163 - BUG_ON(atomic_read(&entry->refcnt) < 2); 163 + BUG_ON(atomic_read(&mark->refcnt) < 2); 164 164 165 165 spin_lock(&group->mark_lock); 166 166 spin_lock(&inode->i_lock); 167 167 168 - hlist_del_init(&entry->i.i_list); 169 - entry->i.inode = NULL; 168 + hlist_del_init(&mark->i.i_list); 169 + mark->i.inode = NULL; 170 170 171 - list_del_init(&entry->g_list); 172 - entry->group = NULL; 171 + list_del_init(&mark->g_list); 172 + mark->group = NULL; 173 173 174 - fsnotify_put_mark(entry); /* for i_list and g_list */ 174 + fsnotify_put_mark(mark); /* for i_list and g_list */ 175 175 176 176 /* 177 177 * this mark is now off the inode->i_fsnotify_marks list and we ··· 182 182 183 183 spin_unlock(&inode->i_lock); 184 184 spin_unlock(&group->mark_lock); 185 - spin_unlock(&entry->lock); 185 + spin_unlock(&mark->lock); 186 186 187 187 /* 188 188 * Some groups like to know that marks are being freed. This is a 189 - * callback to the group function to let it know that this entry 189 + * callback to the group function to let it know that this mark 190 190 * is being freed. 191 191 */ 192 192 if (group->ops->freeing_mark) 193 - group->ops->freeing_mark(entry, group); 193 + group->ops->freeing_mark(mark, group); 194 194 195 195 /* 196 196 * __fsnotify_update_child_dentry_flags(inode); 197 197 * 198 198 * I really want to call that, but we can't, we have no idea if the inode 199 - * still exists the second we drop the entry->lock. 199 + * still exists the second we drop the mark->lock. 200 200 * 201 201 * The next time an event arrive to this inode from one of it's children 202 202 * __fsnotify_parent will see that the inode doesn't care about it's ··· 221 221 */ 222 222 void fsnotify_clear_marks_by_group(struct fsnotify_group *group) 223 223 { 224 - struct fsnotify_mark *lentry, *entry; 224 + struct fsnotify_mark *lmark, *mark; 225 225 LIST_HEAD(free_list); 226 226 227 227 spin_lock(&group->mark_lock); 228 - list_for_each_entry_safe(entry, lentry, &group->marks_list, g_list) { 229 - list_add(&entry->free_g_list, &free_list); 230 - list_del_init(&entry->g_list); 231 - fsnotify_get_mark(entry); 228 + list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { 229 + list_add(&mark->free_g_list, &free_list); 230 + list_del_init(&mark->g_list); 231 + fsnotify_get_mark(mark); 232 232 } 233 233 spin_unlock(&group->mark_lock); 234 234 235 - list_for_each_entry_safe(entry, lentry, &free_list, free_g_list) { 236 - fsnotify_destroy_mark(entry); 237 - fsnotify_put_mark(entry); 235 + list_for_each_entry_safe(mark, lmark, &free_list, free_g_list) { 236 + fsnotify_destroy_mark(mark); 237 + fsnotify_put_mark(mark); 238 238 } 239 239 } 240 240 ··· 243 243 */ 244 244 void fsnotify_clear_marks_by_inode(struct inode *inode) 245 245 { 246 - struct fsnotify_mark *entry, *lentry; 246 + struct fsnotify_mark *mark, *lmark; 247 247 struct hlist_node *pos, *n; 248 248 LIST_HEAD(free_list); 249 249 250 250 spin_lock(&inode->i_lock); 251 - hlist_for_each_entry_safe(entry, pos, n, &inode->i_fsnotify_marks, i.i_list) { 252 - list_add(&entry->i.free_i_list, &free_list); 253 - hlist_del_init(&entry->i.i_list); 254 - fsnotify_get_mark(entry); 251 + hlist_for_each_entry_safe(mark, pos, n, &inode->i_fsnotify_marks, i.i_list) { 252 + list_add(&mark->i.free_i_list, &free_list); 253 + hlist_del_init(&mark->i.i_list); 254 + fsnotify_get_mark(mark); 255 255 } 256 256 spin_unlock(&inode->i_lock); 257 257 258 - list_for_each_entry_safe(entry, lentry, &free_list, i.free_i_list) { 259 - fsnotify_destroy_mark(entry); 260 - fsnotify_put_mark(entry); 258 + list_for_each_entry_safe(mark, lmark, &free_list, i.free_i_list) { 259 + fsnotify_destroy_mark(mark); 260 + fsnotify_put_mark(mark); 261 261 } 262 262 } 263 263 ··· 268 268 struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group, 269 269 struct inode *inode) 270 270 { 271 - struct fsnotify_mark *entry; 271 + struct fsnotify_mark *mark; 272 272 struct hlist_node *pos; 273 273 274 274 assert_spin_locked(&inode->i_lock); 275 275 276 - hlist_for_each_entry(entry, pos, &inode->i_fsnotify_marks, i.i_list) { 277 - if (entry->group == group) { 278 - fsnotify_get_mark(entry); 279 - return entry; 276 + hlist_for_each_entry(mark, pos, &inode->i_fsnotify_marks, i.i_list) { 277 + if (mark->group == group) { 278 + fsnotify_get_mark(mark); 279 + return mark; 280 280 } 281 281 } 282 282 return NULL; ··· 294 294 /* 295 295 * Nothing fancy, just initialize lists and locks and counters. 296 296 */ 297 - void fsnotify_init_mark(struct fsnotify_mark *entry, 298 - void (*free_mark)(struct fsnotify_mark *entry)) 297 + void fsnotify_init_mark(struct fsnotify_mark *mark, 298 + void (*free_mark)(struct fsnotify_mark *mark)) 299 299 { 300 - spin_lock_init(&entry->lock); 301 - atomic_set(&entry->refcnt, 1); 302 - INIT_HLIST_NODE(&entry->i.i_list); 303 - entry->group = NULL; 304 - entry->mask = 0; 305 - entry->i.inode = NULL; 306 - entry->free_mark = free_mark; 300 + spin_lock_init(&mark->lock); 301 + atomic_set(&mark->refcnt, 1); 302 + INIT_HLIST_NODE(&mark->i.i_list); 303 + mark->group = NULL; 304 + mark->mask = 0; 305 + mark->i.inode = NULL; 306 + mark->free_mark = free_mark; 307 307 } 308 308 309 309 /* 310 - * Attach an initialized mark entry to a given group and inode. 310 + * Attach an initialized mark mark to a given group and inode. 311 311 * These marks may be used for the fsnotify backend to determine which 312 312 * event types should be delivered to which group and for which inodes. 313 313 */ 314 - int fsnotify_add_mark(struct fsnotify_mark *entry, 314 + int fsnotify_add_mark(struct fsnotify_mark *mark, 315 315 struct fsnotify_group *group, struct inode *inode, 316 316 int allow_dups) 317 317 { 318 - struct fsnotify_mark *lentry = NULL; 318 + struct fsnotify_mark *lmark = NULL; 319 319 int ret = 0; 320 320 321 321 inode = igrab(inode); 322 322 if (unlikely(!inode)) 323 323 return -EINVAL; 324 324 325 - entry->flags = FSNOTIFY_MARK_FLAG_INODE; 325 + mark->flags = FSNOTIFY_MARK_FLAG_INODE; 326 326 327 327 /* 328 328 * if this group isn't being testing for inode type events we need ··· 340 340 341 341 /* 342 342 * LOCKING ORDER!!!! 343 - * entry->lock 343 + * mark->lock 344 344 * group->mark_lock 345 345 * inode->i_lock 346 346 */ 347 - spin_lock(&entry->lock); 347 + spin_lock(&mark->lock); 348 348 spin_lock(&group->mark_lock); 349 349 spin_lock(&inode->i_lock); 350 350 351 351 if (!allow_dups) 352 - lentry = fsnotify_find_mark(group, inode); 353 - if (!lentry) { 354 - entry->group = group; 355 - entry->i.inode = inode; 352 + lmark = fsnotify_find_mark(group, inode); 353 + if (!lmark) { 354 + mark->group = group; 355 + mark->i.inode = inode; 356 356 357 - hlist_add_head(&entry->i.i_list, &inode->i_fsnotify_marks); 358 - list_add(&entry->g_list, &group->marks_list); 357 + hlist_add_head(&mark->i.i_list, &inode->i_fsnotify_marks); 358 + list_add(&mark->g_list, &group->marks_list); 359 359 360 - fsnotify_get_mark(entry); /* for i_list and g_list */ 360 + fsnotify_get_mark(mark); /* for i_list and g_list */ 361 361 362 362 atomic_inc(&group->num_marks); 363 363 ··· 366 366 367 367 spin_unlock(&inode->i_lock); 368 368 spin_unlock(&group->mark_lock); 369 - spin_unlock(&entry->lock); 369 + spin_unlock(&mark->lock); 370 370 371 - if (lentry) { 371 + if (lmark) { 372 372 ret = -EEXIST; 373 373 iput(inode); 374 - fsnotify_put_mark(lentry); 374 + fsnotify_put_mark(lmark); 375 375 } else { 376 376 __fsnotify_update_child_dentry_flags(inode); 377 377 }
+13 -13
include/linux/fsnotify_backend.h
··· 83 83 int data_type); 84 84 int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event); 85 85 void (*free_group_priv)(struct fsnotify_group *group); 86 - void (*freeing_mark)(struct fsnotify_mark *entry, struct fsnotify_group *group); 86 + void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); 87 87 void (*free_event_priv)(struct fsnotify_event_private_data *priv); 88 88 }; 89 89 ··· 135 135 136 136 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ 137 137 spinlock_t mark_lock; /* protect marks_list */ 138 - atomic_t num_marks; /* 1 for each mark entry and 1 for not being 138 + atomic_t num_marks; /* 1 for each mark and 1 for not being 139 139 * past the point of no return when freeing 140 140 * a group */ 141 141 struct list_head marks_list; /* all inode marks for this group */ ··· 229 229 * Inode specific fields in an fsnotify_mark 230 230 */ 231 231 struct fsnotify_inode_mark { 232 - struct inode *inode; /* inode this entry is associated with */ 232 + struct inode *inode; /* inode this mark is associated with */ 233 233 struct hlist_node i_list; /* list of marks by inode->i_fsnotify_marks */ 234 234 struct list_head free_i_list; /* tmp list used when freeing this mark */ 235 235 }; ··· 238 238 * Mount point specific fields in an fsnotify_mark 239 239 */ 240 240 struct fsnotify_vfsmount_mark { 241 - struct vfsmount *mnt; /* inode this entry is associated with */ 241 + struct vfsmount *mnt; /* vfsmount this mark is associated with */ 242 242 struct hlist_node m_list; /* list of marks by inode->i_fsnotify_marks */ 243 243 struct list_head free_m_list; /* tmp list used when freeing this mark */ 244 244 }; 245 245 246 246 /* 247 - * a mark is simply an entry attached to an in core inode which allows an 247 + * a mark is simply an object attached to an in core inode which allows an 248 248 * fsnotify listener to indicate they are either no longer interested in events 249 249 * of a type matching mask or only interested in those events. 250 250 * ··· 254 254 * inode eviction or modification. 255 255 */ 256 256 struct fsnotify_mark { 257 - __u32 mask; /* mask this mark entry is for */ 257 + __u32 mask; /* mask this mark is for */ 258 258 /* we hold ref for each i_list and g_list. also one ref for each 'thing' 259 259 * in kernel that found and may be using this mark. */ 260 260 atomic_t refcnt; /* active things looking at this mark */ 261 - struct fsnotify_group *group; /* group this mark entry is for */ 261 + struct fsnotify_group *group; /* group this mark is for */ 262 262 struct list_head g_list; /* list of marks by group->i_fsnotify_marks */ 263 263 spinlock_t lock; /* protect group and inode */ 264 264 union { ··· 269 269 #define FSNOTIFY_MARK_FLAG_INODE 0x01 270 270 #define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02 271 271 unsigned int flags; /* vfsmount or inode mark? */ 272 - void (*free_mark)(struct fsnotify_mark *entry); /* called on final put+free */ 272 + void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */ 273 273 }; 274 274 275 275 #ifdef CONFIG_FSNOTIFY ··· 361 361 362 362 /* run all marks associated with an inode and update inode->i_fsnotify_mask */ 363 363 extern void fsnotify_recalc_inode_mask(struct inode *inode); 364 - extern void fsnotify_init_mark(struct fsnotify_mark *entry, void (*free_mark)(struct fsnotify_mark *entry)); 364 + extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark)); 365 365 /* find (and take a reference) to a mark associated with group and inode */ 366 366 extern struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group, struct inode *inode); 367 367 /* copy the values from old into new */ 368 368 extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old); 369 369 /* attach the mark to both the group and the inode */ 370 - extern int fsnotify_add_mark(struct fsnotify_mark *entry, struct fsnotify_group *group, struct inode *inode, int allow_dups); 370 + extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, struct inode *inode, int allow_dups); 371 371 /* given a mark, flag it to be freed when all references are dropped */ 372 - extern void fsnotify_destroy_mark(struct fsnotify_mark *entry); 372 + extern void fsnotify_destroy_mark(struct fsnotify_mark *mark); 373 373 /* run all the marks in a group, and flag them to be freed */ 374 374 extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group); 375 - extern void fsnotify_get_mark(struct fsnotify_mark *entry); 376 - extern void fsnotify_put_mark(struct fsnotify_mark *entry); 375 + extern void fsnotify_get_mark(struct fsnotify_mark *mark); 376 + extern void fsnotify_put_mark(struct fsnotify_mark *mark); 377 377 extern void fsnotify_unmount_inodes(struct list_head *list); 378 378 379 379 /* put here because inotify does some weird stuff when destroying watches */