From patchwork Wed Mar 15 10:46:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9625293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6964D60424 for ; Wed, 15 Mar 2017 10:47:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6872D2854E for ; Wed, 15 Mar 2017 10:47:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D92D285D1; Wed, 15 Mar 2017 10:47:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CECC2854E for ; Wed, 15 Mar 2017 10:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbdCOKqq (ORCPT ); Wed, 15 Mar 2017 06:46:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:36552 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752930AbdCOKqp (ORCPT ); Wed, 15 Mar 2017 06:46:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BF330AE00; Wed, 15 Mar 2017 10:46:42 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id C309B1E11B8; Wed, 15 Mar 2017 11:46:39 +0100 (CET) From: Jan Kara To: Cc: Miklos Szeredi , Amir Goldstein , Paul Moore , Jan Kara Subject: [PATCH 10/33] fsnotify: Move fsnotify_destroy_marks() Date: Wed, 15 Mar 2017 11:46:09 +0100 Message-Id: <20170315104632.7037-11-jack@suse.cz> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170315104632.7037-1-jack@suse.cz> References: <20170315104632.7037-1-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move fsnotify_destroy_marks() to be later in the fs/notify/mark.c. It will need some functions that are declared after its current declaration. No functional change. Reviewed-by: Amir Goldstein Signed-off-by: Jan Kara --- fs/notify/mark.c | 72 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/fs/notify/mark.c b/fs/notify/mark.c index 12310d140d58..e8c707d07f9f 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c @@ -224,42 +224,6 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark, fsnotify_free_mark(mark); } -void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn, - spinlock_t *lock) -{ - struct fsnotify_mark *mark; - - if (!conn) - return; - - while (1) { - /* - * We have to be careful since we can race with e.g. - * fsnotify_clear_marks_by_group() and once we drop 'lock', - * mark can get removed from the obj_list and destroyed. But - * we are holding mark reference so mark cannot be freed and - * calling fsnotify_destroy_mark() more than once is fine. - */ - spin_lock(lock); - if (hlist_empty(&conn->list)) { - spin_unlock(lock); - break; - } - mark = hlist_entry(conn->list.first, struct fsnotify_mark, - obj_list); - /* - * We don't update i_fsnotify_mask / mnt_fsnotify_mask here - * since inode / mount is going away anyway. So just remove - * mark from the list. - */ - hlist_del_init_rcu(&mark->obj_list); - fsnotify_get_mark(mark); - spin_unlock(lock); - fsnotify_destroy_mark(mark, mark->group); - fsnotify_put_mark(mark); - } -} - void fsnotify_connector_free(struct fsnotify_mark_connector **connp) { if (*connp) { @@ -568,6 +532,42 @@ void fsnotify_detach_group_marks(struct fsnotify_group *group) } } +void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn, + spinlock_t *lock) +{ + struct fsnotify_mark *mark; + + if (!conn) + return; + + while (1) { + /* + * We have to be careful since we can race with e.g. + * fsnotify_clear_marks_by_group() and once we drop 'lock', + * mark can get removed from the obj_list and destroyed. But + * we are holding mark reference so mark cannot be freed and + * calling fsnotify_destroy_mark() more than once is fine. + */ + spin_lock(lock); + if (hlist_empty(&conn->list)) { + spin_unlock(lock); + break; + } + mark = hlist_entry(conn->list.first, struct fsnotify_mark, + obj_list); + /* + * We don't update i_fsnotify_mask / mnt_fsnotify_mask here + * since inode / mount is going away anyway. So just remove + * mark from the list. + */ + hlist_del_init_rcu(&mark->obj_list); + fsnotify_get_mark(mark); + spin_unlock(lock); + fsnotify_destroy_mark(mark, mark->group); + fsnotify_put_mark(mark); + } +} + /* * Nothing fancy, just initialize lists and locks and counters. */