diff options
-rw-r--r-- | Documentation/filesystems/ceph.txt | 18 | ||||
-rw-r--r-- | fs/ceph/dir.c | 25 | ||||
-rw-r--r-- | fs/ceph/super.c | 14 | ||||
-rw-r--r-- | fs/ceph/super.h | 1 |
4 files changed, 50 insertions, 8 deletions
diff --git a/Documentation/filesystems/ceph.txt b/Documentation/filesystems/ceph.txt index 763d8ebbbebd..d6030aa33376 100644 --- a/Documentation/filesystems/ceph.txt +++ b/Documentation/filesystems/ceph.txt | |||
@@ -119,12 +119,20 @@ Mount Options | |||
119 | must rely on TCP's error correction to detect data corruption | 119 | must rely on TCP's error correction to detect data corruption |
120 | in the data payload. | 120 | in the data payload. |
121 | 121 | ||
122 | noasyncreaddir | 122 | dcache |
123 | Disable client's use its local cache to satisfy readdir | 123 | Use the dcache contents to perform negative lookups and |
124 | requests. (This does not change correctness; the client uses | 124 | readdir when the client has the entire directory contents in |
125 | cached metadata only when a lease or capability ensures it is | 125 | its cache. (This does not change correctness; the client uses |
126 | valid.) | 126 | cached metadata only when a lease or capability ensures it is |
127 | valid.) | ||
128 | |||
129 | nodcache | ||
130 | Do not use the dcache as above. This avoids a significant amount of | ||
131 | complex code, sacrificing performance without affecting correctness, | ||
132 | and is useful for tracking down bugs. | ||
127 | 133 | ||
134 | noasyncreaddir | ||
135 | Do not use the dcache as above for readdir. | ||
128 | 136 | ||
129 | More Information | 137 | More Information |
130 | ================ | 138 | ================ |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 974ef1e4d268..5259abfb5dd9 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -1094,17 +1094,36 @@ static int ceph_snapdir_d_revalidate(struct dentry *dentry, | |||
1094 | */ | 1094 | */ |
1095 | void ceph_dir_set_complete(struct inode *inode) | 1095 | void ceph_dir_set_complete(struct inode *inode) |
1096 | { | 1096 | { |
1097 | /* not yet implemented */ | 1097 | struct dentry *dentry = d_find_any_alias(inode); |
1098 | |||
1099 | if (dentry && ceph_dentry(dentry) && | ||
1100 | ceph_test_mount_opt(ceph_sb_to_client(dentry->d_sb), DCACHE)) { | ||
1101 | dout(" marking %p (%p) complete\n", inode, dentry); | ||
1102 | set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags); | ||
1103 | } | ||
1104 | dput(dentry); | ||
1098 | } | 1105 | } |
1099 | 1106 | ||
1100 | void ceph_dir_clear_complete(struct inode *inode) | 1107 | void ceph_dir_clear_complete(struct inode *inode) |
1101 | { | 1108 | { |
1102 | /* not yet implemented */ | 1109 | struct dentry *dentry = d_find_any_alias(inode); |
1110 | |||
1111 | if (dentry && ceph_dentry(dentry)) { | ||
1112 | dout(" marking %p (%p) complete\n", inode, dentry); | ||
1113 | set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags); | ||
1114 | } | ||
1115 | dput(dentry); | ||
1103 | } | 1116 | } |
1104 | 1117 | ||
1105 | bool ceph_dir_test_complete(struct inode *inode) | 1118 | bool ceph_dir_test_complete(struct inode *inode) |
1106 | { | 1119 | { |
1107 | /* not yet implemented */ | 1120 | struct dentry *dentry = d_find_any_alias(inode); |
1121 | |||
1122 | if (dentry && ceph_dentry(dentry)) { | ||
1123 | dout(" marking %p (%p) NOT complete\n", inode, dentry); | ||
1124 | clear_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags); | ||
1125 | } | ||
1126 | dput(dentry); | ||
1108 | return false; | 1127 | return false; |
1109 | } | 1128 | } |
1110 | 1129 | ||
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index ec74313e901f..9c62fe02ce05 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -131,6 +131,8 @@ enum { | |||
131 | Opt_rbytes, | 131 | Opt_rbytes, |
132 | Opt_norbytes, | 132 | Opt_norbytes, |
133 | Opt_noasyncreaddir, | 133 | Opt_noasyncreaddir, |
134 | Opt_dcache, | ||
135 | Opt_nodcache, | ||
134 | Opt_ino32, | 136 | Opt_ino32, |
135 | }; | 137 | }; |
136 | 138 | ||
@@ -152,6 +154,8 @@ static match_table_t fsopt_tokens = { | |||
152 | {Opt_rbytes, "rbytes"}, | 154 | {Opt_rbytes, "rbytes"}, |
153 | {Opt_norbytes, "norbytes"}, | 155 | {Opt_norbytes, "norbytes"}, |
154 | {Opt_noasyncreaddir, "noasyncreaddir"}, | 156 | {Opt_noasyncreaddir, "noasyncreaddir"}, |
157 | {Opt_dcache, "dcache"}, | ||
158 | {Opt_nodcache, "nodcache"}, | ||
155 | {Opt_ino32, "ino32"}, | 159 | {Opt_ino32, "ino32"}, |
156 | {-1, NULL} | 160 | {-1, NULL} |
157 | }; | 161 | }; |
@@ -231,6 +235,12 @@ static int parse_fsopt_token(char *c, void *private) | |||
231 | case Opt_noasyncreaddir: | 235 | case Opt_noasyncreaddir: |
232 | fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR; | 236 | fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR; |
233 | break; | 237 | break; |
238 | case Opt_dcache: | ||
239 | fsopt->flags |= CEPH_MOUNT_OPT_DCACHE; | ||
240 | break; | ||
241 | case Opt_nodcache: | ||
242 | fsopt->flags &= ~CEPH_MOUNT_OPT_DCACHE; | ||
243 | break; | ||
234 | case Opt_ino32: | 244 | case Opt_ino32: |
235 | fsopt->flags |= CEPH_MOUNT_OPT_INO32; | 245 | fsopt->flags |= CEPH_MOUNT_OPT_INO32; |
236 | break; | 246 | break; |
@@ -377,6 +387,10 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
377 | seq_puts(m, ",norbytes"); | 387 | seq_puts(m, ",norbytes"); |
378 | if (fsopt->flags & CEPH_MOUNT_OPT_NOASYNCREADDIR) | 388 | if (fsopt->flags & CEPH_MOUNT_OPT_NOASYNCREADDIR) |
379 | seq_puts(m, ",noasyncreaddir"); | 389 | seq_puts(m, ",noasyncreaddir"); |
390 | if (fsopt->flags & CEPH_MOUNT_OPT_DCACHE) | ||
391 | seq_puts(m, ",dcache"); | ||
392 | else | ||
393 | seq_puts(m, ",nodcache"); | ||
380 | 394 | ||
381 | if (fsopt->wsize) | 395 | if (fsopt->wsize) |
382 | seq_printf(m, ",wsize=%d", fsopt->wsize); | 396 | seq_printf(m, ",wsize=%d", fsopt->wsize); |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index edcbf3774a56..140f99f978c4 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */ | 28 | #define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */ |
29 | #define CEPH_MOUNT_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */ | 29 | #define CEPH_MOUNT_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */ |
30 | #define CEPH_MOUNT_OPT_INO32 (1<<8) /* 32 bit inos */ | 30 | #define CEPH_MOUNT_OPT_INO32 (1<<8) /* 32 bit inos */ |
31 | #define CEPH_MOUNT_OPT_DCACHE (1<<9) /* use dcache for readdir etc */ | ||
31 | 32 | ||
32 | #define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES) | 33 | #define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES) |
33 | 34 | ||