Lines Matching refs:dentry

5  * dentry cache handling code
26 void ocfs2_dentry_attach_gen(struct dentry *dentry)
29 OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen;
30 BUG_ON(d_inode(dentry));
31 dentry->d_fsdata = (void *)gen;
35 static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags)
44 inode = d_inode(dentry);
45 osb = OCFS2_SB(dentry->d_sb);
47 trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len,
48 dentry->d_name.name);
50 /* For a negative dentry -
55 unsigned long gen = (unsigned long) dentry->d_fsdata;
57 spin_lock(&dentry->d_lock);
58 pgen = OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen;
59 spin_unlock(&dentry->d_lock);
60 trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len,
61 dentry->d_name.name,
95 * If the last lookup failed to create dentry lock, let us
98 if (!dentry->d_fsdata) {
112 static int ocfs2_match_dentry(struct dentry *dentry,
121 * ocfs2_dentry_attach_lock() will get its original dentry
124 if (!dentry->d_fsdata)
127 if (!dentry->d_parent)
130 if (skip_unhashed && d_unhashed(dentry))
133 parent = d_inode(dentry->d_parent);
134 /* Negative parent dentry? */
146 * Walk the inode alias list, and find a dentry which has a given
152 struct dentry *ocfs2_find_local_alias(struct inode *inode,
156 struct dentry *dentry;
159 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
160 spin_lock(&dentry->d_lock);
161 if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
162 trace_ocfs2_find_local_alias(dentry->d_name.len,
163 dentry->d_name.name);
165 dget_dlock(dentry);
166 spin_unlock(&dentry->d_lock);
168 return dentry;
170 spin_unlock(&dentry->d_lock);
179 * Attach this dentry to a cluster lock.
200 * attaching and detaching the dentry lock with a
206 * who have seen the dentry will then be informed that they need to
208 * dentry. This happens in ocfs2_dentry_convert_worker().
210 int ocfs2_dentry_attach_lock(struct dentry *dentry,
215 struct dentry *alias;
216 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
218 trace_ocfs2_dentry_attach_lock(dentry->d_name.len, dentry->d_name.name,
222 * Negative dentry. We ignore these for now.
230 if (d_really_is_negative(dentry) && dentry->d_fsdata) {
231 /* Converting a negative dentry to positive
232 Clear dentry->d_fsdata */
233 dentry->d_fsdata = dl = NULL;
239 dentry,
249 * dentry lock already. We can just grab the lock off
252 * We're depending here on the fact that this dentry
265 dentry,
297 if (unlikely(dentry->d_fsdata && !alias)) {
309 dentry->d_fsdata = dl;
318 ret = ocfs2_dentry_lock(dentry, 0);
320 ocfs2_dentry_unlock(dentry, 0);
327 * which means iput() will not be called during dput(dentry).
333 dentry->d_fsdata = NULL;
347 * At this point, our particular dentry is detached from the inodes
359 * another process wants to create a new dentry lock. Right now we
390 static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode)
392 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
396 * No dentry lock is ok if we're disconnected or
399 if (!(dentry->d_flags & DCACHE_DISCONNECTED) &&
400 !d_unhashed(dentry)) {
406 ino, dentry->d_flags, dentry);
412 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %pd, count: %u\n",
413 dentry, dl->dl_count);
415 ocfs2_dentry_lock_put(OCFS2_SB(dentry->d_sb), dl);
424 * When we are done, "dentry" will have the parent dir and name of
427 * We manually update the lock of "dentry" if need be.
429 * "target" doesn't have it's dentry lock touched - we allow the later
440 void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target,
445 struct inode *inode = d_inode(dentry);
456 ocfs2_dentry_lock_put(osb, dentry->d_fsdata);
458 dentry->d_fsdata = NULL;
459 ret = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(new_dir)->ip_blkno);
464 d_move(dentry, target);