Lines Matching refs:dentry

7  * dentry cache handling code
28 void ocfs2_dentry_attach_gen(struct dentry *dentry)
31 OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen;
32 BUG_ON(d_inode(dentry));
33 dentry->d_fsdata = (void *)gen;
37 static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags)
46 inode = d_inode(dentry);
47 osb = OCFS2_SB(dentry->d_sb);
49 trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len,
50 dentry->d_name.name);
52 /* For a negative dentry -
57 unsigned long gen = (unsigned long) dentry->d_fsdata;
59 spin_lock(&dentry->d_lock);
60 pgen = OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen;
61 spin_unlock(&dentry->d_lock);
62 trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len,
63 dentry->d_name.name,
97 * If the last lookup failed to create dentry lock, let us
100 if (!dentry->d_fsdata) {
114 static int ocfs2_match_dentry(struct dentry *dentry,
123 * ocfs2_dentry_attach_lock() will get its original dentry
126 if (!dentry->d_fsdata)
129 if (!dentry->d_parent)
132 if (skip_unhashed && d_unhashed(dentry))
135 parent = d_inode(dentry->d_parent);
136 /* Negative parent dentry? */
148 * Walk the inode alias list, and find a dentry which has a given
154 struct dentry *ocfs2_find_local_alias(struct inode *inode,
158 struct dentry *dentry;
161 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
162 spin_lock(&dentry->d_lock);
163 if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
164 trace_ocfs2_find_local_alias(dentry->d_name.len,
165 dentry->d_name.name);
167 dget_dlock(dentry);
168 spin_unlock(&dentry->d_lock);
170 return dentry;
172 spin_unlock(&dentry->d_lock);
181 * Attach this dentry to a cluster lock.
202 * attaching and detaching the dentry lock with a
208 * who have seen the dentry will then be informed that they need to
210 * dentry. This happens in ocfs2_dentry_convert_worker().
212 int ocfs2_dentry_attach_lock(struct dentry *dentry,
217 struct dentry *alias;
218 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
220 trace_ocfs2_dentry_attach_lock(dentry->d_name.len, dentry->d_name.name,
224 * Negative dentry. We ignore these for now.
232 if (d_really_is_negative(dentry) && dentry->d_fsdata) {
233 /* Converting a negative dentry to positive
234 Clear dentry->d_fsdata */
235 dentry->d_fsdata = dl = NULL;
241 dentry,
251 * dentry lock already. We can just grab the lock off
254 * We're depending here on the fact that this dentry
267 dentry,
299 if (unlikely(dentry->d_fsdata && !alias)) {
311 dentry->d_fsdata = dl;
320 ret = ocfs2_dentry_lock(dentry, 0);
322 ocfs2_dentry_unlock(dentry, 0);
329 * which means iput() will not be called during dput(dentry).
335 dentry->d_fsdata = NULL;
349 * At this point, our particular dentry is detached from the inodes
361 * another process wants to create a new dentry lock. Right now we
392 static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode)
394 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
398 * No dentry lock is ok if we're disconnected or
401 if (!(dentry->d_flags & DCACHE_DISCONNECTED) &&
402 !d_unhashed(dentry)) {
408 ino, dentry->d_flags, dentry);
414 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %pd, count: %u\n",
415 dentry, dl->dl_count);
417 ocfs2_dentry_lock_put(OCFS2_SB(dentry->d_sb), dl);
426 * When we are done, "dentry" will have the parent dir and name of
429 * We manually update the lock of "dentry" if need be.
431 * "target" doesn't have it's dentry lock touched - we allow the later
442 void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target,
447 struct inode *inode = d_inode(dentry);
458 ocfs2_dentry_lock_put(osb, dentry->d_fsdata);
460 dentry->d_fsdata = NULL;
461 ret = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(new_dir)->ip_blkno);
466 d_move(dentry, target);