Whamcloud - gitweb
LU-4887 lfsck: run all LFSCK scan types by default
[fs/lustre-release.git] / lustre / include / lustre / lustre_lfsck_user.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) 2012, 2013, Intel Corporation.
24  */
25 /*
26  * lustre/include/lustre/lustre_lfsck_user.h
27  *
28  * Lustre LFSCK userspace interfaces.
29  *
30  * Author: Fan, Yong <fan.yong@intel.com>
31  */
32
33 #ifndef _LUSTRE_LFSCK_USER_H
34 # define _LUSTRE_LFSCK_USER_H
35 # include <lustre/lustre_user.h>
36
37 enum lfsck_param_flags {
38         /* Reset LFSCK iterator position to the device beginning. */
39         LPF_RESET               = 0x0001,
40
41         /* Exit when fail. */
42         LPF_FAILOUT             = 0x0002,
43
44         /* Dryrun mode, only check without modification */
45         LPF_DRYRUN              = 0x0004,
46
47         /* LFSCK runs on all targets. */
48         LPF_ALL_TGT             = 0x0008,
49
50         /* Broadcast the command to other MDTs. Only valid on the sponsor MDT */
51         LPF_BROADCAST           = 0x0010,
52
53         /* Handle orphan objects. */
54         LPF_ORPHAN              = 0x0020,
55
56         /* Create OST-object for dangling LOV EA. */
57         LPF_CREATE_OSTOBJ       = 0x0040,
58 };
59
60 enum lfsck_type {
61         /* For MDT and OST internal OSD consistency check/repair. */
62         LFSCK_TYPE_SCRUB        = 0x0000,
63
64         /* For MDT-OST (layout, object) consistency check/repair. */
65         LFSCK_TYPE_LAYOUT       = 0x0001,
66
67         /* For MDT-MDT (remote object) consistency check/repair. */
68         LFSCK_TYPE_DNE          = 0x0002,
69
70         /* For MDT (FID-in-dirent, linkEA) consistency check/repair. */
71         LFSCK_TYPE_NAMESPACE    = 0x0004,
72         LFSCK_TYPES_SUPPORTED   = (LFSCK_TYPE_SCRUB | LFSCK_TYPE_LAYOUT |
73                                    LFSCK_TYPE_NAMESPACE),
74         LFSCK_TYPES_DEF         = LFSCK_TYPES_SUPPORTED,
75         LFSCK_TYPES_ALL         = ((__u16)(~0))
76 };
77
78 #define LFSCK_VERSION_V1        1
79 #define LFSCK_VERSION_V2        2
80
81 #define LFSCK_SPEED_NO_LIMIT    0
82 #define LFSCK_SPEED_LIMIT_DEF   LFSCK_SPEED_NO_LIMIT
83 #define LFSCK_ASYNC_WIN_DEFAULT 1024
84 #define LFSCK_ASYNC_WIN_MAX     ((__u16)(~0))
85
86 enum lfsck_start_valid {
87         LSV_SPEED_LIMIT         = 0x00000001,
88         LSV_ERROR_HANDLE        = 0x00000002,
89         LSV_DRYRUN              = 0x00000004,
90         LSV_ASYNC_WINDOWS       = 0x00000008,
91         LSV_CREATE_OSTOBJ       = 0x00000010,
92 };
93
94 /* Arguments for starting lfsck. */
95 struct lfsck_start {
96         /* Which arguments are valid, see 'enum lfsck_start_valid'. */
97         __u32   ls_valid;
98
99         /* How many items can be scanned at most per second. */
100         __u32   ls_speed_limit;
101
102         /* For compatibility between user space tools and kernel service. */
103         __u16   ls_version;
104
105         /* Which LFSCK components to be (have been) started. */
106         __u16   ls_active;
107
108         /* Flags for the LFSCK, see 'enum lfsck_param_flags'. */
109         __u16   ls_flags;
110
111         /* The windows size for async requests pipeline. */
112         __u16   ls_async_windows;
113 };
114
115 struct lfsck_stop {
116         __u32   ls_status;
117         __u16   ls_flags;
118         __u16   ls_padding_1; /* For 64-bits aligned. */
119         __u64   ls_padding_2;
120 };
121
122 #endif /* _LUSTRE_LFSCK_USER_H */