/* Count the number of inline directory entries in di_bh and compare them against the number of entries we can hold in an inline dx root block.  */
static int ocfs2_new_dx_should_be_inline(struct inode *dir, struct buffer_head *di_bh)
/* Count the number of inline directory entries in di_bh and compare them against the number of entries we can hold in an inline dx root block.  */
static int ocfs2_new_dx_should_be_inline(struct inode *dir, struct buffer_head *di_bh)
{
	int dirent_count = 0;
	char *de_buf, *limit;
	struct ocfs2_dir_entry *de;
	struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
	de_buf = di->id2.i_data.id_data;
	limit = de_buf + i_size_read(dir);
	while (de_buf < limit) {
		de = (struct ocfs2_dir_entry *)de_buf;
		if (de->name_len && de->inode)
			dirent_count++;
		de_buf += le16_to_cpu(de->rec_len);
	}
	return dirent_count < ocfs2_dx_entries_per_root(dir->i_sb);
}