kernels/linux-2.4.0/fs/dcache.c
/*
 * dput - release a dentry
 * @dentry: dentry to release 
 *
 * Release a dentry. This will drop the usage count and if appropriate
 * call the dentry unlink method as well as removing it from the queues and
 * releasing its resources. If the parent dentries were scheduled for release
 * they too may now get deleted.
 *
 * no dcache lock, please.
 */


Release a dentry. This will drop the usage count and if appropriate
call the dentry unlink method as well as removing it from the queues and
releasing its resources. If the parent dentries were scheduled for release
they too may now get deleted.

no dcache lock, please.
Release a dentry . This will drop the usage count and if appropriate call the dentry unlink method as well as removing it from the queues and releasing its resources . If the parent dentries were scheduled for release they too may now get deleted . no dcache lock please .
void dput(struct dentry *dentry)
{
	if (!dentry)
		return;
repeat:
	if (!atomic_dec_and_lock(&dentry->d_count, &dcache_lock))
		return;
	if (!list_empty(&dentry->d_lru))
		BUG();
	if (dentry->d_op && dentry->d_op->d_delete) {
		if (dentry->d_op->d_delete(dentry))
			goto unhash_it;
	}
	if (list_empty(&dentry->d_hash))
		goto kill_it;
	list_add(&dentry->d_lru, &dentry_unused);
	dentry_stat.nr_unused++;
	dentry->d_reftime = jiffies;
	spin_unlock(&dcache_lock);
	return;
unhash_it:
	list_del_init(&dentry->d_hash);
kill_it: {
		struct dentry *parent;
		list_del(&dentry->d_child);
		dentry_iput(dentry);
		parent = dentry->d_parent;
		d_free(dentry);
		if (dentry == parent)
			return;
		dentry = parent;
		goto repeat;
	}
}
void dput ( struct dentry * dentry ) { if ( ! dentry ) return ; repeat : if ( ! atomic_dec_and_lock ( & dentry -> d_count , & dcache_lock ) ) return ; if ( ! list_empty ( & dentry -> d_lru ) ) BUG ( ) ; if ( dentry -> d_op && dentry -> d_op -> d_delete ) { if ( dentry -> d_op -> d_delete ( dentry ) ) goto unhash_it ; } if ( list_empty ( & dentry -> d_hash ) ) goto kill_it ; list_add ( & dentry -> d_lru , & dentry_unused ) ; dentry_stat . nr_unused ++ ; dentry -> d_reftime = jiffies ; spin_unlock ( & dcache_lock ) ; return ; unhash_it : list_del_init ( & dentry -> d_hash ) ; kill_it : { struct dentry * parent ; list_del ( & dentry -> d_child ) ; dentry_iput ( dentry ) ; parent = dentry -> d_parent ; d_free ( dentry ) ; if ( dentry == parent ) return ; dentry = parent ; goto repeat ; } }
dput - release a dentry
 @dentry: dentry to release
dput - release a dentry @dentry : dentry to release
/* dput on a free dentry? */ /*
	 * AV: ->d_delete() is _NOT_ allowed to block now.
	 */ /* Unreachable? Get rid of it */ /*
	 * Update the timestamp
	 */ /* drops the lock, at that point nobody can reach this dentry */