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 (skip_unhashed && d_unhashed(dentry))
130 parent = d_inode(dentry->d_parent);
139 * Walk the inode alias list, and find a dentry which has a given
145 struct dentry *ocfs2_find_local_alias(struct inode *inode,
149 struct dentry *dentry;
152 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
153 spin_lock(&dentry->d_lock);
154 if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
155 trace_ocfs2_find_local_alias(dentry->d_name.len,
156 dentry->d_name.name);
158 dget_dlock(dentry);
159 spin_unlock(&dentry->d_lock);
161 return dentry;
163 spin_unlock(&dentry->d_lock);
172 * Attach this dentry to a cluster lock.
193 * attaching and detaching the dentry lock with a
199 * who have seen the dentry will then be informed that they need to
201 * dentry. This happens in ocfs2_dentry_convert_worker().
203 int ocfs2_dentry_attach_lock(struct dentry *dentry,
208 struct dentry *alias;
209 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
211 trace_ocfs2_dentry_attach_lock(dentry->d_name.len, dentry->d_name.name,
215 * Negative dentry. We ignore these for now.
223 if (d_really_is_negative(dentry) && dentry->d_fsdata) {
224 /* Converting a negative dentry to positive
225 Clear dentry->d_fsdata */
226 dentry->d_fsdata = dl = NULL;
232 dentry,
242 * dentry lock already. We can just grab the lock off
245 * We're depending here on the fact that this dentry
258 dentry,
290 if (unlikely(dentry->d_fsdata && !alias)) {
302 dentry->d_fsdata = dl;
311 ret = ocfs2_dentry_lock(dentry, 0);
313 ocfs2_dentry_unlock(dentry, 0);
320 * which means iput() will not be called during dput(dentry).
326 dentry->d_fsdata = NULL;
340 * At this point, our particular dentry is detached from the inodes
352 * another process wants to create a new dentry lock. Right now we
383 static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode)
385 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
389 * No dentry lock is ok if we're disconnected or
392 if (!(dentry->d_flags & DCACHE_DISCONNECTED) &&
393 !d_unhashed(dentry)) {
399 ino, dentry->d_flags, dentry);
405 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %pd, count: %u\n",
406 dentry, dl->dl_count);
408 ocfs2_dentry_lock_put(OCFS2_SB(dentry->d_sb), dl);
417 * When we are done, "dentry" will have the parent dir and name of
420 * We manually update the lock of "dentry" if need be.
422 * "target" doesn't have it's dentry lock touched - we allow the later
433 void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target,
438 struct inode *inode = d_inode(dentry);
449 ocfs2_dentry_lock_put(osb, dentry->d_fsdata);
451 dentry->d_fsdata = NULL;
452 ret = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(new_dir)->ip_blkno);
457 d_move(dentry, target);