mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
ceph: enable/disable dentry complete flags via mount option
Enable/disable use of the dentry dir 'complete' flag via a mount option. This lets the admin control whether ceph uses the dcache to satisfy negative lookups or readdir when it has the entire directory contents in its cache. This is purely a performance optimization; correctness is guaranteed whether it is enabled or not. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
46f72b3492
commit
a40dc6cc2e
@ -119,12 +119,20 @@ Mount Options
|
|||||||
must rely on TCP's error correction to detect data corruption
|
must rely on TCP's error correction to detect data corruption
|
||||||
in the data payload.
|
in the data payload.
|
||||||
|
|
||||||
noasyncreaddir
|
dcache
|
||||||
Disable client's use its local cache to satisfy readdir
|
Use the dcache contents to perform negative lookups and
|
||||||
requests. (This does not change correctness; the client uses
|
readdir when the client has the entire directory contents in
|
||||||
cached metadata only when a lease or capability ensures it is
|
its cache. (This does not change correctness; the client uses
|
||||||
valid.)
|
cached metadata only when a lease or capability ensures it is
|
||||||
|
valid.)
|
||||||
|
|
||||||
|
nodcache
|
||||||
|
Do not use the dcache as above. This avoids a significant amount of
|
||||||
|
complex code, sacrificing performance without affecting correctness,
|
||||||
|
and is useful for tracking down bugs.
|
||||||
|
|
||||||
|
noasyncreaddir
|
||||||
|
Do not use the dcache as above for readdir.
|
||||||
|
|
||||||
More Information
|
More Information
|
||||||
================
|
================
|
||||||
|
@ -1094,17 +1094,36 @@ static int ceph_snapdir_d_revalidate(struct dentry *dentry,
|
|||||||
*/
|
*/
|
||||||
void ceph_dir_set_complete(struct inode *inode)
|
void ceph_dir_set_complete(struct inode *inode)
|
||||||
{
|
{
|
||||||
/* not yet implemented */
|
struct dentry *dentry = d_find_any_alias(inode);
|
||||||
|
|
||||||
|
if (dentry && ceph_dentry(dentry) &&
|
||||||
|
ceph_test_mount_opt(ceph_sb_to_client(dentry->d_sb), DCACHE)) {
|
||||||
|
dout(" marking %p (%p) complete\n", inode, dentry);
|
||||||
|
set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
|
||||||
|
}
|
||||||
|
dput(dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ceph_dir_clear_complete(struct inode *inode)
|
void ceph_dir_clear_complete(struct inode *inode)
|
||||||
{
|
{
|
||||||
/* not yet implemented */
|
struct dentry *dentry = d_find_any_alias(inode);
|
||||||
|
|
||||||
|
if (dentry && ceph_dentry(dentry)) {
|
||||||
|
dout(" marking %p (%p) complete\n", inode, dentry);
|
||||||
|
set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
|
||||||
|
}
|
||||||
|
dput(dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ceph_dir_test_complete(struct inode *inode)
|
bool ceph_dir_test_complete(struct inode *inode)
|
||||||
{
|
{
|
||||||
/* not yet implemented */
|
struct dentry *dentry = d_find_any_alias(inode);
|
||||||
|
|
||||||
|
if (dentry && ceph_dentry(dentry)) {
|
||||||
|
dout(" marking %p (%p) NOT complete\n", inode, dentry);
|
||||||
|
clear_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
|
||||||
|
}
|
||||||
|
dput(dentry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +131,8 @@ enum {
|
|||||||
Opt_rbytes,
|
Opt_rbytes,
|
||||||
Opt_norbytes,
|
Opt_norbytes,
|
||||||
Opt_noasyncreaddir,
|
Opt_noasyncreaddir,
|
||||||
|
Opt_dcache,
|
||||||
|
Opt_nodcache,
|
||||||
Opt_ino32,
|
Opt_ino32,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -152,6 +154,8 @@ static match_table_t fsopt_tokens = {
|
|||||||
{Opt_rbytes, "rbytes"},
|
{Opt_rbytes, "rbytes"},
|
||||||
{Opt_norbytes, "norbytes"},
|
{Opt_norbytes, "norbytes"},
|
||||||
{Opt_noasyncreaddir, "noasyncreaddir"},
|
{Opt_noasyncreaddir, "noasyncreaddir"},
|
||||||
|
{Opt_dcache, "dcache"},
|
||||||
|
{Opt_nodcache, "nodcache"},
|
||||||
{Opt_ino32, "ino32"},
|
{Opt_ino32, "ino32"},
|
||||||
{-1, NULL}
|
{-1, NULL}
|
||||||
};
|
};
|
||||||
@ -231,6 +235,12 @@ static int parse_fsopt_token(char *c, void *private)
|
|||||||
case Opt_noasyncreaddir:
|
case Opt_noasyncreaddir:
|
||||||
fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR;
|
fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR;
|
||||||
break;
|
break;
|
||||||
|
case Opt_dcache:
|
||||||
|
fsopt->flags |= CEPH_MOUNT_OPT_DCACHE;
|
||||||
|
break;
|
||||||
|
case Opt_nodcache:
|
||||||
|
fsopt->flags &= ~CEPH_MOUNT_OPT_DCACHE;
|
||||||
|
break;
|
||||||
case Opt_ino32:
|
case Opt_ino32:
|
||||||
fsopt->flags |= CEPH_MOUNT_OPT_INO32;
|
fsopt->flags |= CEPH_MOUNT_OPT_INO32;
|
||||||
break;
|
break;
|
||||||
@ -377,6 +387,10 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
|
|||||||
seq_puts(m, ",norbytes");
|
seq_puts(m, ",norbytes");
|
||||||
if (fsopt->flags & CEPH_MOUNT_OPT_NOASYNCREADDIR)
|
if (fsopt->flags & CEPH_MOUNT_OPT_NOASYNCREADDIR)
|
||||||
seq_puts(m, ",noasyncreaddir");
|
seq_puts(m, ",noasyncreaddir");
|
||||||
|
if (fsopt->flags & CEPH_MOUNT_OPT_DCACHE)
|
||||||
|
seq_puts(m, ",dcache");
|
||||||
|
else
|
||||||
|
seq_puts(m, ",nodcache");
|
||||||
|
|
||||||
if (fsopt->wsize)
|
if (fsopt->wsize)
|
||||||
seq_printf(m, ",wsize=%d", fsopt->wsize);
|
seq_printf(m, ",wsize=%d", fsopt->wsize);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */
|
#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_NOASYNCREADDIR (1<<7) /* no dcache readdir */
|
||||||
#define CEPH_MOUNT_OPT_INO32 (1<<8) /* 32 bit inos */
|
#define CEPH_MOUNT_OPT_INO32 (1<<8) /* 32 bit inos */
|
||||||
|
#define CEPH_MOUNT_OPT_DCACHE (1<<9) /* use dcache for readdir etc */
|
||||||
|
|
||||||
#define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES)
|
#define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user