CEPH filesystem development
 help / color / mirror / Atom feed
From: Alex Elder <elder@dreamhost.com>
To: Sage Weil <sage@newdream.net>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 3/3] ceph: enable/disable dentry complete flags via mount option
Date: Thu, 22 Dec 2011 15:01:33 -0600	[thread overview]
Message-ID: <1324587693.17219.6.camel@doink> (raw)
In-Reply-To: <1324584791-31933-3-git-send-email-sage@newdream.net>

On Thu, 2011-12-22 at 12:13 -0800, Sage Weil wrote:
> Enable/disable use of the dentry dir 'complete' flag via a mount option.
> 
> Signed-off-by: Sage Weil <sage@newdream.net>
> ---
>  fs/ceph/dir.c   |    3 ++-
>  fs/ceph/super.c |   14 ++++++++++++++
>  fs/ceph/super.h |    1 +
>  3 files changed, 17 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index caddb7d..35db035 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -1134,7 +1134,8 @@ void ceph_dir_set_complete(struct inode *inode)
>  {
>  	struct dentry *dentry = d_find_any_alias(inode);
>  	
> -	if (dentry && ceph_dentry(dentry)) {
> +	if (dentry && ceph_dentry(dentry) &&
> +	    ceph_test_mount_opt(ceph_sb_to_client(dentry->d_sb), USEDCACHE)) {
>  		dout(" marking %p (%p) complete\n", inode, dentry);
>  		set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
>  	}

You should clear the CEPH_D_COMPLETE bit
conditionally in ceph_dir_clear_complete()
also.

And for ceph_dir_test_complete() I think
that whole function should be made conditional
on the mount option too, although I honestly
don't know whether it should return true
or false in the "nousedcache" case.

I realize making the test and clear ones
conditional is not technically necessary,
but I think it's good to handle it all
symmetrically.

Aside from that though I think the change
looks fine.

					-Alex

> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index b48f15f..3f4e5ad 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -131,6 +131,8 @@ enum {
>  	Opt_rbytes,
>  	Opt_norbytes,
>  	Opt_noasyncreaddir,
> +	Opt_usedcache,
> +	Opt_nousedcache,
>  	Opt_ino32,
>  };
>  
> @@ -152,6 +154,8 @@ static match_table_t fsopt_tokens = {
>  	{Opt_rbytes, "rbytes"},
>  	{Opt_norbytes, "norbytes"},
>  	{Opt_noasyncreaddir, "noasyncreaddir"},
> +	{Opt_usedcache, "usedcache"},
> +	{Opt_nousedcache, "nousedcache"},
>  	{Opt_ino32, "ino32"},
>  	{-1, NULL}
>  };
> @@ -231,6 +235,12 @@ static int parse_fsopt_token(char *c, void *private)
>  	case Opt_noasyncreaddir:
>  		fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR;
>  		break;
> +	case Opt_usedcache:
> +		fsopt->flags |= CEPH_MOUNT_OPT_USEDCACHE;
> +		break;
> +	case Opt_nousedcache:
> +		fsopt->flags &= ~CEPH_MOUNT_OPT_USEDCACHE;
> +		break;
>  	case Opt_ino32:
>  		fsopt->flags |= CEPH_MOUNT_OPT_INO32;
>  		break;
> @@ -377,6 +387,10 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
>  		seq_puts(m, ",norbytes");
>  	if (fsopt->flags & CEPH_MOUNT_OPT_NOASYNCREADDIR)
>  		seq_puts(m, ",noasyncreaddir");
> +	if (fsopt->flags & CEPH_MOUNT_OPT_USEDCACHE)
> +		seq_puts(m, ",usedcache");
> +	else
> +		seq_puts(m, ",nousedcache");
>  
>  	if (fsopt->wsize)
>  		seq_printf(m, ",wsize=%d", fsopt->wsize);
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index edcbf37..9270d9d 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -28,6 +28,7 @@
>  #define CEPH_MOUNT_OPT_RBYTES          (1<<5) /* dir st_bytes = rbytes */
>  #define CEPH_MOUNT_OPT_NOASYNCREADDIR  (1<<7) /* no dcache readdir */
>  #define CEPH_MOUNT_OPT_INO32           (1<<8) /* 32 bit inos */
> +#define CEPH_MOUNT_OPT_USEDCACHE       (1<<9)
>  
>  #define CEPH_MOUNT_OPT_DEFAULT    (CEPH_MOUNT_OPT_RBYTES)
>  




  reply	other threads:[~2011-12-22 21:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22 20:13 [PATCH 1/3] ceph: take inode lock when finding an inode alias Sage Weil
2011-12-22 20:13 ` [PATCH 2/3] ceph: take a reference to the dentry in d_find_any_alias() Sage Weil
2011-12-22 20:13 ` [PATCH 3/3] ceph: enable/disable dentry complete flags via mount option Sage Weil
2011-12-22 21:01   ` Alex Elder [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-12-29  2:05 [PATCH 0/3] Ceph fixes for 3.2 final Sage Weil
2011-12-29  2:05 ` [PATCH 3/3] ceph: enable/disable dentry complete flags via mount option Sage Weil
2011-12-29  9:11   ` Christoph Hellwig

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=1324587693.17219.6.camel@doink \
    --to=elder@dreamhost.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@newdream.net \
    /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