aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-12-17 20:12:05 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:17 -0400
commit9e1c74321d87a8b079f04d89e750b39a43365e1f (patch)
tree2513ce9eaa620b50c32be3dbe2763bcb692f99cb
parenta05fb6cc573130915380e00d182a4c6571cec6b2 (diff)
fsnotify: duplicate fsnotify_mark_entry data between 2 marks
Simple copy fsnotify information from one mark to another in preparation for the second mark to replace the first. Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--fs/notify/inode_mark.c10
-rw-r--r--include/linux/fsnotify_backend.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
index 0399bcbe09c8..a13cf9e9233a 100644
--- a/fs/notify/inode_mark.c
+++ b/fs/notify/inode_mark.c
@@ -282,12 +282,20 @@ struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *grou
282 return NULL; 282 return NULL;
283} 283}
284 284
285void fsnotify_duplicate_mark(struct fsnotify_mark_entry *new, struct fsnotify_mark_entry *old)
286{
287 assert_spin_locked(&old->lock);
288 new->inode = old->inode;
289 new->group = old->group;
290 new->mask = old->mask;
291 new->free_mark = old->free_mark;
292}
293
285/* 294/*
286 * Nothing fancy, just initialize lists and locks and counters. 295 * Nothing fancy, just initialize lists and locks and counters.
287 */ 296 */
288void fsnotify_init_mark(struct fsnotify_mark_entry *entry, 297void fsnotify_init_mark(struct fsnotify_mark_entry *entry,
289 void (*free_mark)(struct fsnotify_mark_entry *entry)) 298 void (*free_mark)(struct fsnotify_mark_entry *entry))
290
291{ 299{
292 spin_lock_init(&entry->lock); 300 spin_lock_init(&entry->lock);
293 atomic_set(&entry->refcnt, 1); 301 atomic_set(&entry->refcnt, 1);
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 8f8341e9f021..390516732956 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -342,6 +342,8 @@ extern void fsnotify_recalc_inode_mask(struct inode *inode);
342extern void fsnotify_init_mark(struct fsnotify_mark_entry *entry, void (*free_mark)(struct fsnotify_mark_entry *entry)); 342extern void fsnotify_init_mark(struct fsnotify_mark_entry *entry, void (*free_mark)(struct fsnotify_mark_entry *entry));
343/* find (and take a reference) to a mark associated with group and inode */ 343/* find (and take a reference) to a mark associated with group and inode */
344extern struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, struct inode *inode); 344extern struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, struct inode *inode);
345/* copy the values from old into new */
346extern void fsnotify_duplicate_mark(struct fsnotify_mark_entry *new, struct fsnotify_mark_entry *old);
345/* attach the mark to both the group and the inode */ 347/* attach the mark to both the group and the inode */
346extern int fsnotify_add_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group, struct inode *inode); 348extern int fsnotify_add_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group, struct inode *inode);
347/* given a mark, flag it to be freed when all references are dropped */ 349/* given a mark, flag it to be freed when all references are dropped */