Whamcloud - gitweb
ab035aa541615a36faf5fbdf2d4e37790b6ae56a
[fs/lustre-release.git] / lustre / lfsck / lfsck_internal.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
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.
9
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.
15
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
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2013, Intel Corporation.
24  */
25 /*
26  * lustre/lfsck/lfsck_internal.h
27  *
28  * Shared definitions and declarations for the LFSCK.
29  *
30  * Author: Fan, Yong <fan.yong@intel.com>
31  */
32
33 #ifndef _LFSCK_INTERNAL_H
34 # define _LFSCK_INTERNAL_H
35
36 #include <lustre/lustre_lfsck_user.h>
37 #include <lustre/lustre_user.h>
38 #include <lustre/lustre_idl.h>
39 #include <lustre_lfsck.h>
40 #include <obd.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>
48 #include <lustre_linkea.h>
49
50 #define HALF_SEC                        (HZ >> 1)
51 #define LFSCK_CHECKPOINT_INTERVAL       60
52
53 enum lfsck_flags {
54         /* Finish the first cycle scanning. */
55         LF_SCANNED_ONCE         = 0x00000001ULL,
56
57         /* There is some namespace inconsistency. */
58         LF_INCONSISTENT         = 0x00000002ULL,
59
60         /* The device is upgraded from 1.8 format. */
61         LF_UPGRADE              = 0x00000004ULL,
62
63         /* The server ever restarted during the LFSCK, and may miss to process
64          * some objects check/repair. */
65         LF_INCOMPLETE           = 0x00000008ULL,
66
67         /* The LAST_ID (file) crashed. */
68         LF_CRASHED_LASTID       = 0x00000010ULL,
69 };
70
71 struct lfsck_position {
72         /* low layer object table-based iteration position. */
73         __u64   lp_oit_cookie;
74
75         /* parent FID for directory traversal. */
76         struct lu_fid lp_dir_parent;
77
78         /* namespace-based directory traversal position. */
79         __u64   lp_dir_cookie;
80 };
81
82 struct lfsck_bookmark {
83         /* Magic number to detect that this struct contains valid data. */
84         __u32   lb_magic;
85
86         /* For compatible with old versions. */
87         __u16   lb_version;
88
89         /* See 'enum lfsck_param_flags' */
90         __u16   lb_param;
91
92         /* How many items can be scanned at most per second. */
93         __u32   lb_speed_limit;
94
95         /* The windows size for async requests pipeline. */
96         __u16   lb_async_windows;
97
98         /* For 64-bits aligned. */
99         __u16   lb_padding;
100
101         /* The FID for .lustre/lost+found/MDTxxxx */
102         struct lu_fid   lb_lpf_fid;
103
104         /* The FID for the last MDT-object created by the LFSCK repairing. */
105         struct lu_fid   lb_last_fid;
106
107         /* For future using. */
108         __u64   lb_reserved[2];
109 };
110
111 enum lfsck_namespace_trace_flags {
112         LNTF_CHECK_LINKEA       = 0x01,
113         LNTF_CHECK_PARENT       = 0x02,
114         LNTF_SKIP_NLINK         = 0x04,
115         LNTF_CHECK_ORPHAN       = 0x08,
116         LNTF_ALL                = 0xff
117 };
118
119 enum lfsck_namespace_inconsistency_type {
120         LNIT_NONE               = 0,
121         LNIT_BAD_LINKEA         = 1,
122         LNIT_UNMATCHED_PAIRS    = 2,
123         LNIT_DANGLING           = 3,
124         LNIT_MUL_REF            = 4,
125         LNIT_BAD_TYPE           = 5,
126         LNIT_BAD_DIRENT         = 6,
127 };
128
129 struct lfsck_namespace {
130         /* Magic number to detect that this struct contains valid data. */
131         __u32   ln_magic;
132
133         /* See 'enum lfsck_status'. */
134         __u32   ln_status;
135
136         /* See 'enum lfsck_flags'. */
137         __u32   ln_flags;
138
139         /* How many completed LFSCK runs on the device. */
140         __u32   ln_success_count;
141
142         /*  How long the LFSCK phase1 has run in seconds. */
143         __u32   ln_run_time_phase1;
144
145         /*  How long the LFSCK phase2 has run in seconds. */
146         __u32   ln_run_time_phase2;
147
148         /* Time for the last LFSCK completed in seconds since epoch. */
149         __u64   ln_time_last_complete;
150
151         /* Time for the latest LFSCK ran in seconds since epoch. */
152         __u64   ln_time_latest_start;
153
154         /* Time for the last LFSCK checkpoint in seconds since epoch. */
155         __u64   ln_time_last_checkpoint;
156
157         /* Position for the latest LFSCK started from. */
158         struct lfsck_position   ln_pos_latest_start;
159
160         /* Position for the last LFSCK checkpoint. */
161         struct lfsck_position   ln_pos_last_checkpoint;
162
163         /* Position for the first should be updated object. */
164         struct lfsck_position   ln_pos_first_inconsistent;
165
166         /* How many items (including dir) have been checked. */
167         __u64   ln_items_checked;
168
169         /* How many items have been repaired. */
170         __u64   ln_items_repaired;
171
172         /* How many items failed to be processed. */
173         __u64   ln_items_failed;
174
175         /* How many directories have been traversed. */
176         __u64   ln_dirs_checked;
177
178         /* How many objects have been double scanned. */
179         __u64   ln_objs_checked_phase2;
180
181         /* How many objects have been reparied during double scan. */
182         __u64   ln_objs_repaired_phase2;
183
184         /* How many objects failed to be processed during double scan. */
185         __u64   ln_objs_failed_phase2;
186
187         /* How many objects with nlink fixed. */
188         __u64   ln_objs_nlink_repaired;
189
190         /* The latest object has been processed (failed) during double scan. */
191         struct lu_fid   ln_fid_latest_scanned_phase2;
192
193         /* How many FID-in-dirent entries have been repaired. */
194         __u64   ln_dirent_repaired;
195
196         /* How many linkEA entries have been repaired. */
197         __u64   ln_linkea_repaired;
198
199         /* How many multiple-linked objects have been checked. */
200         __u64   ln_mul_linked_checked;
201
202         /* How many multiple-linked objects have been repaired. */
203         __u64   ln_mul_linked_repaired;
204
205         /* How many undefined inconsistency found in phase2. */
206         __u64   ln_unknown_inconsistency;
207
208         /* How many unmatched pairs have been repaired. */
209         __u64   ln_unmatched_pairs_repaired;
210
211         /* How many dangling name entries have been found/repaired. */
212         __u64   ln_dangling_repaired;
213
214         /* How many multiple referenced name entries have been
215          * found/repaired. */
216         __u64   ln_mul_ref_repaired;
217
218         /* How many name entries with bad file type have been repaired. */
219         __u64   ln_bad_type_repaired;
220
221         /* How many lost name entries have been re-inserted. */
222         __u64   ln_lost_dirent_repaired;
223
224         /* How many objects under /lost+found have been scanned. */
225         __u64   ln_local_lpf_scanned;
226
227         /* How many objects under /lost+found have been moved to
228          * namespace visible directory. */
229         __u64   ln_local_lpf_moved;
230
231         /* How many objects under /lost+found have been skipped. */
232         __u64   ln_local_lpf_skipped;
233
234         /* How many objects under /lost+found failed to be processed. */
235         __u64   ln_local_lpf_failed;
236
237         /* How many striped directories (master) have been scanned. */
238         __u64   ln_striped_dirs_scanned;
239
240         /* How many striped directories (master) have been repaired. */
241         __u64   ln_striped_dirs_repaired;
242
243         /* How many striped directories (master) failed verification. */
244         __u64   ln_striped_dirs_failed;
245
246         /* How many striped directories (master) has been disabled. */
247         __u64   ln_striped_dirs_disabled;
248
249         /* How many striped directory's (master) have been skipped
250          * (for shards verification) because of lost master LMV EA. */
251         __u64   ln_striped_dirs_skipped;
252
253         /* How many striped directory's shards (slave) have been scanned. */
254         __u64   ln_striped_shards_scanned;
255
256         /* How many striped directory's shards (slave) have been repaired. */
257         __u64   ln_striped_shards_repaired;
258
259         /* How many striped directory's shards (slave) failed verification. */
260         __u64   ln_striped_shards_failed;
261
262         /* How many striped directory's shards (slave) have been skipped
263          * (for name hash verification) because do not know whether the slave
264          * LMV EA is valid or not. */
265         __u64   ln_striped_shards_skipped;
266
267         /* How many name entries under striped directory with bad name
268          * hash have been repaired. */
269         __u64   ln_name_hash_repaired;
270
271         /* The size of MDT targets bitmap with nbits. Such bitmap records
272          * the MDTs that contain non-verified MDT-objects. */
273         __u32   ln_bitmap_size;
274
275         __u32   ln_reserved_1;
276         /* For further using. 256-bytes aligned now. */
277         __u64   ln_reserved[15];
278 };
279
280 enum lfsck_layout_inconsistency_type {
281         LLIT_NONE                       = 0,
282         LLIT_DANGLING                   = 1,
283         LLIT_UNMATCHED_PAIR             = 2,
284         LLIT_MULTIPLE_REFERENCED        = 3,
285         LLIT_ORPHAN                     = 4,
286         LLIT_INCONSISTENT_OWNER         = 5,
287         LLIT_OTHERS                     = 6,
288         LLIT_MAX                        = LLIT_OTHERS
289 };
290
291 struct lfsck_layout {
292         /* Magic number to detect that this struct contains valid data. */
293         __u32   ll_magic;
294
295         /* See 'enum lfsck_status'. */
296         __u32   ll_status;
297
298         /* See 'enum lfsck_flags'. */
299         __u32   ll_flags;
300
301         /* How many completed LFSCK runs on the device. */
302         __u32   ll_success_count;
303
304         /*  How long the LFSCK phase1 has run in seconds. */
305         __u32   ll_run_time_phase1;
306
307         /*  How long the LFSCK phase2 has run in seconds. */
308         __u32   ll_run_time_phase2;
309
310         /* Time for the last LFSCK completed in seconds since epoch. */
311         __u64   ll_time_last_complete;
312
313         /* Time for the latest LFSCK ran in seconds since epoch. */
314         __u64   ll_time_latest_start;
315
316         /* Time for the last LFSCK checkpoint in seconds since epoch. */
317         __u64   ll_time_last_checkpoint;
318
319         /* Position for the latest LFSCK started from. */
320         __u64   ll_pos_latest_start;
321
322         /* Position for the last LFSCK checkpoint. */
323         __u64   ll_pos_last_checkpoint;
324
325         /* Position for the first object to be fixed or
326          * failed to be checked in the phase1. */
327         __u64   ll_pos_first_inconsistent;
328
329         /* How many objects have been checked. */
330         __u64   ll_objs_checked_phase1;
331
332         /* How many objects failed to be processed. */
333         __u64   ll_objs_failed_phase1;
334
335         /* How many objects have been double scanned. */
336         __u64   ll_objs_checked_phase2;
337
338         /* How many objects failed to be processed during double scan. */
339         __u64   ll_objs_failed_phase2;
340
341         /* kinds of inconsistency have been or to be repaired.
342          * ll_objs_repaired[type - 1] is the count for the given @type. */
343         __u64   ll_objs_repaired[LLIT_MAX];
344
345         /* How many objects have been skipped because of related
346          * MDT(s)/OST(s) do not participate in the LFSCK */
347         __u64   ll_objs_skipped;
348
349         /* The size of ll_ost_bitmap with nbits. */
350         __u32   ll_bitmap_size;
351
352         /* For further using. 256-bytes aligned now. */
353         __u32   ll_reserved_1;
354         __u64   ll_reserved_2[11];
355
356         /* The OST targets bitmap to record the OSTs that contain
357          * non-verified OST-objects. */
358         __u8    ll_ost_bitmap[0];
359 };
360
361 struct lfsck_component;
362 struct lfsck_tgt_descs;
363 struct lfsck_tgt_desc;
364
365 struct lfsck_operations {
366         int (*lfsck_reset)(const struct lu_env *env,
367                            struct lfsck_component *com,
368                            bool init);
369
370         void (*lfsck_fail)(const struct lu_env *env,
371                            struct lfsck_component *com,
372                            bool new_checked);
373
374         void (*lfsck_close_dir)(const struct lu_env *env,
375                                 struct lfsck_component *com);
376
377         int (*lfsck_open_dir)(const struct lu_env *env,
378                               struct lfsck_component *com);
379
380         int (*lfsck_checkpoint)(const struct lu_env *env,
381                                 struct lfsck_component *com,
382                                 bool init);
383
384         int (*lfsck_prep)(const struct lu_env *env,
385                           struct lfsck_component *com,
386                           struct lfsck_start_param *lsp);
387
388         int (*lfsck_exec_oit)(const struct lu_env *env,
389                               struct lfsck_component *com,
390                               struct dt_object *obj);
391
392         int (*lfsck_exec_dir)(const struct lu_env *env,
393                               struct lfsck_component *com,
394                               struct lu_dirent *ent,
395                               __u16 type);
396
397         int (*lfsck_post)(const struct lu_env *env,
398                           struct lfsck_component *com,
399                           int result,
400                           bool init);
401
402         int (*lfsck_dump)(const struct lu_env *env,
403                           struct lfsck_component *com,
404                           struct seq_file *m);
405
406         int (*lfsck_double_scan)(const struct lu_env *env,
407                                  struct lfsck_component *com);
408
409         void (*lfsck_data_release)(const struct lu_env *env,
410                                    struct lfsck_component *com);
411
412         void (*lfsck_quit)(const struct lu_env *env,
413                            struct lfsck_component *com);
414
415         int (*lfsck_in_notify)(const struct lu_env *env,
416                                struct lfsck_component *com,
417                                struct lfsck_request *lr,
418                                struct thandle *th);
419
420         int (*lfsck_query)(const struct lu_env *env,
421                            struct lfsck_component *com);
422
423         int (*lfsck_join)(const struct lu_env *env,
424                           struct lfsck_component *com,
425                           struct lfsck_start_param *lsp);
426 };
427
428 #define TGT_PTRS                256     /* number of pointers at 1st level */
429 #define TGT_PTRS_PER_BLOCK      256     /* number of pointers at 2nd level */
430
431 struct lfsck_tgt_desc {
432         struct list_head   ltd_orphan_list;
433         struct dt_device  *ltd_tgt;
434         struct dt_device  *ltd_key;
435         struct obd_export *ltd_exp;
436         struct list_head   ltd_layout_list;
437         struct list_head   ltd_layout_phase_list;
438         struct list_head   ltd_namespace_list;
439         struct list_head   ltd_namespace_phase_list;
440         atomic_t           ltd_ref;
441         __u32              ltd_index;
442         __u32              ltd_layout_gen;
443         __u32              ltd_namespace_gen;
444         unsigned int       ltd_dead:1,
445                            ltd_layout_done:1,
446                            ltd_namespace_done:1,
447                            ltd_namespace_failed:1;
448 };
449
450 struct lfsck_tgt_desc_idx {
451         struct lfsck_tgt_desc *ldi_tgts[TGT_PTRS_PER_BLOCK];
452 };
453
454 struct lfsck_tgt_descs {
455         /* list of known TGTs */
456         struct lfsck_tgt_desc_idx       *ltd_tgts_idx[TGT_PTRS];
457
458         /* bitmap of TGTs available */
459         cfs_bitmap_t                    *ltd_tgts_bitmap;
460
461         /* for lfsck_tgt_desc::ltd_xxx_list */
462         spinlock_t                       ltd_lock;
463
464         /* for tgts table accessing and changes */
465         struct rw_semaphore              ltd_rw_sem;
466
467         /* Temporary list for orphan targets. */
468         struct list_head                 ltd_orphan;
469
470         /* number of registered TGTs */
471         __u32                            ltd_tgtnr;
472 };
473
474 #define LTD_TGT(ltd, index)     \
475         ((ltd)->ltd_tgts_idx[(index) / TGT_PTRS_PER_BLOCK]->\
476          ldi_tgts[(index) % TGT_PTRS_PER_BLOCK])
477
478 #define OST_TGT(lfsck, index)   LTD_TGT(&lfsck->li_ost_descs, index)
479 #define MDT_TGT(lfsck, index)   LTD_TGT(&lfsck->li_mdt_descs, index)
480
481 struct lfsck_component {
482         /* into lfsck_instance::li_list_(scan,double_scan,idle} */
483         struct list_head         lc_link;
484
485         /* into lfsck_instance::li_list_dir */
486         struct list_head         lc_link_dir;
487
488         struct rw_semaphore      lc_sem;
489         atomic_t                 lc_ref;
490
491         struct lfsck_position    lc_pos_start;
492         struct lfsck_instance   *lc_lfsck;
493         struct dt_object        *lc_obj;
494         struct lfsck_operations *lc_ops;
495         void                    *lc_file_ram;
496         void                    *lc_file_disk;
497         void                    *lc_data;
498         struct lu_fid            lc_fid_latest_scanned_phase2;
499
500         /* The time for last checkpoint, jiffies */
501         cfs_time_t               lc_time_last_checkpoint;
502
503         /* The time for next checkpoint, jiffies */
504         cfs_time_t               lc_time_next_checkpoint;
505
506         __u32                    lc_file_size;
507
508         /* How many objects have been checked since last checkpoint. */
509         __u32                    lc_new_checked;
510
511         /* How many objects have been scanned since last sleep. */
512         __u32                    lc_new_scanned;
513
514         __u16                    lc_type;
515 };
516
517 #define LFSCK_LMV_MAX_STRIPES   LMV_MAX_STRIPE_COUNT
518 #define LFSCK_LMV_DEF_STRIPES   4
519
520 struct lfsck_slave_lmv_rec {
521         struct lu_fid   lslr_fid;
522         __u32           lslr_stripe_count;
523         __u32           lslr_index; /* the index in name or in slave lmv */
524         __u32           lslr_hash_type;
525         __u32           lslr_flags;
526 };
527
528 struct lfsck_lmv {
529         struct lmv_mds_md_v1             ll_lmv;
530         atomic_t                         ll_ref;
531         int                              ll_stripes_allocated;
532         int                              ll_stripes_filled;
533         int                              ll_exit_value;
534         __u32                            ll_max_stripe_count;
535         __u32                            ll_max_filled_off;
536         __u32                            ll_hash_type;
537         unsigned int                     ll_lmv_master:1,
538                                          ll_lmv_slave:1,
539                                          ll_lmv_verified:1,
540                                          ll_lmv_updated:1,
541                                          ll_inline:1,
542                                          ll_failed:1,
543                                          ll_ignore:1;
544         struct lfsck_slave_lmv_rec      *ll_lslr;
545 };
546
547 struct lfsck_instance {
548         struct mutex              li_mutex;
549         spinlock_t                li_lock;
550
551         /* Link into the lfsck_instance_list. */
552         struct list_head          li_link;
553
554         /* For the components in (first) scanning via otable-based iteration. */
555         struct list_head          li_list_scan;
556
557         /* For the components in scanning via directory traversal. Because
558          * directory traversal cannot guarantee all the object be scanned,
559          * so the component in the li_list_dir must be in li_list_scan. */
560         struct list_head          li_list_dir;
561
562         /* For the components in double scanning. */
563         struct list_head          li_list_double_scan;
564
565         /* For the components those are not scanning now. */
566         struct list_head          li_list_idle;
567
568         atomic_t                  li_ref;
569         atomic_t                  li_double_scan_count;
570         struct ptlrpc_thread      li_thread;
571
572         /* The time for last checkpoint, jiffies */
573         cfs_time_t                li_time_last_checkpoint;
574
575         /* The time for next checkpoint, jiffies */
576         cfs_time_t                li_time_next_checkpoint;
577
578         lfsck_out_notify          li_out_notify;
579         void                     *li_out_notify_data;
580         struct dt_device         *li_next;
581         struct dt_device         *li_bottom;
582         struct obd_device        *li_obd;
583         struct ldlm_namespace    *li_namespace;
584         struct local_oid_storage *li_los;
585         struct lu_fid             li_local_root_fid;  /* backend root "/" */
586         struct lu_fid             li_global_root_fid; /* /ROOT */
587         struct dt_object         *li_bookmark_obj;
588         struct dt_object         *li_lpf_obj;
589         struct lu_client_seq     *li_seq;
590         struct lfsck_bookmark     li_bookmark_ram;
591         struct lfsck_bookmark     li_bookmark_disk;
592         struct lfsck_position     li_pos_current;
593         struct lfsck_position     li_pos_checkpoint;
594
595         struct lfsck_lmv         *li_lmv;
596
597         /* Obj for otable-based iteration */
598         struct dt_object         *li_obj_oit;
599
600         /* Obj for directory traversal */
601         struct dt_object         *li_obj_dir;
602
603         /* It for otable-based iteration */
604         struct dt_it             *li_di_oit;
605
606         /* It for directory traversal */
607         struct dt_it             *li_di_dir;
608
609         /* Description of OST */
610         struct lfsck_tgt_descs    li_ost_descs;
611
612         /* Description of MDT */
613         struct lfsck_tgt_descs    li_mdt_descs;
614
615         /* namespace-based directory traversal position. */
616         __u64                     li_cookie_dir;
617
618         /* Arguments for low layer otable-based iteration. */
619         __u32                     li_args_oit;
620
621         /* Arugments for namespace-based directory traversal. */
622         __u32                     li_args_dir;
623
624         /* Schedule for every N objects. */
625         __u32                     li_sleep_rate;
626
627         /* Sleep N jiffies for each schedule. */
628         __u32                     li_sleep_jif;
629
630         /* How many objects have been scanned since last sleep. */
631         __u32                     li_new_scanned;
632
633         /* The status when the LFSCK stopped or paused. */
634         __u32                     li_status;
635
636         /* The flags when the lFSCK stopped or paused. */
637         __u32                     li_flags;
638
639         unsigned int              li_oit_over:1, /* oit is finished. */
640                                   li_drop_dryrun:1, /* Ever dryrun, not now. */
641                                   li_master:1, /* Master instance or not. */
642                                   li_current_oit_processed:1,
643                                   li_start_unplug:1;
644 };
645
646 struct lfsck_async_interpret_args {
647         struct lfsck_component          *laia_com;
648         struct lfsck_tgt_descs          *laia_ltds;
649         struct lfsck_tgt_desc           *laia_ltd;
650         struct lfsck_request            *laia_lr;
651         atomic_t                        *laia_count;
652         int                              laia_result;
653         unsigned int                     laia_shared:1;
654 };
655
656 struct lfsck_thread_args {
657         struct lu_env                    lta_env;
658         struct lfsck_instance           *lta_lfsck;
659         struct lfsck_component          *lta_com;
660         struct lfsck_start_param        *lta_lsp;
661 };
662
663 struct lfsck_assistant_req {
664         struct list_head        lar_list;
665 };
666
667 struct lfsck_namespace_req {
668         struct lfsck_assistant_req       lnr_lar;
669         struct dt_object                *lnr_obj;
670         struct lfsck_lmv                *lnr_lmv;
671         struct lu_fid                    lnr_fid;
672         __u64                            lnr_oit_cookie;
673         __u64                            lnr_dir_cookie;
674         __u32                            lnr_attr;
675         __u32                            lnr_size;
676         __u16                            lnr_type;
677         __u16                            lnr_namelen;
678         char                             lnr_name[0];
679 };
680
681 struct lfsck_assistant_operations {
682         int (*la_handler_p1)(const struct lu_env *env,
683                              struct lfsck_component *com,
684                              struct lfsck_assistant_req *lar);
685
686         int (*la_handler_p2)(const struct lu_env *env,
687                              struct lfsck_component *com);
688
689         void (*la_fill_pos)(const struct lu_env *env,
690                             struct lfsck_component *com,
691                             struct lfsck_position *pos);
692
693         int (*la_double_scan_result)(const struct lu_env *env,
694                                      struct lfsck_component *com,
695                                      int rc);
696
697         void (*la_req_fini)(const struct lu_env *env,
698                             struct lfsck_assistant_req *lar);
699
700         void (*la_sync_failures)(const struct lu_env *env,
701                                  struct lfsck_component *com,
702                                  struct lfsck_request *lr);
703 };
704
705 struct lfsck_assistant_data {
706         spinlock_t                               lad_lock;
707         struct list_head                         lad_req_list;
708
709         /* list for the ost targets involve LFSCK. */
710         struct list_head                         lad_ost_list;
711
712         /* list for the ost targets in phase1 scanning. */
713         struct list_head                         lad_ost_phase1_list;
714
715         /* list for the ost targets in phase1 scanning. */
716         struct list_head                         lad_ost_phase2_list;
717
718         /* list for the mdt targets involve LFSCK. */
719         struct list_head                         lad_mdt_list;
720
721         /* list for the mdt targets in phase1 scanning. */
722         struct list_head                         lad_mdt_phase1_list;
723
724         /* list for the mdt targets in phase1 scanning. */
725         struct list_head                         lad_mdt_phase2_list;
726
727         const char                              *lad_name;
728         struct ptlrpc_thread                     lad_thread;
729
730         struct lfsck_assistant_operations       *lad_ops;
731
732         cfs_bitmap_t                            *lad_bitmap;
733
734         __u32                                    lad_touch_gen;
735         int                                      lad_prefetched;
736         int                                      lad_assistant_status;
737         int                                      lad_post_result;
738         unsigned int                             lad_to_post:1,
739                                                  lad_to_double_scan:1,
740                                                  lad_in_double_scan:1,
741                                                  lad_exit:1,
742                                                  lad_incomplete:1;
743 };
744
745 #define LFSCK_TMPBUF_LEN        64
746
747 struct lfsck_thread_info {
748         struct lu_name          lti_name_const;
749         struct lu_name          lti_name;
750         struct lu_name          lti_name2;
751         struct lu_buf           lti_buf;
752         struct lu_buf           lti_linkea_buf;
753         struct lu_buf           lti_linkea_buf2;
754         struct lu_buf           lti_big_buf;
755         struct lu_fid           lti_fid;
756         struct lu_fid           lti_fid2;
757         struct lu_fid           lti_fid3;
758         struct lu_fid           lti_fid4;
759         struct lu_fid           lti_fid5;
760         struct lu_attr          lti_la;
761         struct lu_attr          lti_la2;
762         struct lu_attr          lti_la3;
763         struct ost_id           lti_oi;
764         union {
765                 struct lustre_mdt_attrs lti_lma;
766                 /* old LMA for compatibility */
767                 char                    lti_lma_old[LMA_OLD_SIZE];
768         };
769         struct dt_object_format lti_dof;
770         /* There will be '\0' at the end of the name. */
771         char            lti_key[sizeof(struct lu_dirent) + NAME_MAX + 1];
772         char                    lti_tmpbuf[LFSCK_TMPBUF_LEN];
773         char                    lti_tmpbuf2[LFSCK_TMPBUF_LEN];
774         struct lfsck_request    lti_lr;
775         struct lfsck_async_interpret_args lti_laia;
776         struct lfsck_async_interpret_args lti_laia2;
777         struct lfsck_start      lti_start;
778         struct lfsck_stop       lti_stop;
779         ldlm_policy_data_t      lti_policy;
780         struct ldlm_res_id      lti_resid;
781         union {
782                 struct filter_fid_old   lti_old_pfid;
783                 struct filter_fid       lti_new_pfid;
784         };
785         struct dt_allocation_hint lti_hint;
786         struct lu_orphan_rec    lti_rec;
787         struct lov_user_md      lti_lum;
788         struct dt_insert_rec    lti_dt_rec;
789         struct lu_object_conf   lti_conf;
790         struct lu_seq_range     lti_range;
791         struct lmv_mds_md_v1    lti_lmv;
792         struct lmv_mds_md_v1    lti_lmv2;
793         struct lmv_mds_md_v1    lti_lmv3;
794         struct lmv_mds_md_v1    lti_lmv4;
795 };
796
797 /* lfsck_lib.c */
798 int lfsck_fid_alloc(const struct lu_env *env, struct lfsck_instance *lfsck,
799                     struct lu_fid *fid, bool locked);
800 int lfsck_ibits_lock(const struct lu_env *env, struct lfsck_instance *lfsck,
801                      struct dt_object *obj, struct lustre_handle *lh,
802                      __u64 bits, ldlm_mode_t mode);
803 void lfsck_ibits_unlock(struct lustre_handle *lh, ldlm_mode_t mode);
804 int lfsck_find_mdt_idx_by_fid(const struct lu_env *env,
805                               struct lfsck_instance *lfsck,
806                               const struct lu_fid *fid);
807 int lfsck_create_lpf(const struct lu_env *env, struct lfsck_instance *lfsck);
808 int lfsck_verify_lpf(const struct lu_env *env, struct lfsck_instance *lfsck);
809 struct lfsck_instance *lfsck_instance_find(struct dt_device *key, bool ref,
810                                            bool unlink);
811 struct lfsck_component *lfsck_component_find(struct lfsck_instance *lfsck,
812                                              __u16 type);
813 const char *lfsck_status2names(enum lfsck_status status);
814 void lfsck_component_cleanup(const struct lu_env *env,
815                              struct lfsck_component *com);
816 void lfsck_instance_cleanup(const struct lu_env *env,
817                             struct lfsck_instance *lfsck);
818 int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
819                     const char *prefix);
820 int lfsck_time_dump(struct seq_file *m, __u64 time, const char *prefix);
821 int lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
822                    const char *prefix);
823 void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
824                     struct lfsck_position *pos, bool init);
825 bool __lfsck_set_speed(struct lfsck_instance *lfsck, __u32 limit);
826 void lfsck_control_speed(struct lfsck_instance *lfsck);
827 void lfsck_control_speed_by_self(struct lfsck_component *com);
828 void lfsck_thread_args_fini(struct lfsck_thread_args *lta);
829 struct lfsck_assistant_data *
830 lfsck_assistant_data_init(struct lfsck_assistant_operations *lao,
831                           const char *name);
832 int lfsck_async_interpret_common(const struct lu_env *env,
833                                  struct ptlrpc_request *req,
834                                  void *args, int rc);
835 int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
836                         struct lfsck_request *lr,
837                         struct ptlrpc_request_set *set,
838                         ptlrpc_interpterer_t interpterer,
839                         void *args, int request);
840 int lfsck_start_assistant(const struct lu_env *env, struct lfsck_component *com,
841                           struct lfsck_start_param *lsp);
842 int lfsck_checkpoint_generic(const struct lu_env *env,
843                              struct lfsck_component *com);
844 void lfsck_post_generic(const struct lu_env *env,
845                         struct lfsck_component *com, int *result);
846 int lfsck_double_scan_generic(const struct lu_env *env,
847                               struct lfsck_component *com, int status);
848 void lfsck_quit_generic(const struct lu_env *env,
849                         struct lfsck_component *com);
850
851 /* lfsck_engine.c */
852 int lfsck_unpack_ent(struct lu_dirent *ent, __u64 *cookie, __u16 *type);
853 int lfsck_master_engine(void *args);
854 int lfsck_assistant_engine(void *args);
855
856 /* lfsck_bookmark.c */
857 void lfsck_bookmark_cpu_to_le(struct lfsck_bookmark *des,
858                               struct lfsck_bookmark *src);
859 int lfsck_bookmark_store(const struct lu_env *env,
860                          struct lfsck_instance *lfsck);
861 int lfsck_bookmark_setup(const struct lu_env *env,
862                          struct lfsck_instance *lfsck);
863 int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
864                     struct lfsck_start *start, bool reset);
865
866 /* lfsck_namespace.c */
867 int lfsck_namespace_trace_update(const struct lu_env *env,
868                                  struct lfsck_component *com,
869                                  const struct lu_fid *fid,
870                                  const __u8 flags, bool add);
871 int __lfsck_links_read(const struct lu_env *env, struct dt_object *obj,
872                        struct linkea_data *ldata);
873 int lfsck_namespace_rebuild_linkea(const struct lu_env *env,
874                                    struct lfsck_component *com,
875                                    struct dt_object *obj,
876                                    struct linkea_data *ldata);
877 int lfsck_namespace_repair_dangling(const struct lu_env *env,
878                                     struct lfsck_component *com,
879                                     struct dt_object *child,
880                                     struct lfsck_namespace_req *lnr);
881 int lfsck_namespace_repair_dirent(const struct lu_env *env,
882                                   struct lfsck_component *com,
883                                   struct dt_object *parent,
884                                   struct dt_object *child,
885                                   const char *name, const char *name2,
886                                   __u16 type, bool update, bool dec);
887 int lfsck_verify_linkea(const struct lu_env *env, struct dt_device *dev,
888                         struct dt_object *obj, const struct lu_name *cname,
889                         const struct lu_fid *pfid);
890 int lfsck_links_get_first(const struct lu_env *env, struct dt_object *obj,
891                           char *name, struct lu_fid *pfid);
892 int lfsck_remove_name_entry(const struct lu_env *env,
893                             struct lfsck_instance *lfsck,
894                             struct dt_object *parent,
895                             const char *name, __u32 type);
896 int lfsck_update_name_entry(const struct lu_env *env,
897                             struct lfsck_instance *lfsck,
898                             struct dt_object *parent, const char *name,
899                             const struct lu_fid *pfid, __u32 type);
900 int lfsck_namespace_setup(const struct lu_env *env,
901                           struct lfsck_instance *lfsck);
902
903 /* lfsck_striped_dir.c */
904 void lfsck_lmv_put(const struct lu_env *env, struct lfsck_lmv *llmv);
905 int lfsck_read_stripe_lmv(const struct lu_env *env, struct dt_object *obj,
906                           struct lmv_mds_md_v1 *lmv);
907 int lfsck_shard_name_to_index(const struct lu_env *env, const char *name,
908                               int namelen, __u16 type,
909                               const struct lu_fid *fid);
910 bool lfsck_is_valid_slave_name_entry(const struct lu_env *env,
911                                      struct lfsck_lmv *llmv,
912                                      const char *name, int namelen);
913 int lfsck_namespace_check_name(const struct lu_env *env,
914                                struct dt_object *parent,
915                                struct dt_object *child,
916                                const struct lu_name *cname);
917 int lfsck_namespace_verify_stripe_slave(const struct lu_env *env,
918                                         struct lfsck_component *com,
919                                         struct dt_object *obj,
920                                         struct lfsck_lmv *llmv);
921
922 /* lfsck_layout.c */
923 int lfsck_layout_setup(const struct lu_env *env, struct lfsck_instance *lfsck);
924
925 extern const char dot[];
926 extern const char dotdot[];
927 extern const char *lfsck_flags_names[];
928 extern const char *lfsck_param_names[];
929 extern struct lu_context_key lfsck_thread_key;
930
931 static inline bool name_is_dot_or_dotdot(const char *name, int namelen)
932 {
933         return name[0] == '.' &&
934                (namelen == 1 || (namelen == 2 && name[1] == '.'));
935 }
936
937 static inline struct dt_device *lfsck_obj2dt_dev(struct dt_object *obj)
938 {
939         return container_of0(obj->do_lu.lo_dev, struct dt_device, dd_lu_dev);
940 }
941
942 static inline struct lfsck_thread_info *
943 lfsck_env_info(const struct lu_env *env)
944 {
945         struct lfsck_thread_info *info;
946
947         info = lu_context_key_get(&env->le_ctx, &lfsck_thread_key);
948         LASSERT(info != NULL);
949         return info;
950 }
951
952 static inline const struct lu_name *
953 lfsck_name_get_const(const struct lu_env *env, const void *area, ssize_t len)
954 {
955         struct lu_name *lname;
956
957         lname = &lfsck_env_info(env)->lti_name_const;
958         lname->ln_name = area;
959         lname->ln_namelen = len;
960         return lname;
961 }
962
963 static inline void
964 lfsck_buf_init(struct lu_buf *buf, void *area, ssize_t len)
965 {
966         buf->lb_buf = area;
967         buf->lb_len = len;
968 }
969
970 static inline struct lu_buf *
971 lfsck_buf_get(const struct lu_env *env, void *area, ssize_t len)
972 {
973         struct lu_buf *buf;
974
975         buf = &lfsck_env_info(env)->lti_buf;
976         buf->lb_buf = area;
977         buf->lb_len = len;
978         return buf;
979 }
980
981 static inline const struct lu_buf *
982 lfsck_buf_get_const(const struct lu_env *env, const void *area, ssize_t len)
983 {
984         struct lu_buf *buf;
985
986         buf = &lfsck_env_info(env)->lti_buf;
987         buf->lb_buf = (void *)area;
988         buf->lb_len = len;
989         return buf;
990 }
991
992 static inline char *lfsck_lfsck2name(struct lfsck_instance *lfsck)
993 {
994         return lfsck->li_bottom->dd_lu_dev.ld_obd->obd_name;
995 }
996
997 static inline const struct lu_fid *lfsck_dto2fid(const struct dt_object *obj)
998 {
999         return lu_object_fid(&obj->do_lu);
1000 }
1001
1002 static inline void lfsck_pos_set_zero(struct lfsck_position *pos)
1003 {
1004         memset(pos, 0, sizeof(*pos));
1005 }
1006
1007 static inline int lfsck_pos_is_zero(const struct lfsck_position *pos)
1008 {
1009         return pos->lp_oit_cookie == 0 && fid_is_zero(&pos->lp_dir_parent);
1010 }
1011
1012 static inline int lfsck_pos_is_eq(const struct lfsck_position *pos1,
1013                                   const struct lfsck_position *pos2)
1014 {
1015         if (pos1->lp_oit_cookie < pos2->lp_oit_cookie)
1016                 return -1;
1017
1018         if (pos1->lp_oit_cookie > pos2->lp_oit_cookie)
1019                 return 1;
1020
1021         if (fid_is_zero(&pos1->lp_dir_parent) &&
1022             !fid_is_zero(&pos2->lp_dir_parent))
1023                 return -1;
1024
1025         if (!fid_is_zero(&pos1->lp_dir_parent) &&
1026             fid_is_zero(&pos2->lp_dir_parent))
1027                 return 1;
1028
1029         if (fid_is_zero(&pos1->lp_dir_parent) &&
1030             fid_is_zero(&pos2->lp_dir_parent))
1031                 return 0;
1032
1033         LASSERT(lu_fid_eq(&pos1->lp_dir_parent, &pos2->lp_dir_parent));
1034
1035         if (pos1->lp_dir_cookie < pos2->lp_dir_cookie)
1036                 return -1;
1037
1038         if (pos1->lp_dir_cookie > pos2->lp_dir_cookie)
1039                 return 1;
1040
1041         return 0;
1042 }
1043
1044 static void inline lfsck_position_le_to_cpu(struct lfsck_position *des,
1045                                             struct lfsck_position *src)
1046 {
1047         des->lp_oit_cookie = le64_to_cpu(src->lp_oit_cookie);
1048         fid_le_to_cpu(&des->lp_dir_parent, &src->lp_dir_parent);
1049         des->lp_dir_cookie = le64_to_cpu(src->lp_dir_cookie);
1050 }
1051
1052 static void inline lfsck_position_cpu_to_le(struct lfsck_position *des,
1053                                             struct lfsck_position *src)
1054 {
1055         des->lp_oit_cookie = cpu_to_le64(src->lp_oit_cookie);
1056         fid_cpu_to_le(&des->lp_dir_parent, &src->lp_dir_parent);
1057         des->lp_dir_cookie = cpu_to_le64(src->lp_dir_cookie);
1058 }
1059
1060 static inline umode_t lfsck_object_type(const struct dt_object *obj)
1061 {
1062         return lu_object_attr(&obj->do_lu);
1063 }
1064
1065 static inline int lfsck_is_dead_obj(const struct dt_object *obj)
1066 {
1067         struct lu_object_header *loh = obj->do_lu.lo_header;
1068
1069         return !!test_bit(LU_OBJECT_HEARD_BANSHEE, &loh->loh_flags);
1070 }
1071
1072 static inline struct dt_object *lfsck_object_get(struct dt_object *obj)
1073 {
1074         lu_object_get(&obj->do_lu);
1075         return obj;
1076 }
1077
1078 static inline void lfsck_object_put(const struct lu_env *env,
1079                                     struct dt_object *obj)
1080 {
1081         lu_object_put(env, &obj->do_lu);
1082 }
1083
1084 static inline u32 lfsck_dev_idx(struct dt_device *dev)
1085 {
1086         return dev->dd_lu_dev.ld_site->ld_seq_site->ss_node_id;
1087 }
1088
1089 static inline struct dt_object *
1090 lfsck_object_find_by_dev_nowait(const struct lu_env *env, struct dt_device *dev,
1091                                 const struct lu_fid *fid)
1092 {
1093         struct lu_object_conf   *conf = &lfsck_env_info(env)->lti_conf;
1094         struct dt_object        *obj;
1095
1096         conf->loc_flags = LOC_F_NOWAIT;
1097         obj = lu2dt(lu_object_find_slice(env, dt2lu_dev(dev), fid, conf));
1098         if (unlikely(obj == NULL))
1099                 return ERR_PTR(-ENOENT);
1100
1101         return obj;
1102 }
1103
1104 static inline struct dt_object *
1105 lfsck_object_find_by_dev(const struct lu_env *env, struct dt_device *dev,
1106                          const struct lu_fid *fid)
1107 {
1108         struct dt_object *obj;
1109
1110         obj = lu2dt(lu_object_find_slice(env, dt2lu_dev(dev), fid, NULL));
1111         if (unlikely(obj == NULL))
1112                 return ERR_PTR(-ENOENT);
1113
1114         return obj;
1115 }
1116
1117 static inline struct dt_object *lfsck_object_find(const struct lu_env *env,
1118                                                   struct lfsck_instance *lfsck,
1119                                                   const struct lu_fid *fid)
1120 {
1121         return lfsck_object_find_by_dev(env, lfsck->li_next, fid);
1122 }
1123
1124 static inline struct dt_object *
1125 lfsck_object_find_bottom(const struct lu_env *env, struct lfsck_instance *lfsck,
1126                          const struct lu_fid *fid)
1127 {
1128         struct dt_device *dev;
1129         int               idx;
1130
1131         idx = lfsck_find_mdt_idx_by_fid(env, lfsck, fid);
1132         if (idx < 0)
1133                 return ERR_PTR(idx);
1134
1135         if (idx == lfsck_dev_idx(lfsck->li_bottom)) {
1136                 dev = lfsck->li_bottom;
1137         } else {
1138                 struct lfsck_tgt_desc *ltd;
1139
1140                 ltd = LTD_TGT(&lfsck->li_mdt_descs, idx);
1141                 if (unlikely(ltd == NULL))
1142                         return ERR_PTR(-ENODEV);
1143
1144                 dev = ltd->ltd_tgt;
1145         }
1146
1147         return lfsck_object_find_by_dev(env, dev, fid);
1148 }
1149
1150 static inline struct lfsck_tgt_desc *lfsck_tgt_get(struct lfsck_tgt_descs *ltds,
1151                                                    __u32 index)
1152 {
1153         struct lfsck_tgt_desc *ltd;
1154
1155         ltd = LTD_TGT(ltds, index);
1156         if (ltd != NULL)
1157                 atomic_inc(&ltd->ltd_ref);
1158
1159         return ltd;
1160 }
1161
1162 static inline void lfsck_tgt_put(struct lfsck_tgt_desc *ltd)
1163 {
1164         if (atomic_dec_and_test(&ltd->ltd_ref))
1165                 OBD_FREE_PTR(ltd);
1166 }
1167
1168 static inline struct lfsck_component *
1169 lfsck_component_get(struct lfsck_component *com)
1170 {
1171         atomic_inc(&com->lc_ref);
1172
1173         return com;
1174 }
1175
1176 static inline void lfsck_component_put(const struct lu_env *env,
1177                                        struct lfsck_component *com)
1178 {
1179         if (atomic_dec_and_test(&com->lc_ref)) {
1180                 if (com->lc_obj != NULL)
1181                         lu_object_put_nocache(env, &com->lc_obj->do_lu);
1182                 if (com->lc_file_ram != NULL)
1183                         OBD_FREE(com->lc_file_ram, com->lc_file_size);
1184                 if (com->lc_file_disk != NULL)
1185                         OBD_FREE(com->lc_file_disk, com->lc_file_size);
1186                 if (com->lc_data != NULL) {
1187                         LASSERT(com->lc_ops->lfsck_data_release != NULL);
1188
1189                         com->lc_ops->lfsck_data_release(env, com);
1190                 }
1191
1192                 OBD_FREE_PTR(com);
1193         }
1194 }
1195
1196 static inline struct lfsck_instance *
1197 lfsck_instance_get(struct lfsck_instance *lfsck)
1198 {
1199         atomic_inc(&lfsck->li_ref);
1200
1201         return lfsck;
1202 }
1203
1204 static inline void lfsck_instance_put(const struct lu_env *env,
1205                                       struct lfsck_instance *lfsck)
1206 {
1207         if (atomic_dec_and_test(&lfsck->li_ref))
1208                 lfsck_instance_cleanup(env, lfsck);
1209 }
1210
1211 static inline bool lfsck_phase2_next_ready(struct lfsck_assistant_data *lad)
1212 {
1213         return list_empty(&lad->lad_mdt_phase1_list) &&
1214                (!list_empty(&lad->lad_ost_phase2_list) ||
1215                 list_empty(&lad->lad_ost_phase1_list));
1216 }
1217
1218 static inline void lfsck_lad_set_bitmap(const struct lu_env *env,
1219                                         struct lfsck_component *com,
1220                                         __u32 index)
1221 {
1222         struct lfsck_assistant_data     *lad    = com->lc_data;
1223         cfs_bitmap_t                    *bitmap = lad->lad_bitmap;
1224
1225         LASSERT(com->lc_lfsck->li_master);
1226         LASSERT(bitmap != NULL);
1227
1228         if (likely(bitmap->size > index)) {
1229                 cfs_bitmap_set(bitmap, index);
1230                 lad->lad_incomplete = 1;
1231         } else if (com->lc_type == LFSCK_TYPE_NAMESPACE) {
1232                 struct lfsck_namespace *ns = com->lc_file_ram;
1233
1234                 ns->ln_flags |= LF_INCOMPLETE;
1235         }
1236 }
1237
1238 static inline int lfsck_links_read(const struct lu_env *env,
1239                                    struct dt_object *obj,
1240                                    struct linkea_data *ldata)
1241 {
1242         ldata->ld_buf =
1243                 lu_buf_check_and_alloc(&lfsck_env_info(env)->lti_linkea_buf,
1244                                        PAGE_CACHE_SIZE);
1245
1246         return __lfsck_links_read(env, obj, ldata);
1247 }
1248
1249 static inline int lfsck_links_read2(const struct lu_env *env,
1250                                     struct dt_object *obj,
1251                                     struct linkea_data *ldata)
1252 {
1253         ldata->ld_buf =
1254                 lu_buf_check_and_alloc(&lfsck_env_info(env)->lti_linkea_buf2,
1255                                        PAGE_CACHE_SIZE);
1256
1257         return __lfsck_links_read(env, obj, ldata);
1258 }
1259
1260 static inline struct lfsck_lmv *lfsck_lmv_get(struct lfsck_lmv *llmv)
1261 {
1262         if (llmv != NULL)
1263                 atomic_inc(&llmv->ll_ref);
1264
1265         return llmv;
1266 }
1267
1268 static inline void lfsck_lmv_header_le_to_cpu(struct lmv_mds_md_v1 *dst,
1269                                               const struct lmv_mds_md_v1 *src)
1270 {
1271         dst->lmv_magic = le32_to_cpu(src->lmv_magic);
1272         dst->lmv_stripe_count = le32_to_cpu(src->lmv_stripe_count);
1273         dst->lmv_master_mdt_index = le32_to_cpu(src->lmv_master_mdt_index);
1274         dst->lmv_hash_type = le32_to_cpu(src->lmv_hash_type);
1275         dst->lmv_layout_version = le32_to_cpu(src->lmv_layout_version);
1276 }
1277
1278 static inline void lfsck_lmv_header_cpu_to_le(struct lmv_mds_md_v1 *dst,
1279                                               const struct lmv_mds_md_v1 *src)
1280 {
1281         dst->lmv_magic = cpu_to_le32(src->lmv_magic);
1282         dst->lmv_stripe_count = cpu_to_le32(src->lmv_stripe_count);
1283         dst->lmv_master_mdt_index = cpu_to_le32(src->lmv_master_mdt_index);
1284         dst->lmv_hash_type = cpu_to_le32(src->lmv_hash_type);
1285         dst->lmv_layout_version = cpu_to_le32(src->lmv_layout_version);
1286 }
1287 #endif /* _LFSCK_INTERNAL_H */