ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
		      struct mb2_cache_entry **pce)
{
	__u32 hash = le32_to_cpu(header->h_hash);
	struct mb2_cache_entry *ce;
	struct mb2_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);

	if (!header->h_hash)
		return NULL;  /* never share */
	ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
	ce = mb2_cache_entry_find_first(ext4_mb_cache, hash);
	while (ce) {
		struct buffer_head *bh;

		bh = sb_bread(inode->i_sb, ce->e_block);
		if (!bh) {
			EXT4_ERROR_INODE(inode, "block %lu read error",
					 (unsigned long) ce->e_block);
		} else if (le32_to_cpu(BHDR(bh)->h_refcount) >=
				EXT4_XATTR_REFCOUNT_MAX) {
			ea_idebug(inode, "block %lu refcount %d>=%d",
				  (unsigned long) ce->e_block,
				  le32_to_cpu(BHDR(bh)->h_refcount),
					  EXT4_XATTR_REFCOUNT_MAX);
		} else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) {
			*pce = ce;
			return bh;
		}
		brelse(bh);
		ce = mb2_cache_entry_find_next(ext4_mb_cache, ce);
	}
	return NULL;
}
ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
		      struct mb2_cache_entry **pce)
{
	__u32 hash = le32_to_cpu(header->h_hash);
	struct mb2_cache_entry *ce;
	struct mb2_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);

	if (!header->h_hash)
		return NULL;   
	ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
	ce = mb2_cache_entry_find_first(ext4_mb_cache, hash);
	while (ce) {
		struct buffer_head *bh;

		bh = sb_bread(inode->i_sb, ce->e_block);
		if (!bh) {
			EXT4_ERROR_INODE(inode, "block %lu read error",
					 (unsigned long) ce->e_block);
		} else if (le32_to_cpu(BHDR(bh)->h_refcount) >=
				EXT4_XATTR_REFCOUNT_MAX) {
			ea_idebug(inode, "block %lu refcount %d>=%d",
				  (unsigned long) ce->e_block,
				  le32_to_cpu(BHDR(bh)->h_refcount),
					  EXT4_XATTR_REFCOUNT_MAX);
		} else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) {
			*pce = ce;
			return bh;
		}
		brelse(bh);
		ce = mb2_cache_entry_find_next(ext4_mb_cache, ce);
	}
	return NULL;
}