Whamcloud - gitweb
LU-957 lfsck: LFSCK main engine
[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 Whamcloud, Inc.
24  */
25 /*
26  * lustre/include/lustre/lustre_lfsck_user.h
27  *
28  * Lustre LFSCK userspace interfaces.
29  *
30  * Author: Fan Yong <yong.fan@whamcloud.com>
31  */
32
33 #ifndef _LUSTRE_LFSCK_USER_H
34 # define _LUSTRE_LFSCK_USER_H
35
36 enum lfsck_param_flags {
37         /* Reset LFSCK iterator position to the device beginning. */
38         LPF_RESET       = 0x0001,
39
40         /* Exit when fail. */
41         LPF_FAILOUT     = 0x0002,
42
43         /* Dryrun mode, only check without modification */
44         LPF_DRYRUN      = 0x0004,
45 };
46
47 enum lfsck_method {
48         /* Object table based iteration, depends on backend filesystem.
49          * For ldiskfs, it is inode table based iteration. */
50         LM_OTABLE       = 1,
51
52         /* Namespace based scanning. NOT support yet. */
53         LM_NAMESPACE    = 2,
54 };
55
56 enum lfsck_type {
57         /* For MDT-OST consistency check/repair. */
58         LT_LAYOUT       = 0x0001,
59
60         /* For MDT-MDT consistency check/repair. */
61         LT_DNE          = 0x0002,
62 };
63
64 #define LFSCK_VERSION_V1        10
65
66 #define LFSCK_TYPES_ALL         ((__u16)(~0))
67 #define LFSCK_TYPES_DEF         ((__u16)0)
68
69 #define LFSCK_SPEED_NO_LIMIT    0
70 #define LFSCK_SPEED_LIMIT_DEF   LFSCK_SPEED_NO_LIMIT
71
72 enum lfsck_start_valid {
73         LSV_SPEED_LIMIT         = 0x00000001,
74         LSV_METHOD              = 0x00000002,
75         LSV_ERROR_HANDLE        = 0x00000004,
76         LSV_DRYRUN              = 0x00000008,
77 };
78
79 /* Arguments for starting lfsck. */
80 struct lfsck_start {
81         /* Which arguments are valid, see 'enum lfsck_start_valid'. */
82         __u32   ls_valid;
83
84         /* For compatibility between user space tools and kernel service. */
85         __u16   ls_version;
86
87         /* Which LFSCK components to be (have been) started. */
88         __u16   ls_active;
89
90         /* Flags for the LFSCK, see 'enum lfsck_param_flags'. */
91         __u16   ls_flags;
92
93         /* Object iteration method, see 'enum lfsck_method'. */
94         __u16   ls_method;
95
96         /* How many items can be scanned at most per second. */
97         __u32   ls_speed_limit;
98 };
99
100 #endif /* _LUSTRE_LFSCK_USER_H */