}
/**
+ * Request the remote LOOKUP lock for the given object.
+ *
+ * If \a pobj is remote, the LOOKUP lock of \a obj is on the MDT where
+ * \a pobj is, acquire LOOKUP lock there.
+ *
+ * \param[in] env pointer to the thread context
+ * \param[in] lfsck pointer to the lfsck instance
+ * \param[in] pobj pointer to parent dt_object
+ * \param[in] obj pointer to the dt_object to be locked
+ * \param[out] lh pointer to the lock handle
+ * \param[in] mode the mode for the ldlm lock to be acquired
+ *
+ * \retval 0 for success
+ * \retval negative error number on failure
+ */
+int lfsck_remote_lookup_lock(const struct lu_env *env,
+ struct lfsck_instance *lfsck,
+ struct dt_object *pobj, struct dt_object *obj,
+ struct lustre_handle *lh, enum ldlm_mode mode)
+{
+ struct ldlm_res_id *resid = &lfsck_env_info(env)->lti_resid;
+
+ LASSERT(!lustre_handle_is_used(lh));
+
+ fid_build_reg_res_name(lfsck_dto2fid(obj), resid);
+ return __lfsck_ibits_lock(env, lfsck, pobj, resid, lh,
+ MDS_INODELOCK_LOOKUP, mode);
+}
+
+/**
* Release the the specified ibits lock.
*
* If the lock has been acquired before, release it
bool dirty = false;
if (limit != LFSCK_SPEED_NO_LIMIT) {
- if (limit > msecs_to_jiffies(MSEC_PER_SEC)) {
- lfsck->li_sleep_rate = limit /
- msecs_to_jiffies(MSEC_PER_SEC);
+ if (limit > cfs_time_seconds(1)) {
+ lfsck->li_sleep_rate = limit / cfs_time_seconds(1);
lfsck->li_sleep_jif = 1;
} else {
lfsck->li_sleep_rate = 1;
- lfsck->li_sleep_jif = msecs_to_jiffies(MSEC_PER_SEC) /
- limit;
+ lfsck->li_sleep_jif = cfs_time_seconds(1) / limit;
}
} else {
lfsck->li_sleep_jif = 0;
lad->lad_assistant_status = 0;
lad->lad_post_result = 0;
- lad->lad_to_post = 0;
- lad->lad_to_double_scan = 0;
- lad->lad_in_double_scan = 0;
- lad->lad_exit = 0;
+ lad->lad_flags = 0;
lad->lad_advance_lock = false;
thread_set_flags(athread, 0);
lad->lad_post_result = *result;
if (*result <= 0)
- lad->lad_exit = 1;
- lad->lad_to_post = 1;
+ set_bit(LAD_EXIT, &lad->lad_flags);
+ set_bit(LAD_TO_POST, &lad->lad_flags);
CDEBUG(D_LFSCK, "%s: waiting for assistant to do %s post, rc = %d\n",
lfsck_lfsck2name(com->lc_lfsck), lad->lad_name, *result);
struct l_wait_info lwi = { 0 };
if (status != LS_SCANNING_PHASE2)
- lad->lad_exit = 1;
+ set_bit(LAD_EXIT, &lad->lad_flags);
else
- lad->lad_to_double_scan = 1;
+ set_bit(LAD_TO_DOUBLE_SCAN, &lad->lad_flags);
CDEBUG(D_LFSCK, "%s: waiting for assistant to do %s double_scan, "
"status %d\n",
wake_up_all(&athread->t_ctl_waitq);
l_wait_event(mthread->t_ctl_waitq,
- lad->lad_in_double_scan ||
+ test_bit(LAD_IN_DOUBLE_SCAN, &lad->lad_flags) ||
thread_is_stopped(athread),
&lwi);
struct ptlrpc_thread *athread = &lad->lad_thread;
struct l_wait_info lwi = { 0 };
- lad->lad_exit = 1;
+ set_bit(LAD_EXIT, &lad->lad_flags);
wake_up_all(&athread->t_ctl_waitq);
l_wait_event(mthread->t_ctl_waitq,
thread_is_init(athread) ||
if (unlikely(rc == -EINPROGRESS)) {
retry = true;
set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(msecs_to_jiffies(MSEC_PER_SEC));
+ schedule_timeout(cfs_time_seconds(1));
set_current_state(TASK_RUNNING);
if (!signal_pending(current) &&
thread_is_running(&lfsck->li_thread))