mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Louis Rilling <Louis.Rilling@kerlabs.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	cluster-devel@redhat.com, swhiteho@redhat.com,
	peterz@infradead.org
Subject: Re: [PATCH 1/2] configfs: Silence lockdep on mkdir() and rmdir()
Date: Wed, 28 Jan 2009 11:38:43 +0100	[thread overview]
Message-ID: <20090128103843.GL7532@hawkmoon.kerlabs.com> (raw)
In-Reply-To: <20090128035547.GE7244@mail.oracle.com>

[-- Attachment #1: Type: text/plain, Size: 3723 bytes --]

On 27/01/09 19:55 -0800, Joel Becker wrote:
> On Thu, Dec 18, 2008 at 07:00:17PM +0100, Louis Rilling wrote:

[...]

> 
> >  #define CONFIGFS_ROOT		0x0001
> > diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
> > index 8e93341..f21be74 100644
> > --- a/fs/configfs/dir.c
> > +++ b/fs/configfs/dir.c
> > @@ -94,6 +94,9 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare
> >  	INIT_LIST_HEAD(&sd->s_links);
> >  	INIT_LIST_HEAD(&sd->s_children);
> >  	sd->s_element = element;
> > +#ifdef CONFIG_LOCKDEP
> > +	sd->s_depth = -1;
> > +#endif
> >  	spin_lock(&configfs_dirent_lock);
> >  	if (parent_sd->s_type & CONFIGFS_USET_DROPPING) {
> >  		spin_unlock(&configfs_dirent_lock);
> > @@ -176,6 +179,17 @@ static int init_symlink(struct inode * inode)
> >  	return 0;
> >  }
> >  
> > +#ifdef CONFIG_LOCKDEP
> > +static void configfs_set_dir_dirent_depth(struct configfs_dirent *parent_sd,
> > +					  struct configfs_dirent *sd)
> > +{
> > +	int parent_depth = parent_sd->s_depth;
> > +
> > +	if (parent_depth >= 0)
> > +		sd->s_depth = parent_depth + 1;
> > +}
> > +#endif
> > +
> >  static int create_dir(struct config_item * k, struct dentry * p,
> >  		      struct dentry * d)
> >  {
> > @@ -187,6 +201,9 @@ static int create_dir(struct config_item * k, struct dentry * p,
> >  		error = configfs_make_dirent(p->d_fsdata, d, k, mode,
> >  					     CONFIGFS_DIR | CONFIGFS_USET_CREATING);
> >  	if (!error) {
> > +#ifdef CONFIG_LOCKDEP
> > +		configfs_set_dir_dirent_depth(p->d_fsdata, d->d_fsdata);
> > +#endif
> >  		error = configfs_create(d, mode, init_dir);
> >  		if (!error) {
> >  			inc_nlink(p->d_inode);
> 
> 	Can you change this to provide non-lockdep versions of
> functions?  We don't want "#ifdef CONFIG_LOCKDEP" everywhere.  What we
> want is the code to call functions unconditionally, and the functions to
> do nothing if lockdep is not enabled.  Like:
> 
> #ifdef CONFIG_LOCKDEP
> static inline void configfs_init_dir_dirent_depth(dirent)
> {
>     dirent->s_depth = -1;
> }
> 
> static void configfs_set_dir_dirent_depth(struct configfs_dirent *parent_sd,
> 					  struct configfs_dirent *sd)
> {
> 	int parent_depth = parent_sd->s_depth;
> 
> 	if (parent_depth >= 0)
> 		sd->s_depth = parent_depth + 1;
> }
> #else
> static inline void configfs_init_dir_dirent_depth(dirent)
> {
> }
> 
> static void configfs_set_dir_dirent_depth(struct configfs_dirent *parent_sd,
> 					  struct configfs_dirent *sd)
> {
> }
> #endif
> 
> 	This makes the callsites much nicer to read:
> 
> @@ -94,6 +94,9 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare
>  	INIT_LIST_HEAD(&sd->s_links);
>  	INIT_LIST_HEAD(&sd->s_children);
>  	sd->s_element = element;
> +	configfs_init_dir_dirent_depth(sd);
>  	spin_lock(&configfs_dirent_lock);
>  	if (parent_sd->s_type & CONFIGFS_USET_DROPPING) {
>  		spin_unlock(&configfs_dirent_lock);
> @@ -187,6 +201,7 @@ static int create_dir(struct config_item * k, struct dentry * p,
>  		error = configfs_make_dirent(p->d_fsdata, d, k, mode,
>  					     CONFIGFS_DIR | CONFIGFS_USET_CREATING);
>  	if (!error) {
> +		configfs_set_dir_dirent_depth(p->d_fsdata, d->d_fsdata);
>  		error = configfs_create(d, mode, init_dir);
>  		if (!error) {
>  			inc_nlink(p->d_inode);

Sure, that's why I said that this could be cleaner ;)

> 
> 	Otherwise, this patch seems pretty straightforward.

Cleaner patch coming.

Thanks,

Louis

-- 
Dr Louis Rilling			Kerlabs
Skype: louis.rilling			Batiment Germanium
Phone: (+33|0) 6 80 89 08 23		80 avenue des Buttes de Coesmes
http://www.kerlabs.com/			35700 Rennes

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2009-01-28 10:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 14:20 configfs, dlm_controld & lockdep Steven Whitehouse
2008-12-11 14:44 ` Louis Rilling
2008-12-11 17:34   ` Joel Becker
2008-12-12 10:06     ` Louis Rilling
2008-12-12 15:29       ` [PATCH] configfs: Silence lockdep on mkdir(), rmdir() and configfs_depend_item() Louis Rilling
2008-12-17 21:40         ` Andrew Morton
2008-12-17 22:03           ` Joel Becker
2008-12-17 22:09             ` Andrew Morton
2008-12-18  7:26           ` Peter Zijlstra
2008-12-18  9:27             ` Joel Becker
2008-12-18 11:15               ` Louis Rilling
2008-12-18 18:00                 ` Make lockdep happy with configfs Louis Rilling
2009-01-26 11:51                   ` Louis Rilling
2009-01-28  3:44                     ` Joel Becker
2008-12-18 18:00                 ` [PATCH 1/2] configfs: Silence lockdep on mkdir() and rmdir() Louis Rilling
2009-01-28  3:55                   ` Joel Becker
2009-01-28 10:38                     ` Louis Rilling [this message]
2008-12-18 18:00                 ` [PATCH 2/2] configfs: Rework configfs_depend_item() locking and make lockdep happy Louis Rilling
2009-01-28  4:13                   ` Joel Becker
2009-01-28 10:32                     ` Louis Rilling
2008-12-18 11:26               ` [PATCH] configfs: Silence lockdep on mkdir(), rmdir() and configfs_depend_item() Steven Whitehouse
2008-12-18 11:48                 ` Louis Rilling
2008-12-18 11:56               ` Peter Zijlstra
2008-12-18 12:28                 ` Peter Zijlstra
2008-12-18 22:58                   ` Joel Becker
2008-12-19 10:29                     ` Louis Rilling
2009-01-26 12:30                     ` Peter Zijlstra
2009-01-26 13:24                       ` Louis Rilling
2009-01-26 13:41                         ` Peter Zijlstra
2009-01-26 14:00                           ` Louis Rilling
2009-01-26 14:19                             ` Peter Zijlstra
2009-01-26 14:55                               ` Louis Rilling
2009-01-28  3:05                                 ` Joel Becker
2009-01-28  3:41                       ` Joel Becker
2009-01-28 18:18 [PATCH v2] Make lockdep happy with configfs Louis Rilling
2009-01-28 18:18 ` [PATCH 1/2] configfs: Silence lockdep on mkdir() and rmdir() Louis Rilling

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=20090128103843.GL7532@hawkmoon.kerlabs.com \
    --to=louis.rilling@kerlabs.com \
    --cc=akpm@linux-foundation.org \
    --cc=cluster-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=swhiteho@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®