RETURN(rc);
}
- rc = dt_declare_record_write(env, obj, size, pos, handle);
+ rc = dt_declare_record_write(env, obj, lfsck_buf_get(env, lo, size),
+ pos, handle);
if (rc != 0) {
CERROR("%s: fail to declare trans for storing lfsck_layout(1): "
"rc = %d\n", lfsck_lfsck2name(lfsck), rc);
if (rc != 0)
GOTO(stop, rc);
- rc = dt_declare_record_write(env, obj, sizeof(lastid), pos, th);
+ rc = dt_declare_record_write(env, obj,
+ lfsck_buf_get(env, &lastid,
+ sizeof(lastid)),
+ pos, th);
if (rc != 0)
GOTO(stop, rc);
continue;
}
+ lastid = cpu_to_le64(lls->lls_lastid);
rc = dt_declare_record_write(env, lls->lls_lastid_obj,
- sizeof(lastid), pos, th);
+ lfsck_buf_get(env, &lastid,
+ sizeof(lastid)), pos, th);
if (rc != 0)
goto stop;
if (rc != 0)
goto stop;
- lastid = cpu_to_le64(lls->lls_lastid);
dt_write_lock(env, lls->lls_lastid_obj, 0);
rc = dt_record_write(env, lls->lls_lastid_obj,
lfsck_buf_get(env, &lastid,
rc = lfsck_layout_assistant_handle_one(env, com, llr);
spin_lock(&llmd->llmd_lock);
list_del_init(&llr->llr_list);
- if (bk->lb_async_windows != 0 &&
- llmd->llmd_prefetched >= bk->lb_async_windows)
- wakeup = true;
-
llmd->llmd_prefetched--;
+ /* Wake up the main engine thread only when the list
+ * is empty or half of the prefetched items have been
+ * handled to avoid too frequent thread schedule. */
+ if (llmd->llmd_prefetched == 0 ||
+ (bk->lb_async_windows != 0 &&
+ (bk->lb_async_windows >> 1) ==
+ llmd->llmd_prefetched))
+ wakeup = true;
spin_unlock(&llmd->llmd_lock);
if (wakeup)
wake_up_all(&mthread->t_ctl_waitq);
GOTO(cleanup1, rc);
}
- /* Wakeup the master engine if it is waiting in checkpoint. */
- wake_up_all(&mthread->t_ctl_waitq);
-
l_wait_event(athread->t_ctl_waitq,
!lfsck_layout_req_empty(llmd) ||
llmd->llmd_exit ||