From patchwork Thu Jun 25 00:16:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 6671271 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E0FDA9F39B for ; Thu, 25 Jun 2015 00:17:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93B9C20747 for ; Thu, 25 Jun 2015 00:17:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38F9520768 for ; Thu, 25 Jun 2015 00:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752914AbbFYAQ4 (ORCPT ); Wed, 24 Jun 2015 20:16:56 -0400 Received: from mga03.intel.com ([134.134.136.65]:59909 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752347AbbFYAQJ (ORCPT ); Wed, 24 Jun 2015 20:16:09 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 24 Jun 2015 17:16:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,673,1427785200"; d="scan'208";a="513808097" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.39.19]) by FMSMGA003.fm.intel.com with ESMTP; 24 Jun 2015 17:16:08 -0700 Subject: [RFCv2][PATCH 6/7] fsnotify: change fsnotify_recalc_mask() conventions To: dave@sr71.net Cc: jack@suse.cz, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com, tim.c.chen@linux.intel.com, ak@linux.intel.com, dave.hansen@linux.intel.com From: Dave Hansen Date: Wed, 24 Jun 2015 17:16:08 -0700 References: <20150625001605.72553909@viggo.jf.intel.com> In-Reply-To: <20150625001605.72553909@viggo.jf.intel.com> Message-Id: <20150625001608.BD776A31@viggo.jf.intel.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Hansen fsnotify_recalc_mask() currently takes a list of fsnotify_marks and calculates a mask from them. Now that we store the marks and the masks together in a fsnotify_head, just pass the whole thing in and have fsnotify_recalc_mask() set ->mask internally. Cc: Jan Kara Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Paul E. McKenney Cc: Tim Chen Cc: Andi Kleen Signed-off-by: Dave Hansen --- b/fs/notify/fsnotify.h | 5 +++-- b/fs/notify/inode_mark.c | 6 +++--- b/fs/notify/mark.c | 8 +++++--- b/fs/notify/vfsmount_mark.c | 6 +++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff -puN fs/notify/fsnotify.h~fsnotify_recalc_mask-redo fs/notify/fsnotify.h --- a/fs/notify/fsnotify.h~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.757207417 -0700 +++ b/fs/notify/fsnotify.h 2015-06-24 17:14:36.766207822 -0700 @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -12,8 +13,8 @@ extern void fsnotify_flush_notify(struct /* protects reads of inode and vfsmount marks list */ extern struct srcu_struct fsnotify_mark_srcu; -/* Calculate mask of events for a list of marks */ -extern u32 fsnotify_recalc_mask(struct hlist_head *head); +/* Recalculate the fsnotify_head's mask from its marks */ +extern void fsnotify_recalc_mask(struct fsnotify_head *fsn); /* compare two groups for sorting of marks lists */ extern int fsnotify_compare_groups(struct fsnotify_group *a, diff -puN fs/notify/inode_mark.c~fsnotify_recalc_mask-redo fs/notify/inode_mark.c --- a/fs/notify/inode_mark.c~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.759207507 -0700 +++ b/fs/notify/inode_mark.c 2015-06-24 17:14:36.766207822 -0700 @@ -37,7 +37,7 @@ void fsnotify_recalc_inode_mask(struct inode *inode) { spin_lock(&inode->i_lock); - inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks); + fsnotify_recalc_mask(&inode->i_fsnotify); spin_unlock(&inode->i_lock); __fsnotify_update_child_dentry_flags(inode); @@ -60,7 +60,7 @@ void fsnotify_destroy_inode_mark(struct * hold the inode->i_lock, so this is the perfect time to update the * inode->i_fsnotify.mask */ - inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks); + fsnotify_recalc_mask(&inode->i_fsnotify); spin_unlock(&inode->i_lock); } @@ -155,7 +155,7 @@ int fsnotify_add_inode_mark(struct fsnot mark->inode = inode; ret = fsnotify_add_mark_list(&inode->i_fsnotify.marks, mark, allow_dups); - inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks); + fsnotify_recalc_mask(&inode->i_fsnotify); spin_unlock(&inode->i_lock); return ret; diff -puN fs/notify/mark.c~fsnotify_recalc_mask-redo fs/notify/mark.c --- a/fs/notify/mark.c~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.760207552 -0700 +++ b/fs/notify/mark.c 2015-06-24 17:14:36.765207777 -0700 @@ -89,6 +89,7 @@ #include #include +#include #include "fsnotify.h" struct srcu_struct fsnotify_mark_srcu; @@ -111,14 +112,15 @@ void fsnotify_put_mark(struct fsnotify_m } /* Calculate mask of events for a list of marks */ -u32 fsnotify_recalc_mask(struct hlist_head *head) +void fsnotify_recalc_mask(struct fsnotify_head *fsn) { u32 new_mask = 0; struct fsnotify_mark *mark; - hlist_for_each_entry(mark, head, obj_list) + hlist_for_each_entry(mark, &fsn->marks, obj_list) new_mask |= mark->mask; - return new_mask; + + fsn->mask = new_mask; } /* diff -puN fs/notify/vfsmount_mark.c~fsnotify_recalc_mask-redo fs/notify/vfsmount_mark.c --- a/fs/notify/vfsmount_mark.c~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.762207642 -0700 +++ b/fs/notify/vfsmount_mark.c 2015-06-24 17:14:36.766207822 -0700 @@ -62,7 +62,7 @@ void fsnotify_recalc_vfsmount_mask(struc struct mount *m = real_mount(mnt); spin_lock(&mnt->mnt_root->d_lock); - m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks); + fsnotify_recalc_mask(&m->mnt_fsnotify); spin_unlock(&mnt->mnt_root->d_lock); } @@ -79,7 +79,7 @@ void fsnotify_destroy_vfsmount_mark(stru hlist_del_init_rcu(&mark->obj_list); mark->mnt = NULL; - m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks); + fsnotify_recalc_mask(&m->mnt_fsnotify); spin_unlock(&mnt->mnt_root->d_lock); } @@ -120,7 +120,7 @@ int fsnotify_add_vfsmount_mark(struct fs spin_lock(&mnt->mnt_root->d_lock); mark->mnt = mnt; ret = fsnotify_add_mark_list(&m->mnt_fsnotify.marks, mark, allow_dups); - m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks); + fsnotify_recalc_mask(&m->mnt_fsnotify); spin_unlock(&mnt->mnt_root->d_lock); return ret;