All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: Joris Dolderer <vorstadtkind@googlemail.com>
Cc: linux-kernel@vger.kernel.org, eparis@redhat.com
Subject: Re: [PATCH 1/3] fsnotify: tree-watching support
Date: Sat, 13 Feb 2010 11:12:15 -0800	[thread overview]
Message-ID: <4B76F98F.6080802@xenotime.net> (raw)
In-Reply-To: <20100213100521.cb9c8310.vorstadtkind@googlemail.com>

On 02/13/10 01:05, Joris Dolderer wrote:
> Add tree-watching support to fsnotify.
> Hope mail works now...

Yes, much better, thanks.

The following review just concerns documentation...

> Signed-off-by: Joris Dolderer <vorstadtkind@googlemail.com>
> ---
>  fs/debugfs/inode.c               |    8 -
>  fs/namei.c                       |    8 -
>  fs/notify/fsnotify.c             |  188 +++++++++++++++++++++++------
>  fs/notify/fsnotify.h             |    1 
>  fs/notify/inode_mark.c           |   46 ++++++-
>  include/linux/dcache.h           |    3 
>  include/linux/fsnotify.h         |   55 +++++---
>  include/linux/fsnotify_backend.h |   51 +++++--
>  8 files changed, 279 insertions(+), 81 deletions(-)


> diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
> index 037e878..17cd902 100644
> --- a/fs/notify/fsnotify.c
> +++ b/fs/notify/fsnotify.c

[snip]

> +/* Notify this dentry's ancestors about a child's events. */
> +void __fsnotify_ancestors(struct dentry *dentry, __u32 mask)
> +{
> +	if (dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED) {
> +		struct dentry *parent;
> +		struct inode *p_inode;
> +		bool should_update_children = false;
> +		bool send = false;
> +
> +		spin_lock(&dentry->d_lock);
> +
> +		parent = dentry->d_parent;
> +		p_inode = parent->d_inode;
>  
> -	if (fsnotify_inode_watches_children(p_inode)) {
> -		if (p_inode->i_fsnotify_mask & mask) {
> +		if (fsnotify_inode_watches_children(p_inode)) {
> +			if (p_inode->i_fsnotify_mask & mask) {
> +				dget(parent);
> +				send = true;
> +			}
> +		} else {
> +			/*
> +			 * The parent doesn't care about events on it's children but

			                                           its
(yes, it's just moved, but please correct it)
("it's" means "it is", not possessive)

> +			 * at least one child thought it did.  We need to run all the
> +			 * children and update their d_flags to let them know p_inode
> +			 * doesn't care about them any more.
> +			 */
>  			dget(parent);
> -			send = true;
> +			should_update_children = true;
>  		}

[snip]

> +}
> +EXPORT_SYMBOL_GPL(__fsnotify_ancestors);
> +
> +/*
> + * notify tree-watching ancestors
> + * @dentry: The dentry the walkup should start with
> + * @file_name: The string that should be appended to this dentries' path
> + * @file_len: The length of this string
> + */

Please use kernel-doc notation for this and other exported symbols.
See Documentation/kernel-doc-nano-HOWTO.txt for details, or ask me if you
have questions about it.

E.g.:

/**
 * fsnotify_far_ancestors - notify tree-watching ancestors
 * @dentry: The dentry the walkup should start with
 * @file_name: The string that should be appended to this dentries' path
 * @file_len: The length of this string
 * @mask:  <description>
 */


> +void fsnotify_far_ancestors(struct dentry *dentry, const unsigned char *file_name, int file_len, __u32 mask)
> +{
...

>  }
> -EXPORT_SYMBOL_GPL(__fsnotify_parent);
> +EXPORT_SYMBOL_GPL(fsnotify_far_ancestors);
>  
>  /*
>   * This is the main call to fsnotify.  The VFS calls into hook specific functions

> diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
> index 3165d85..67ad9cb 100644
> --- a/fs/notify/inode_mark.c
> +++ b/fs/notify/inode_mark.c
> @@ -195,14 +216,16 @@ void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry)
>  
>  	/*
>  	 * __fsnotify_update_child_dentry_flags(inode);
> +	 * or __fsnotify_update_descents;
>  	 *
>  	 * I really want to call that, but we can't, we have no idea if the inode
>  	 * still exists the second we drop the entry->lock.
>  	 *
>  	 * The next time an event arrive to this inode from one of it's children

	                          arrives                          its

> -	 * __fsnotify_parent will see that the inode doesn't care about it's
> -	 * children and will update all of these flags then.  So really this
> -	 * is just a lazy update (and could be a perf win...)
> +	 * __fsnotify_ancestors resp. fsnotify_far_ancestors will see that the

What is "resp." ?

> +	 * inode doesn't care about it's children and will update all of these

	                            its

> +	 * flags then.  So really this is just a lazy update (and could be a
> +	 * perf win...)
>  	 */

> diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
> index 4d6f47b..1bea473 100644
> --- a/include/linux/fsnotify_backend.h
> +++ b/include/linux/fsnotify_backend.h

[snip]

> -static inline int fsnotify_inode_watches_children(struct inode *inode)
> +static inline bool fsnotify_inode_watches_something(struct inode *inode, u32 what)
>  {
> -	/* FS_EVENT_ON_CHILD is set if the inode may care */
> -	if (!(inode->i_fsnotify_mask & FS_EVENT_ON_CHILD))
> +	/* what is set if the inode may care */
> +	if (!(inode->i_fsnotify_mask & what))
>  		return 0;

		return false;

>  	/* this inode might care about child events, does it care about the
>  	 * specific set of events that can happen on a child? */
>  	return inode->i_fsnotify_mask & FS_EVENTS_POSS_ON_CHILD;
>  }


-- 
~Randy

  reply	other threads:[~2010-02-13 19:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13  9:05 [PATCH 1/3] fsnotify: tree-watching support Joris Dolderer
2010-02-13 19:12 ` Randy Dunlap [this message]
2010-02-13 19:31   ` Joris Dolderer
2010-02-13 19:36     ` Randy Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2010-02-19 13:46 Joris Dolderer
2010-03-01 19:47 ` Eric Paris
2010-02-12 21:10 Joris Dolderer
2010-02-12 21:24 ` Randy Dunlap

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=4B76F98F.6080802@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vorstadtkind@googlemail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.