} 
_pagebuf_find(	xfs_buftarg_t		*btp,	/* block device target		*/	loff_t			ioff,	/* starting offset of range	*/	size_t			isize,	/* length of range		*/	page_buf_flags_t	flags,	/* PBF_TRYLOCK			*/	xfs_buf_t		*new_pb)/* newly allocated buffer	*/{	loff_t			range_base;	size_t			range_length;	xfs_bufhash_t		*hash;	xfs_buf_t		*pb, *n;	range_base = (ioff << BBSHIFT);	range_length = (isize << BBSHIFT);	/* Check for IOs smaller than the sector size / not sector aligned */	ASSERT(!(range_length < (1 << btp->pbr_sshift)));	ASSERT(!(range_base & (loff_t)btp->pbr_smask));	hash = &btp->bt_hash[hash_long((unsigned long)ioff, btp->bt_hashshift)];	spin_lock(&hash->bh_lock);	list_for_each_entry_safe(pb, n, &hash->bh_list, pb_hash_list) {		ASSERT(btp == pb->pb_target);		if (pb->pb_file_offset == range_base &&		    pb->pb_buffer_length == range_length) {			/*			 * If we look at something bring it to the			 * front of the list for next time.			 */			atomic_inc(&pb->pb_hold);			list_move(&pb->pb_hash_list, &hash->bh_list);			goto found;		}	}	/* No match found */	if (new_pb) {		_pagebuf_initialize(new_pb, btp, range_base,				range_length, flags);		new_pb->pb_hash = hash;		list_add(&new_pb->pb_hash_list, &hash->bh_list);	} else {		XFS_STATS_INC(pb_miss_locked);	}	spin_unlock(&hash->bh_lock);	return new_pb;found:	spin_unlock(&hash->bh_lock);	/* Attempt to get the semaphore without sleeping,	 * if this does not work then we need to drop the	 * spinlock and do a hard attempt on the semaphore.	 */	if (down_trylock(&pb->pb_sema)) {		if (!(flags & PBF_TRYLOCK)) {			/* wait for buffer ownership */			PB_TRACE(pb, "get_lock", 0);			pagebuf_lock(pb);			XFS_STATS_INC(pb_get_locked_waited);		} else {			/* We asked for a trylock and failed, no need			 * to look at file offset and length here, we			 * know that this pagebuf at least overlaps our			 * pagebuf and is locked, therefore our buffer			 * either does not exist, or is this buffer			 */			pagebuf_rele(pb);			XFS_STATS_INC(pb_busy_locked);			return (NULL);		}	} else {		/* trylock worked */		PB_SET_OWNER(pb);	}	if (pb->pb_flags & PBF_STALE)		pb->pb_flags &= PBF_MAPPED;	PB_TRACE(pb, "got_lock", 0);	XFS_STATS_INC(pb_get_locked);	return (pb);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/2f926587512869ebf6bc820bd5f030e127aae774/xfs_buf.c/clean/fs/xfs/linux-2.6/xfs_buf.c