* Author: Fan, Yong <fan.yong@intel.com>
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
#define DEBUG_SUBSYSTEM S_LFSCK
#include <libcfs/list.h>
#include <lu_object.h>
#include <dt_object.h>
+#include <md_object.h>
+#include <lustre_fld.h>
#include <lustre_lib.h>
#include <lustre_net.h>
#include <lustre_lfsck.h>
{
const struct dt_it_ops *iops = &lfsck->li_obj_oit->do_index_ops->dio_it;
- spin_lock(&lfsck->li_lock);
if (unlikely(lfsck->li_di_oit == NULL)) {
- spin_unlock(&lfsck->li_lock);
memset(pos, 0, sizeof(*pos));
return;
}
fid_zero(&pos->lp_dir_parent);
pos->lp_dir_cookie = 0;
}
- spin_unlock(&lfsck->li_lock);
}
static void __lfsck_set_speed(struct lfsck_instance *lfsck, __u32 limit)
}
lfsck->li_obj_dir = lfsck_object_get(obj);
+ lfsck->li_cookie_dir = iops->store(env, di);
spin_lock(&lfsck->li_lock);
lfsck->li_di_dir = di;
spin_unlock(&lfsck->li_lock);
}
lfsck->li_obj_dir = lfsck_object_get(obj);
+ lfsck->li_cookie_dir = iops->store(env, di);
spin_lock(&lfsck->li_lock);
lfsck->li_di_dir = di;
spin_unlock(&lfsck->li_lock);
struct lfsck_component *com;
struct l_wait_info lwi = { 0 };
bool dirty = false;
- int rc = 0;
+ long rc = 0;
__u16 valid = 0;
__u16 flags = 0;
ENTRY;
lfsck->li_args_oit = (flags << DT_OTABLE_IT_FLAGS_SHIFT) | valid;
thread_set_flags(thread, 0);
- if (lfsck->li_master)
- rc = cfs_create_thread(lfsck_master_engine, lfsck, 0);
- if (rc < 0)
- CERROR("%s: cannot start LFSCK thread, rc = %d\n",
+ rc = PTR_ERR(kthread_run(lfsck_master_engine, lfsck, "lfsck"));
+ if (IS_ERR_VALUE(rc)) {
+ CERROR("%s: cannot start LFSCK thread, rc = %ld\n",
lfsck_lfsck2name(lfsck), rc);
- else
+ } else {
+ rc = 0;
l_wait_event(thread->t_ctl_waitq,
thread_is_running(thread) ||
thread_is_stopped(thread),
&lwi);
+ }
- GOTO(out, rc = 0);
+ GOTO(out, rc);
out:
mutex_unlock(&lfsck->li_mutex);
if (pause)
lfsck->li_paused = 1;
thread_set_flags(thread, SVC_STOPPING);
- /* The LFSCK thread may be sleeping on low layer wait queue,
- * wake it up. */
- if (likely(lfsck->li_di_oit != NULL))
- lfsck->li_obj_oit->do_index_ops->dio_it.put(env,
- lfsck->li_di_oit);
spin_unlock(&lfsck->li_lock);
cfs_waitq_broadcast(&thread->t_ctl_waitq);