4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License version 2 for more details. A copy is
14 * included in the COPYING file that accompanied this code.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Copyright (c) 2013, Intel Corporation.
26 * lustre/lfsck/lfsck_internal.h
28 * Shared definitions and declarations for the LFSCK.
30 * Author: Fan, Yong <fan.yong@intel.com>
33 #ifndef _LFSCK_INTERNAL_H
34 # define _LFSCK_INTERNAL_H
36 #include <lustre/lustre_lfsck_user.h>
37 #include <lustre/lustre_user.h>
38 #include <lustre/lustre_idl.h>
39 #include <lustre_lfsck.h>
41 #include <lu_object.h>
42 #include <dt_object.h>
43 #include <md_object.h>
44 #include <lustre_net.h>
45 #include <lustre_dlm.h>
46 #include <lustre_fid.h>
47 #include <md_object.h>
49 #define HALF_SEC (HZ >> 1)
50 #define LFSCK_CHECKPOINT_INTERVAL 60
52 #define LFSCK_NAMEENTRY_DEAD 1 /* The object has been unlinked. */
53 #define LFSCK_NAMEENTRY_REMOVED 2 /* The entry has been removed. */
54 #define LFSCK_NAMEENTRY_RECREATED 3 /* The entry has been recreated. */
57 /* Finish the first cycle scanning. */
58 LF_SCANNED_ONCE = 0x00000001ULL,
60 /* There is some namespace inconsistency. */
61 LF_INCONSISTENT = 0x00000002ULL,
63 /* The device is upgraded from 1.8 format. */
64 LF_UPGRADE = 0x00000004ULL,
66 /* The server ever restarted during the LFSCK, and may miss to process
67 * some objects check/repair. */
68 LF_INCOMPLETE = 0x00000008ULL,
70 /* The LAST_ID (file) crashed. */
71 LF_CRASHED_LASTID = 0x00000010ULL,
74 struct lfsck_position {
75 /* low layer object table-based iteration position. */
78 /* parent FID for directory traversal. */
79 struct lu_fid lp_dir_parent;
81 /* namespace-based directory traversal position. */
85 struct lfsck_bookmark {
86 /* Magic number to detect that this struct contains valid data. */
89 /* For compatible with old versions. */
92 /* See 'enum lfsck_param_flags' */
95 /* How many items can be scanned at most per second. */
98 /* The windows size for async requests pipeline. */
99 __u16 lb_async_windows;
101 /* For 64-bits aligned. */
104 /* For future using. */
105 __u64 lb_reserved[6];
108 struct lfsck_namespace {
109 /* Magic number to detect that this struct contains valid data. */
112 /* See 'enum lfsck_status'. */
115 /* See 'enum lfsck_flags'. */
118 /* How many completed LFSCK runs on the device. */
119 __u32 ln_success_count;
121 /* How long the LFSCK phase1 has run in seconds. */
122 __u32 ln_run_time_phase1;
124 /* How long the LFSCK phase2 has run in seconds. */
125 __u32 ln_run_time_phase2;
127 /* Time for the last LFSCK completed in seconds since epoch. */
128 __u64 ln_time_last_complete;
130 /* Time for the latest LFSCK ran in seconds since epoch. */
131 __u64 ln_time_latest_start;
133 /* Time for the last LFSCK checkpoint in seconds since epoch. */
134 __u64 ln_time_last_checkpoint;
136 /* Position for the latest LFSCK started from. */
137 struct lfsck_position ln_pos_latest_start;
139 /* Position for the last LFSCK checkpoint. */
140 struct lfsck_position ln_pos_last_checkpoint;
142 /* Position for the first should be updated object. */
143 struct lfsck_position ln_pos_first_inconsistent;
145 /* How many items (including dir) have been checked. */
146 __u64 ln_items_checked;
148 /* How many items have been repaired. */
149 __u64 ln_items_repaired;
151 /* How many items failed to be processed. */
152 __u64 ln_items_failed;
154 /* How many directories have been traversed. */
155 __u64 ln_dirs_checked;
157 /* How many multiple-linked objects have been checked. */
158 __u64 ln_mlinked_checked;
160 /* How many objects have been double scanned. */
161 __u64 ln_objs_checked_phase2;
163 /* How many objects have been reparied during double scan. */
164 __u64 ln_objs_repaired_phase2;
166 /* How many objects failed to be processed during double scan. */
167 __u64 ln_objs_failed_phase2;
169 /* How many objects with nlink fixed. */
170 __u64 ln_objs_nlink_repaired;
172 /* How many objects were lost before, but found back now. */
173 __u64 ln_objs_lost_found;
175 /* The latest object has been processed (failed) during double scan. */
176 struct lu_fid ln_fid_latest_scanned_phase2;
178 /* For further using. 256-bytes aligned now. */
179 __u64 ln_reserved[2];
182 enum lfsck_layout_inconsistency_type {
185 LLIT_UNMATCHED_PAIR = 2,
186 LLIT_MULTIPLE_REFERENCED = 3,
188 LLIT_INCONSISTENT_OWNER = 5,
190 LLIT_MAX = LLIT_OTHERS
193 struct lfsck_layout {
194 /* Magic number to detect that this struct contains valid data. */
197 /* See 'enum lfsck_status'. */
200 /* See 'enum lfsck_flags'. */
203 /* How many completed LFSCK runs on the device. */
204 __u32 ll_success_count;
206 /* How long the LFSCK phase1 has run in seconds. */
207 __u32 ll_run_time_phase1;
209 /* How long the LFSCK phase2 has run in seconds. */
210 __u32 ll_run_time_phase2;
212 /* Time for the last LFSCK completed in seconds since epoch. */
213 __u64 ll_time_last_complete;
215 /* Time for the latest LFSCK ran in seconds since epoch. */
216 __u64 ll_time_latest_start;
218 /* Time for the last LFSCK checkpoint in seconds since epoch. */
219 __u64 ll_time_last_checkpoint;
221 /* Position for the latest LFSCK started from. */
222 __u64 ll_pos_latest_start;
224 /* Position for the last LFSCK checkpoint. */
225 __u64 ll_pos_last_checkpoint;
227 /* Position for the first should be updated object. */
228 __u64 ll_pos_first_inconsistent;
230 /* How many objects have been checked. */
231 __u64 ll_objs_checked_phase1;
233 /* How many objects failed to be processed. */
234 __u64 ll_objs_failed_phase1;
236 /* How many objects have been double scanned. */
237 __u64 ll_objs_checked_phase2;
239 /* How many objects failed to be processed during double scan. */
240 __u64 ll_objs_failed_phase2;
242 /* kinds of inconsistency have been repaired.
243 * ll_objs_repaired[type - 1] is the count for the given @type. */
244 __u64 ll_objs_repaired[LLIT_MAX];
246 /* How many objects have been skipped because of related
247 * MDT(s)/OST(s) do not participate in the LFSCK */
248 __u64 ll_objs_skipped;
250 /* For further using. 256-bytes aligned now. */
251 __u64 ll_reserved[12];
254 struct lfsck_component;
255 struct lfsck_tgt_descs;
256 struct lfsck_tgt_desc;
258 struct lfsck_operations {
259 int (*lfsck_reset)(const struct lu_env *env,
260 struct lfsck_component *com,
263 void (*lfsck_fail)(const struct lu_env *env,
264 struct lfsck_component *com,
267 int (*lfsck_checkpoint)(const struct lu_env *env,
268 struct lfsck_component *com,
271 int (*lfsck_prep)(const struct lu_env *env,
272 struct lfsck_component *com,
273 struct lfsck_start_param *lsp);
275 int (*lfsck_exec_oit)(const struct lu_env *env,
276 struct lfsck_component *com,
277 struct dt_object *obj);
279 int (*lfsck_exec_dir)(const struct lu_env *env,
280 struct lfsck_component *com,
281 struct dt_object *obj,
282 struct lu_dirent *ent);
284 int (*lfsck_post)(const struct lu_env *env,
285 struct lfsck_component *com,
289 int (*lfsck_dump)(const struct lu_env *env,
290 struct lfsck_component *com,
294 int (*lfsck_double_scan)(const struct lu_env *env,
295 struct lfsck_component *com);
297 void (*lfsck_data_release)(const struct lu_env *env,
298 struct lfsck_component *com);
300 void (*lfsck_quit)(const struct lu_env *env,
301 struct lfsck_component *com);
303 int (*lfsck_in_notify)(const struct lu_env *env,
304 struct lfsck_component *com,
305 struct lfsck_request *lr);
307 int (*lfsck_query)(const struct lu_env *env,
308 struct lfsck_component *com);
310 int (*lfsck_stop_notify)(const struct lu_env *env,
311 struct lfsck_component *com,
312 struct lfsck_tgt_descs *ltds,
313 struct lfsck_tgt_desc *ltd,
314 struct ptlrpc_request_set *set);
316 int (*lfsck_join)(const struct lu_env *env,
317 struct lfsck_component *com,
318 struct lfsck_start_param *lsp);
321 #define TGT_PTRS 256 /* number of pointers at 1st level */
322 #define TGT_PTRS_PER_BLOCK 256 /* number of pointers at 2nd level */
324 struct lfsck_tgt_desc {
325 struct list_head ltd_orphan_list;
326 struct dt_device *ltd_tgt;
327 struct dt_device *ltd_key;
328 struct obd_export *ltd_exp;
329 struct list_head ltd_layout_list;
330 struct list_head ltd_layout_phase_list;
333 __u32 ltd_layout_gen;
334 unsigned int ltd_dead:1,
338 struct lfsck_tgt_desc_idx {
339 struct lfsck_tgt_desc *ldi_tgts[TGT_PTRS_PER_BLOCK];
342 struct lfsck_tgt_descs {
343 /* list of known TGTs */
344 struct lfsck_tgt_desc_idx *ltd_tgts_idx[TGT_PTRS];
346 /* bitmap of TGTs available */
347 cfs_bitmap_t *ltd_tgts_bitmap;
349 /* for lfsck_tgt_desc::ltd_xxx_list */
352 /* for tgts table accessing and changes */
353 struct rw_semaphore ltd_rw_sem;
355 /* Temporary list for orphan targets. */
356 struct list_head ltd_orphan;
358 /* number of registered TGTs */
362 #define LTD_TGT(ltd, index) \
363 ((ltd)->ltd_tgts_idx[(index) / TGT_PTRS_PER_BLOCK]->\
364 ldi_tgts[(index) % TGT_PTRS_PER_BLOCK])
366 #define OST_TGT(lfsck, index) LTD_TGT(&lfsck->li_ost_descs, index)
367 #define MDT_TGT(lfsck, index) LTD_TGT(&lfsck->li_mdt_descs, index)
369 struct lfsck_component {
370 /* into lfsck_instance::li_list_(scan,double_scan,idle} */
373 /* into lfsck_instance::li_list_dir */
374 cfs_list_t lc_link_dir;
376 struct rw_semaphore lc_sem;
379 struct lfsck_position lc_pos_start;
380 struct lfsck_instance *lc_lfsck;
381 struct dt_object *lc_obj;
382 struct lfsck_operations *lc_ops;
387 /* The time for last checkpoint, jiffies */
388 cfs_time_t lc_time_last_checkpoint;
390 /* The time for next checkpoint, jiffies */
391 cfs_time_t lc_time_next_checkpoint;
395 /* How many objects have been checked since last checkpoint. */
396 __u32 lc_new_checked;
398 /* How many objects have been scanned since last sleep. */
399 __u32 lc_new_scanned;
401 unsigned int lc_journal:1;
405 struct lfsck_instance {
406 struct mutex li_mutex;
409 /* Link into the lfsck_instance_list. */
412 /* For the components in (first) scanning via otable-based iteration. */
413 cfs_list_t li_list_scan;
415 /* For the components in scanning via directory traversal. Because
416 * directory traversal cannot guarantee all the object be scanned,
417 * so the component in the li_list_dir must be in li_list_scan. */
418 cfs_list_t li_list_dir;
420 /* For the components in double scanning. */
421 cfs_list_t li_list_double_scan;
423 /* For the components those are not scanning now. */
424 cfs_list_t li_list_idle;
427 atomic_t li_double_scan_count;
428 struct ptlrpc_thread li_thread;
430 /* The time for last checkpoint, jiffies */
431 cfs_time_t li_time_last_checkpoint;
433 /* The time for next checkpoint, jiffies */
434 cfs_time_t li_time_next_checkpoint;
436 lfsck_out_notify li_out_notify;
437 void *li_out_notify_data;
438 struct dt_device *li_next;
439 struct dt_device *li_bottom;
440 struct obd_device *li_obd;
441 struct ldlm_namespace *li_namespace;
442 struct local_oid_storage *li_los;
443 struct lu_fid li_local_root_fid; /* backend root "/" */
444 struct lu_fid li_global_root_fid; /* /ROOT */
445 struct dt_object *li_bookmark_obj;
446 struct lfsck_bookmark li_bookmark_ram;
447 struct lfsck_bookmark li_bookmark_disk;
448 struct lfsck_position li_pos_current;
450 /* Obj for otable-based iteration */
451 struct dt_object *li_obj_oit;
453 /* Obj for directory traversal */
454 struct dt_object *li_obj_dir;
456 /* It for otable-based iteration */
457 struct dt_it *li_di_oit;
459 /* It for directory traversal */
460 struct dt_it *li_di_dir;
462 /* Description of OST */
463 struct lfsck_tgt_descs li_ost_descs;
465 /* Description of MDT */
466 struct lfsck_tgt_descs li_mdt_descs;
468 /* namespace-based directory traversal position. */
471 /* Arguments for low layer otable-based iteration. */
474 /* Arugments for namespace-based directory traversal. */
477 /* Schedule for every N objects. */
480 /* Sleep N jiffies for each schedule. */
483 /* How many objects have been scanned since last sleep. */
484 __u32 li_new_scanned;
486 /* The status when the LFSCK stopped or paused. */
489 /* The flags when the lFSCK stopped or paused. */
492 unsigned int li_oit_over:1, /* oit is finished. */
493 li_drop_dryrun:1, /* Ever dryrun, not now. */
494 li_master:1, /* Master instance or not. */
495 li_current_oit_processed:1;
498 enum lfsck_linkea_flags {
499 /* The linkea entries does not match the object nlinks. */
500 LLF_UNMATCH_NLINKS = 0x01,
502 /* Fail to repair the multiple-linked objects during the double scan. */
503 LLF_REPAIR_FAILED = 0x02,
506 struct lfsck_async_interpret_args {
507 struct lfsck_component *laia_com;
508 struct lfsck_tgt_descs *laia_ltds;
509 struct lfsck_tgt_desc *laia_ltd;
510 struct lfsck_request *laia_lr;
513 struct lfsck_thread_args {
514 struct lu_env lta_env;
515 struct lfsck_instance *lta_lfsck;
516 struct lfsck_component *lta_com;
517 struct lfsck_start_param *lta_lsp;
520 struct lfsck_thread_info {
521 struct lu_name lti_name;
522 struct lu_buf lti_buf;
523 struct lu_buf lti_linkea_buf;
524 struct lu_fid lti_fid;
525 struct lu_fid lti_fid2;
526 struct lu_attr lti_la;
527 struct ost_id lti_oi;
529 struct lustre_mdt_attrs lti_lma;
530 /* old LMA for compatibility */
531 char lti_lma_old[LMA_OLD_SIZE];
533 struct dt_object_format lti_dof;
534 /* lti_ent and lti_key must be conjoint,
535 * then lti_ent::lde_name will be lti_key. */
536 struct lu_dirent lti_ent;
537 char lti_key[NAME_MAX + 16];
538 struct lfsck_request lti_lr;
539 struct lfsck_async_interpret_args lti_laia;
540 struct lfsck_stop lti_stop;
544 const char *lfsck_status2names(enum lfsck_status status);
545 void lfsck_component_cleanup(const struct lu_env *env,
546 struct lfsck_component *com);
547 void lfsck_instance_cleanup(const struct lu_env *env,
548 struct lfsck_instance *lfsck);
549 int lfsck_bits_dump(char **buf, int *len, int bits, const char *names[],
551 int lfsck_time_dump(char **buf, int *len, __u64 time, const char *prefix);
552 int lfsck_pos_dump(char **buf, int *len, struct lfsck_position *pos,
554 void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
555 struct lfsck_position *pos, bool init);
556 void lfsck_control_speed(struct lfsck_instance *lfsck);
557 void lfsck_control_speed_by_self(struct lfsck_component *com);
558 int lfsck_reset(const struct lu_env *env, struct lfsck_instance *lfsck,
560 struct lfsck_thread_args *lfsck_thread_args_init(struct lfsck_instance *lfsck,
561 struct lfsck_component *com,
562 struct lfsck_start_param *lsp);
563 void lfsck_thread_args_fini(struct lfsck_thread_args *lta);
564 void lfsck_fail(const struct lu_env *env, struct lfsck_instance *lfsck,
566 int lfsck_checkpoint(const struct lu_env *env, struct lfsck_instance *lfsck);
567 int lfsck_prep(const struct lu_env *env, struct lfsck_instance *lfsck,
568 struct lfsck_start_param *lsp);
569 int lfsck_exec_oit(const struct lu_env *env, struct lfsck_instance *lfsck,
570 struct dt_object *obj);
571 int lfsck_exec_dir(const struct lu_env *env, struct lfsck_instance *lfsck,
572 struct dt_object *obj, struct lu_dirent *ent);
573 int lfsck_post(const struct lu_env *env, struct lfsck_instance *lfsck,
575 int lfsck_double_scan(const struct lu_env *env, struct lfsck_instance *lfsck);
576 void lfsck_quit(const struct lu_env *env, struct lfsck_instance *lfsck);
577 int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
578 struct lfsck_request *lr,
579 struct ptlrpc_request_set *set,
580 ptlrpc_interpterer_t interpterer,
581 void *args, int request);
584 int lfsck_master_engine(void *args);
586 /* lfsck_bookmark.c */
587 int lfsck_bookmark_store(const struct lu_env *env,
588 struct lfsck_instance *lfsck);
589 int lfsck_bookmark_setup(const struct lu_env *env,
590 struct lfsck_instance *lfsck);
592 /* lfsck_namespace.c */
593 int lfsck_namespace_setup(const struct lu_env *env,
594 struct lfsck_instance *lfsck);
597 int lfsck_layout_setup(const struct lu_env *env, struct lfsck_instance *lfsck);
599 extern const char *lfsck_flags_names[];
600 extern const char *lfsck_param_names[];
601 extern struct lu_context_key lfsck_thread_key;
603 static inline struct lfsck_thread_info *
604 lfsck_env_info(const struct lu_env *env)
606 struct lfsck_thread_info *info;
608 info = lu_context_key_get(&env->le_ctx, &lfsck_thread_key);
609 LASSERT(info != NULL);
613 static inline const struct lu_name *
614 lfsck_name_get_const(const struct lu_env *env, const void *area, ssize_t len)
616 struct lu_name *lname;
618 lname = &lfsck_env_info(env)->lti_name;
619 lname->ln_name = area;
620 lname->ln_namelen = len;
624 static inline struct lu_buf *
625 lfsck_buf_get(const struct lu_env *env, void *area, ssize_t len)
629 buf = &lfsck_env_info(env)->lti_buf;
635 static inline const struct lu_buf *
636 lfsck_buf_get_const(const struct lu_env *env, const void *area, ssize_t len)
640 buf = &lfsck_env_info(env)->lti_buf;
641 buf->lb_buf = (void *)area;
646 static inline char *lfsck_lfsck2name(struct lfsck_instance *lfsck)
648 return lfsck->li_bottom->dd_lu_dev.ld_obd->obd_name;
651 static inline const struct lu_fid *lfsck_dto2fid(const struct dt_object *obj)
653 return lu_object_fid(&obj->do_lu);
656 static inline void lfsck_pos_set_zero(struct lfsck_position *pos)
658 memset(pos, 0, sizeof(*pos));
661 static inline int lfsck_pos_is_zero(const struct lfsck_position *pos)
663 return pos->lp_oit_cookie == 0 && fid_is_zero(&pos->lp_dir_parent);
666 static inline int lfsck_pos_is_eq(const struct lfsck_position *pos1,
667 const struct lfsck_position *pos2)
669 if (pos1->lp_oit_cookie < pos2->lp_oit_cookie)
672 if (pos1->lp_oit_cookie > pos2->lp_oit_cookie)
675 if (fid_is_zero(&pos1->lp_dir_parent) &&
676 !fid_is_zero(&pos2->lp_dir_parent))
679 if (!fid_is_zero(&pos1->lp_dir_parent) &&
680 fid_is_zero(&pos2->lp_dir_parent))
683 if (fid_is_zero(&pos1->lp_dir_parent) &&
684 fid_is_zero(&pos2->lp_dir_parent))
687 LASSERT(lu_fid_eq(&pos1->lp_dir_parent, &pos2->lp_dir_parent));
689 if (pos1->lp_dir_cookie < pos2->lp_dir_cookie)
692 if (pos1->lp_dir_cookie > pos2->lp_dir_cookie)
698 static void inline lfsck_position_le_to_cpu(struct lfsck_position *des,
699 struct lfsck_position *src)
701 des->lp_oit_cookie = le64_to_cpu(src->lp_oit_cookie);
702 fid_le_to_cpu(&des->lp_dir_parent, &src->lp_dir_parent);
703 des->lp_dir_cookie = le64_to_cpu(src->lp_dir_cookie);
706 static void inline lfsck_position_cpu_to_le(struct lfsck_position *des,
707 struct lfsck_position *src)
709 des->lp_oit_cookie = cpu_to_le64(src->lp_oit_cookie);
710 fid_cpu_to_le(&des->lp_dir_parent, &src->lp_dir_parent);
711 des->lp_dir_cookie = cpu_to_le64(src->lp_dir_cookie);
714 static inline umode_t lfsck_object_type(const struct dt_object *obj)
716 return lu_object_attr(&obj->do_lu);
719 static inline int lfsck_is_dead_obj(const struct dt_object *obj)
721 struct lu_object_header *loh = obj->do_lu.lo_header;
723 return !!test_bit(LU_OBJECT_HEARD_BANSHEE, &loh->loh_flags);
726 static inline struct dt_object *lfsck_object_find(const struct lu_env *env,
727 struct lfsck_instance *lfsck,
728 const struct lu_fid *fid)
730 return lu2dt(lu_object_find_slice(env, dt2lu_dev(lfsck->li_next),
734 static inline struct dt_object *lfsck_object_get(struct dt_object *obj)
736 lu_object_get(&obj->do_lu);
740 static inline void lfsck_object_put(const struct lu_env *env,
741 struct dt_object *obj)
743 lu_object_put(env, &obj->do_lu);
746 static inline struct lfsck_tgt_desc *lfsck_tgt_get(struct lfsck_tgt_descs *ltds,
749 struct lfsck_tgt_desc *ltd;
751 ltd = LTD_TGT(ltds, index);
753 atomic_inc(<d->ltd_ref);
758 static inline void lfsck_tgt_put(struct lfsck_tgt_desc *ltd)
760 if (atomic_dec_and_test(<d->ltd_ref))
764 static inline struct lfsck_component *
765 lfsck_component_get(struct lfsck_component *com)
767 atomic_inc(&com->lc_ref);
772 static inline void lfsck_component_put(const struct lu_env *env,
773 struct lfsck_component *com)
775 if (atomic_dec_and_test(&com->lc_ref)) {
776 if (com->lc_obj != NULL)
777 lu_object_put_nocache(env, &com->lc_obj->do_lu);
778 if (com->lc_file_ram != NULL)
779 OBD_FREE(com->lc_file_ram, com->lc_file_size);
780 if (com->lc_file_disk != NULL)
781 OBD_FREE(com->lc_file_disk, com->lc_file_size);
782 if (com->lc_data != NULL) {
783 LASSERT(com->lc_ops->lfsck_data_release != NULL);
785 com->lc_ops->lfsck_data_release(env, com);
792 static inline struct lfsck_instance *
793 lfsck_instance_get(struct lfsck_instance *lfsck)
795 atomic_inc(&lfsck->li_ref);
800 static inline void lfsck_instance_put(const struct lu_env *env,
801 struct lfsck_instance *lfsck)
803 if (atomic_dec_and_test(&lfsck->li_ref))
804 lfsck_instance_cleanup(env, lfsck);
807 static inline mdsno_t lfsck_dev_idx(struct dt_device *dev)
809 return dev->dd_lu_dev.ld_site->ld_seq_site->ss_node_id;
812 #endif /* _LFSCK_INTERNAL_H */