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@xxxxxxxxxxxx> > --- > 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) > -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html