linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Bobrowski <repnop@google.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	Matthew Bobrowski <mbobrowski@mbobrowski.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 4/4] fsnotify: optimize the case of no marks of any type
Date: Tue, 10 Aug 2021 16:43:47 +1000	[thread overview]
Message-ID: <YRIgI2HisRLS3ILA@google.com> (raw)
In-Reply-To: <20210803180344.2398374-5-amir73il@gmail.com>

On Tue, Aug 03, 2021 at 09:03:44PM +0300, Amir Goldstein wrote:
> Add a simple check in the inline helpers to avoid calling fsnotify()
> and __fsnotify_parent() in case there are no marks of any type
> (inode/sb/mount) for an inode's sb, so there can be no objects
> of any type interested in the event.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>

LGTM.

Reviewed-by: Matthew Bobrowski <repnop@google.com>

> ---
>  include/linux/fsnotify.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
> index f8acddcf54fb..12d3a7d308ab 100644
> --- a/include/linux/fsnotify.h
> +++ b/include/linux/fsnotify.h
> @@ -30,6 +30,9 @@ static inline void fsnotify_name(struct inode *dir, __u32 mask,
>  				 struct inode *child,
>  				 const struct qstr *name, u32 cookie)
>  {
> +	if (atomic_long_read(&dir->i_sb->s_fsnotify_connectors) == 0)
> +		return;
> +
>  	fsnotify(mask, child, FSNOTIFY_EVENT_INODE, dir, name, NULL, cookie);
>  }
>  
> @@ -41,6 +44,9 @@ static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry,
>  
>  static inline void fsnotify_inode(struct inode *inode, __u32 mask)
>  {
> +	if (atomic_long_read(&inode->i_sb->s_fsnotify_connectors) == 0)
> +		return;
> +
>  	if (S_ISDIR(inode->i_mode))
>  		mask |= FS_ISDIR;
>  
> @@ -53,6 +59,9 @@ static inline int fsnotify_parent(struct dentry *dentry, __u32 mask,
>  {
>  	struct inode *inode = d_inode(dentry);
>  
> +	if (atomic_long_read(&inode->i_sb->s_fsnotify_connectors) == 0)
> +		return 0;
> +
>  	if (S_ISDIR(inode->i_mode)) {
>  		mask |= FS_ISDIR;
>  
> -- 
> 2.25.1
> 
/M

  parent reply	other threads:[~2021-08-10  6:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 18:03 [PATCH 0/4] Performance optimization for no fsnotify marks Amir Goldstein
2021-08-03 18:03 ` [PATCH 1/4] fsnotify: replace igrab() with ihold() on attach connector Amir Goldstein
2021-08-10  5:39   ` Matthew Bobrowski
2021-08-03 18:03 ` [PATCH 2/4] fsnotify: count s_fsnotify_inode_refs for attached connectors Amir Goldstein
2021-08-10  6:03   ` Matthew Bobrowski
2021-08-03 18:03 ` [PATCH 3/4] fsnotify: count all objects with " Amir Goldstein
2021-08-10  6:31   ` Matthew Bobrowski
2021-08-10 14:12     ` Amir Goldstein
2021-08-10 10:47   ` Jan Kara
2021-08-10 14:22     ` Amir Goldstein
2021-08-03 18:03 ` [PATCH 4/4] fsnotify: optimize the case of no marks of any type Amir Goldstein
2021-08-08 14:34   ` [fsnotify] e902b4cafb: unixbench.score 6.1% improvement kernel test robot
2021-08-10  6:43   ` Matthew Bobrowski [this message]
2021-08-10 10:49 ` [PATCH 0/4] Performance optimization for no fsnotify marks Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRIgI2HisRLS3ILA@google.com \
    --to=repnop@google.com \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mbobrowski@mbobrowski.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).