aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/super.h
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2013-02-18 03:38:14 -0500
committerSage Weil <sage@inktank.com>2013-05-02 00:14:33 -0400
commita8673d61ad77ddf2118599507bd40cc345e95368 (patch)
tree0b8688fee3c2f6c7c35db75d42edd806df689d1d /fs/ceph/super.h
parent964266cce94cee7e4aca42994fcda206c111e917 (diff)
ceph: use I_COMPLETE inode flag instead of D_COMPLETE flag
commit c6ffe10015 moved the flag that tracks if the dcache contents for a directory are complete to dentry. The problem is there are lots of places that use ceph_dir_{set,clear,test}_complete() while holding i_ceph_lock. but ceph_dir_{set,clear,test}_complete() may sleep because they call dput(). This patch basically reverts that commit. For ceph_d_prune(), it's called with both the dentry to prune and the parent dentry are locked. So it's safe to access the parent dentry's d_inode and clear I_COMPLETE flag. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Reviewed-by: Greg Farnum <greg@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph/super.h')
-rw-r--r--fs/ceph/super.h23
1 files changed, 2 insertions, 21 deletions
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 86810b6d973b..20dd1ee3c4f0 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -204,7 +204,6 @@ struct ceph_inode_xattr {
204 * Ceph dentry state 204 * Ceph dentry state
205 */ 205 */
206struct ceph_dentry_info { 206struct ceph_dentry_info {
207 unsigned long flags;
208 struct ceph_mds_session *lease_session; 207 struct ceph_mds_session *lease_session;
209 u32 lease_gen, lease_shared_gen; 208 u32 lease_gen, lease_shared_gen;
210 u32 lease_seq; 209 u32 lease_seq;
@@ -215,18 +214,6 @@ struct ceph_dentry_info {
215 u64 offset; 214 u64 offset;
216}; 215};
217 216
218/*
219 * dentry flags
220 *
221 * The locking for D_COMPLETE is a bit odd:
222 * - we can clear it at almost any time (see ceph_d_prune)
223 * - it is only meaningful if:
224 * - we hold dir inode i_ceph_lock
225 * - we hold dir FILE_SHARED caps
226 * - the dentry D_COMPLETE is set
227 */
228#define CEPH_D_COMPLETE 1 /* if set, d_u.d_subdirs is complete directory */
229
230struct ceph_inode_xattrs_info { 217struct ceph_inode_xattrs_info {
231 /* 218 /*
232 * (still encoded) xattr blob. we avoid the overhead of parsing 219 * (still encoded) xattr blob. we avoid the overhead of parsing
@@ -267,7 +254,7 @@ struct ceph_inode_info {
267 struct timespec i_rctime; 254 struct timespec i_rctime;
268 u64 i_rbytes, i_rfiles, i_rsubdirs; 255 u64 i_rbytes, i_rfiles, i_rsubdirs;
269 u64 i_files, i_subdirs; 256 u64 i_files, i_subdirs;
270 u64 i_max_offset; /* largest readdir offset, set with D_COMPLETE */ 257 u64 i_max_offset; /* largest readdir offset, set with I_COMPLETE */
271 258
272 struct rb_root i_fragtree; 259 struct rb_root i_fragtree;
273 struct mutex i_fragtree_mutex; 260 struct mutex i_fragtree_mutex;
@@ -432,6 +419,7 @@ static inline struct inode *ceph_find_inode(struct super_block *sb,
432/* 419/*
433 * Ceph inode. 420 * Ceph inode.
434 */ 421 */
422#define CEPH_I_COMPLETE 1 /* we have complete directory cached */
435#define CEPH_I_NODELAY 4 /* do not delay cap release */ 423#define CEPH_I_NODELAY 4 /* do not delay cap release */
436#define CEPH_I_FLUSH 8 /* do not delay flush of dirty metadata */ 424#define CEPH_I_FLUSH 8 /* do not delay flush of dirty metadata */
437#define CEPH_I_NOFLUSH 16 /* do not flush dirty caps */ 425#define CEPH_I_NOFLUSH 16 /* do not flush dirty caps */
@@ -489,13 +477,6 @@ static inline loff_t ceph_make_fpos(unsigned frag, unsigned off)
489} 477}
490 478
491/* 479/*
492 * set/clear directory D_COMPLETE flag
493 */
494void ceph_dir_set_complete(struct inode *inode);
495void ceph_dir_clear_complete(struct inode *inode);
496bool ceph_dir_test_complete(struct inode *inode);
497
498/*
499 * caps helpers 480 * caps helpers
500 */ 481 */
501static inline bool __ceph_is_any_real_caps(struct ceph_inode_info *ci) 482static inline bool __ceph_is_any_real_caps(struct ceph_inode_info *ci)