kernels/linux-2.4.0/fs/dcache.c
/**
 * d_invalidate - invalidate a dentry
 * @dentry: dentry to invalidate
 *
 * Try to invalidate the dentry if it turns out to be
 * possible. If there are other dentries that can be
 * reached through this one we can't delete it and we
 * return -EBUSY. On success we return 0.
 *
 * no dcache lock.
 */


Try to invalidate the dentry if it turns out to be
possible. If there are other dentries that can be
reached through this one we can't delete it and we
return -EBUSY. On success we return 0.

no dcache lock.
Try to invalidate the dentry if it turns out to be possible . If there are other dentries that can be reached through this one we can ' t delete it and we return - EBUSY . On success we return 0 . no dcache lock .
int d_invalidate(struct dentry * dentry)
{
	spin_lock(&dcache_lock);
	if (list_empty(&dentry->d_hash)) {
		spin_unlock(&dcache_lock);
		return 0;
	}
	if (!list_empty(&dentry->d_subdirs)) {
		spin_unlock(&dcache_lock);
		shrink_dcache_parent(dentry);
		spin_lock(&dcache_lock);
	}
	if (atomic_read(&dentry->d_count) > 1) {
		if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {
			spin_unlock(&dcache_lock);
			return -EBUSY;
		}
	}
	list_del_init(&dentry->d_hash);
	spin_unlock(&dcache_lock);
	return 0;
}
int d_invalidate ( struct dentry * dentry ) { spin_lock ( & dcache_lock ) ; if ( list_empty ( & dentry -> d_hash ) ) { spin_unlock ( & dcache_lock ) ; return 0 ; } if ( ! list_empty ( & dentry -> d_subdirs ) ) { spin_unlock ( & dcache_lock ) ; shrink_dcache_parent ( dentry ) ; spin_lock ( & dcache_lock ) ; } if ( atomic_read ( & dentry -> d_count ) > 1 ) { if ( dentry -> d_inode && S_ISDIR ( dentry -> d_inode -> i_mode ) ) { spin_unlock ( & dcache_lock ) ; return - EBUSY ; } } list_del_init ( & dentry -> d_hash ) ; spin_unlock ( & dcache_lock ) ; return 0 ; }
d_invalidate - invalidate a dentry
 @dentry: dentry to invalidate
d_invalidate - invalidate a dentry @dentry : dentry to invalidate
/*
	 * If it's already been dropped, return OK.
	 */ /*
	 * Check whether to do a partial shrink_dcache
	 * to get rid of unused child entries.
	 */ /*
	 * Somebody else still using it?
	 *
	 * If it's a directory, we can't drop it
	 * for fear of somebody re-populating it
	 * with children (even though dropping it
	 * would make it unreachable from the root,
	 * we might still populate it if it was a
	 * working directory or similar).
	 */