From patchwork Mon Apr 16 18:02:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 152955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 40A42B708F for ; Tue, 17 Apr 2012 04:02:59 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SJqGE-0000Xm-Sd; Mon, 16 Apr 2012 18:02:46 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SJqGC-0000XW-8O for kernel-team@lists.ubuntu.com; Mon, 16 Apr 2012 18:02:44 +0000 Received: from 79-78-218-124.dynamic.dsl.as9105.com ([79.78.218.124] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SJqGC-0000Jb-0J; Mon, 16 Apr 2012 18:02:44 +0000 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 02/10] fsnotify: introduce fsnotify_get_group() Date: Mon, 16 Apr 2012 19:02:32 +0100 Message-Id: <1334599360-15346-3-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1334599360-15346-1-git-send-email-apw@canonical.com> References: <1334599360-15346-1-git-send-email-apw@canonical.com> Cc: Andy Whitcroft X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Lino Sanfilippo Introduce fsnotify_get_group() which increments the reference counter of a group. Signed-off-by: Lino Sanfilippo Signed-off-by: Eric Paris (cherry-picked from commit 159fbe33a7c7c9ecee7a131c5b1d28319b2108c0 git://git.infradead.org/users/eparis/notify.git) BugLink: http://bugs.launchpad.net/bugs/922906 Signed-off-by: Andy Whitcroft --- fs/notify/group.c | 8 ++++++++ include/linux/fsnotify_backend.h | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/notify/group.c b/fs/notify/group.c index c49e729..59a6b53 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c @@ -64,6 +64,14 @@ void fsnotify_destroy_group(struct fsnotify_group *group) } /* + * Get reference to a group. + */ +void fsnotify_get_group(struct fsnotify_group *group) +{ + atomic_inc(&group->refcnt); +} + +/* * Drop a reference to a group. Free it if it's through. */ void fsnotify_put_group(struct fsnotify_group *group) diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index afac095..a1450b3 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -360,8 +360,10 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode /* called from fsnotify listeners, such as fanotify or dnotify */ -/* get a reference to an existing or create a new group */ +/* create a new group */ extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops); +/* get reference to a group */ +extern void fsnotify_get_group(struct fsnotify_group *group); /* drop reference on a group from fsnotify_alloc_group */ extern void fsnotify_put_group(struct fsnotify_group *group); /* destroy group */