public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Jan Blunck <j.blunck@tu-harburg.de>
Subject: Re: [RFC][PATCH  5/15] Introduce union stack
Date: Wed, 18 Apr 2007 08:57:08 +0530	[thread overview]
Message-ID: <20070418032708.GA5870@in.ibm.com> (raw)
In-Reply-To: <20070417220848.GA22586@sergelap.austin.ibm.com>

On Tue, Apr 17, 2007 at 05:08:48PM -0500, Serge E. Hallyn wrote:
> Quoting Bharata B Rao (bharata@linux.vnet.ibm.com):
> > From: Jan Blunck <j.blunck@tu-harburg.de>
> > Subject: Introduce union stack.
> > 
> > Adds union stack infrastructure to the dentry structure and provides
> > locking routines to walk the union stack.
> > 
> > Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de>
> > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > ---
> >  fs/Makefile                  |    2 
> >  fs/dcache.c                  |    5 
> >  fs/union.c                   |   53 +++++++++
> >  include/linux/dcache.h       |   11 +
> >  include/linux/dcache_union.h |  243 +++++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 314 insertions(+)
> > 
> > --- a/fs/Makefile
> > +++ b/fs/Makefile
> > @@ -49,6 +49,8 @@ obj-$(CONFIG_FS_POSIX_ACL)	+= posix_acl.
> >  obj-$(CONFIG_NFS_COMMON)	+= nfs_common/
> >  obj-$(CONFIG_GENERIC_ACL)	+= generic_acl.o
> > 
> > +obj-$(CONFIG_UNION_MOUNT)	+= union.o
> > +
> >  obj-$(CONFIG_QUOTA)		+= dquot.o
> >  obj-$(CONFIG_QFMT_V1)		+= quota_v1.o
> >  obj-$(CONFIG_QFMT_V2)		+= quota_v2.o
> > --- a/fs/dcache.c
> > +++ b/fs/dcache.c
> > @@ -936,6 +936,11 @@ struct dentry *d_alloc(struct dentry * p
> >  #ifdef CONFIG_PROFILING
> >  	dentry->d_cookie = NULL;
> >  #endif
> > +#ifdef CONFIG_UNION_MOUNT
> > +	dentry->d_overlaid = NULL;
> > +	dentry->d_topmost = NULL;
> > +	dentry->d_union = NULL;
> > +#endif
> >  	INIT_HLIST_NODE(&dentry->d_hash);
> >  	INIT_LIST_HEAD(&dentry->d_lru);
> >  	INIT_LIST_HEAD(&dentry->d_subdirs);
> > --- /dev/null
> > +++ b/fs/union.c
> > @@ -0,0 +1,53 @@
> > +/*
> > + * VFS based union mount for Linux
> > + *
> > + * Copyright ? 2004-2007 IBM Corporation
> > + *   Author(s): Jan Blunck (j.blunck@tu-harburg.de)
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License as published by the Free
> > + * Software Foundation; either version 2 of the License, or (at your option)
> > + * any later version.
> > + */
> > +
> > +#include <linux/fs.h>
> > +
> > +struct union_info * union_alloc(void)
> > +{
> > +	struct union_info *info;
> > +
> > +	info = kmalloc(sizeof(*info), GFP_ATOMIC);
> > +	if (!info)
> > +		return NULL;
> > +
> > +	mutex_init(&info->u_mutex);
> > +	mutex_lock(&info->u_mutex);
> > +	atomic_set(&info->u_count, 1);
> > +	UM_DEBUG_LOCK("allocate union %p\n", info);
> > +	return info;
> > +}
> > +
> > +struct union_info * union_get(struct union_info *info)
> > +{
> > +	BUG_ON(!info);
> > +	BUG_ON(!atomic_read(&info->u_count));
> > +	atomic_inc(&info->u_count);
> > +	UM_DEBUG_LOCK("get union %p (count=%d)\n", info,
> > +		      atomic_read(&info->u_count));
> > +	return info;
> > +}
> 
> The locking here needs to be laid out.  It looks like union_get() needs
> to be called under union_lock(), while union_get2() (horrible name)
> grabs that lock itself, and returns with the lock held?
> 
> Similarly union_put clearly needs to be called under union_lock(), so
> that should be commented here.

Agreed. This whole thing needs a fresh look and we need to establish
some rules and consistency here. After you pointed out this, even
union_alloc2() is looking suspect to me. Same goes for union_release()
also. Thanks for pointing this out.

Regards,
Bharata.

  reply	other threads:[~2007-04-18  3:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-17 13:14 [RFC][PATCH 0/15] VFS based Union Mount Bharata B Rao
2007-04-17 13:16 ` [RFC][PATCH 1/15] Add union mount documentation Bharata B Rao
2007-04-17 13:17 ` [RFC][PATCH 2/15] Add a new mount flag (MNT_UNION) for union mount Bharata B Rao
2007-04-17 13:17 ` [RFC][PATCH 3/15] Add the whiteout file type Bharata B Rao
2007-04-17 13:18 ` [RFC][PATCH 4/15] Add config options for union mount Bharata B Rao
2007-04-17 13:19 ` [RFC][PATCH 5/15] Introduce union stack Bharata B Rao
2007-04-17 22:08   ` Serge E. Hallyn
2007-04-18  3:27     ` Bharata B Rao [this message]
2007-04-17 13:20 ` [RFC][PATCH 6/15] Union-mount dentry reference counting Bharata B Rao
2007-04-17 13:20 ` [RFC][PATCH 7/15] Union-mount mounting Bharata B Rao
2007-04-17 13:21 ` [RFC][PATCH 8/15] Union-mount lookup Bharata B Rao
2007-04-17 13:22 ` [RFC][PATCH 9/15] Simple union-mount readdir Bharata B Rao
2007-04-17 13:22 ` [RFC][PATCH 10/15] In-kernel file copy between union mounted filesystems Bharata B Rao
2007-04-17 13:23 ` [RFC][PATCH 11/15] VFS whiteout handling Bharata B Rao
2007-04-17 13:23 ` [RFC][PATCH 12/15] ext2 whiteout support Bharata B Rao
2007-04-17 13:24 ` [RFC][PATCH 13/15] ext3 " Bharata B Rao
2007-04-17 13:24 ` [RFC][PATCH 14/15] tmpfs " Bharata B Rao
2007-04-17 13:25 ` [RFC][PATCH 15/15] Union-mount changes for NFS Bharata B Rao
2007-04-17 14:35 ` [RFC][PATCH 0/15] VFS based Union Mount Shaya Potter
2007-04-17 16:30   ` Bharata B Rao
2007-04-17 16:56     ` Shaya Potter
2007-04-18  7:19       ` Bharata B Rao

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=20070418032708.GA5870@in.ibm.com \
    --to=bharata@linux.vnet.ibm.com \
    --cc=j.blunck@tu-harburg.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serue@us.ibm.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