/* gfs2_ail1_empty_one - Check whether or not a trans in the AIL has been synced @sdp: the filesystem @ai: the AIL entry  */
static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int flags)
/* gfs2_ail1_empty_one - Check whether or not a trans in the AIL has been synced @sdp: the filesystem @ai: the AIL entry  */
static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int flags)
{
	struct gfs2_bufdata *bd, *s;
	struct buffer_head *bh;
	list_for_each_entry_safe_reverse(bd, s, &ai->ai_ail1_list,
					 bd_ail_st_list) {
		bh = bd->bd_bh;
		gfs2_assert(sdp, bd->bd_ail == ai);
		if (buffer_busy(bh)) {
			if (flags & DIO_ALL)
				continue;
			else
				break;
		}
		if (!buffer_uptodate(bh))
			gfs2_io_error_bh(sdp, bh);
		list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
	}
	return list_empty(&ai->ai_ail1_list);
}