[PATCH 07/14] fsnotify: handle number of marks and group ref counting independently from each other

From: Lino Sanfilippo
Date: Wed Jan 19 2011 - 11:46:21 EST


With that patch ref counting of a group and its number of marks are handled
independently.
A group starts with a num_marks value of 0 instead of 1 and it does not depend
any longer on the number of marks wheather a group is finally destroyed.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@xxxxxx>
---
fs/notify/group.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/fs/notify/group.c b/fs/notify/group.c
index 0dcf497..a407bac 100644
--- a/fs/notify/group.c
+++ b/fs/notify/group.c
@@ -54,10 +54,7 @@ static void fsnotify_destroy_group(struct fsnotify_group *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 */
- if (atomic_dec_and_test(&group->num_marks))
- fsnotify_final_destroy_group(group);
+ fsnotify_final_destroy_group(group);
}

/*
@@ -82,11 +79,7 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)

/* set to 0 when there a no external references to this group */
atomic_set(&group->refcnt, 1);
- /*
- * hits 0 when there are no external references AND no marks for
- * this group
- */
- atomic_set(&group->num_marks, 1);
+ atomic_set(&group->num_marks, 0);

mutex_init(&group->mutex);
mutex_init(&group->notification_mutex);
--
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/