struct lfsck_start_param *lsp);
};
-#define TGT_PTRS 256 /* number of pointers at 1st level */
-#define TGT_PTRS_PER_BLOCK 256 /* number of pointers at 2nd level */
-
struct lfsck_tgt_desc {
struct list_head ltd_orphan_list;
struct dt_device *ltd_tgt;
struct lfsck_instance *lc_lfsck;
struct dt_object *lc_obj;
struct lfsck_sub_trace_obj lc_sub_trace_objs[LFSCK_STF_COUNT];
- struct lfsck_operations *lc_ops;
+ const struct lfsck_operations *lc_ops;
void *lc_file_ram;
void *lc_file_disk;
void *lc_data;
struct lfsck_rec_lmv_save li_rec_lmv_save[LFSCK_REC_LMV_MAX_DEPTH];
};
+static inline bool lfsck_is_dryrun(struct lfsck_instance *lfsck)
+{
+ return lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN;
+}
+
struct lfsck_async_interpret_args {
struct lfsck_component *laia_com;
struct lfsck_tgt_descs *laia_ltds;
struct ptlrpc_thread lad_thread;
struct task_struct *lad_task;
- struct lfsck_assistant_operations *lad_ops;
+ const struct lfsck_assistant_operations *lad_ops;
struct cfs_bitmap *lad_bitmap;
struct dt_object *obj, struct lustre_handle *lh,
__u64 bits, enum ldlm_mode mode);
void lfsck_ibits_unlock(struct lustre_handle *lh, enum ldlm_mode mode);
+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);
int lfsck_lock(const struct lu_env *env, struct lfsck_instance *lfsck,
struct dt_object *obj, const char *name,
struct lfsck_lock_handle *llh, __u64 bits, enum ldlm_mode mode);
struct lfsck_component *com);
void lfsck_instance_cleanup(const struct lu_env *env,
struct lfsck_instance *lfsck);
-void lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
+void lfsck_bits_dump(struct seq_file *m, int bits, const char *const names[],
const char *prefix);
void lfsck_time_dump(struct seq_file *m, time64_t time, const char *name);
void lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
void lfsck_control_speed_by_self(struct lfsck_component *com);
void lfsck_thread_args_fini(struct lfsck_thread_args *lta);
struct lfsck_assistant_data *
-lfsck_assistant_data_init(struct lfsck_assistant_operations *lao,
+lfsck_assistant_data_init(const struct lfsck_assistant_operations *lao,
const char *name);
struct lfsck_assistant_object *
lfsck_assistant_object_init(const struct lu_env *env, const struct lu_fid *fid,
struct dt_object *child,
const char *name, const char *name2,
__u16 type, bool update, bool dec);
-int lfsck_verify_linkea(const struct lu_env *env, struct dt_object *obj,
- const struct lu_name *cname, const struct lu_fid *pfid);
+int lfsck_verify_linkea(const struct lu_env *env, struct lfsck_instance *lfsck,
+ struct dt_object *obj, const struct lu_name *cname,
+ const struct lu_fid *pfid);
int lfsck_links_get_first(const struct lu_env *env, struct dt_object *obj,
char *name, struct lu_fid *pfid);
int lfsck_update_name_entry(const struct lu_env *env,
extern const char dot[];
extern const char dotdot[];
-extern const char *lfsck_flags_names[];
-extern const char *lfsck_param_names[];
+extern const char *const lfsck_flags_names[];
+extern const char *const lfsck_param_names[];
extern struct lu_context_key lfsck_thread_key;
static inline struct dt_device *lfsck_obj2dev(struct dt_object *obj)
{
- return container_of0(obj->do_lu.lo_dev, struct dt_device, dd_lu_dev);
+ return container_of_safe(obj->do_lu.lo_dev, struct dt_device,
+ dd_lu_dev);
}
static inline struct lfsck_thread_info *
if (atomic_dec_and_test(&lso->lso_ref))
OBD_FREE_PTR(lso);
}
+
+static inline struct thandle*
+lfsck_trans_create(const struct lu_env *env, struct dt_device *dev,
+ struct lfsck_instance *lfsck)
+{
+ if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN) {
+ CERROR("%s: transaction is being created in DRYRUN mode!\n",
+ lfsck_lfsck2name(lfsck));
+
+ dump_stack();
+ return ERR_PTR(-EINVAL);
+ }
+
+ return dt_trans_create(env, dev);
+}
#endif /* _LFSCK_INTERNAL_H */