/* Move entries from net_ee to done_ee, if ready. Grab done_ee, call all callbacks, free the entries. The callbacks typically send out ACKs.  */
static int drbd_process_done_ee(struct drbd_conf *mdev)
/* Move entries from net_ee to done_ee, if ready. Grab done_ee, call all callbacks, free the entries. The callbacks typically send out ACKs.  */
static int drbd_process_done_ee(struct drbd_conf *mdev)
{
	LIST_HEAD(work_list);
	LIST_HEAD(reclaimed);
	struct drbd_epoch_entry *e, *t;
	int ok = (mdev->state.conn >= C_WF_REPORT_PARAMS);
	spin_lock_irq(&mdev->req_lock);
	reclaim_net_ee(mdev, &reclaimed);
	list_splice_init(&mdev->done_ee, &work_list);
	spin_unlock_irq(&mdev->req_lock);
	list_for_each_entry_safe(e, t, &reclaimed, w.list)
		drbd_free_ee(mdev, e);
	list_for_each_entry_safe(e, t, &work_list, w.list) {
		ok = e->w.cb(mdev, &e->w, !ok) && ok;
		drbd_free_ee(mdev, e);
	}
	wake_up(&mdev->ee_wait);
	return ok;
}