[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1295455337-20219-10-git-send-email-LinoSanfilippo@gmx.de>
Date: Wed, 19 Jan 2011 17:42:12 +0100
From: Lino Sanfilippo <LinoSanfilippo@....de>
To: eparis@...hat.com
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Lino Sanfilippo <LinoSanfilippo@....de>
Subject: [PATCH 09/14] fsnotify: add new function fsnotify_remove_mark_locked()
Adds the fucntion fsnotify_remove_mark_locked() which is the counterpart to
fsnotify_add_mark_locked():
The mark is removed from the mark list of its group, unlinked from the
fs object it is linked to, and the number of group marks is decreased.
Signed-off-by: Lino Sanfilippo <LinoSanfilippo@....de>
---
fs/notify/mark.c | 24 ++++++++++++++++++++++++
include/linux/fsnotify_backend.h | 2 ++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 916a291..87d78b9 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -174,6 +174,30 @@ int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
}
/*
+ * Remove an attached mark from its group.
+ * If the mark is still linked to an fs object it will be unlinked, too.
+ * Requires groups mark_lock to be held.
+ */
+void fsnotify_remove_mark_locked(struct fsnotify_mark *mark)
+{
+ struct fsnotify_group *group = mark->group;
+
+ BUG_ON(!group);
+
+ list_del_init(&mark->g_list);
+ fsnotify_destroy_mark(mark);
+ /*
+ * Some groups like to know that marks are being freed.
+ * This is a callback to the group function to let it
+ * know that this mark is being freed.
+ */
+ if (group->ops->freeing_mark)
+ group->ops->freeing_mark(mark, group);
+ fsnotify_put_mark(mark);
+ atomic_dec(&group->num_marks);
+}
+
+/*
* clear any marks in a group in which mark->flags & flags is true
*/
void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group,
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index f6891f9..4c7f997 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -404,6 +404,8 @@ extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
struct fsnotify_group *group,
struct inode *inode, struct vfsmount *mnt,
int allow_dups);
+/* remove mark from its group */
+extern void fsnotify_remove_mark_locked(struct fsnotify_mark *mark);
/* given a mark, flag it to be freed when all references are dropped */
extern void fsnotify_destroy_mark(struct fsnotify_mark *mark);
/* run all the marks in a group, and clear all of the vfsmount marks */
--
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists