Whamcloud - gitweb
LU-8837 utils: move lustre_disk_data back to lustre_disk.h
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_disk.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, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2011, 2016, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  *
31  * Lustre disk format definitions.
32  *
33  * Author: Nathan Rutman <nathan.rutman@seagate.com>
34  */
35
36 #ifndef _UAPI_LUSTRE_DISK_H
37 #define _UAPI_LUSTRE_DISK_H
38
39 /** \defgroup disk disk
40  *
41  * @{
42  */
43 #include <linux/types.h>
44
45 /****************** on-disk files ********************/
46
47 #define MDT_LOGS_DIR            "LOGS"  /* COMPAT_146 */
48 #define MOUNT_CONFIGS_DIR       "CONFIGS"
49 #define CONFIGS_FILE            "mountdata"
50 /** Persistent mount data are stored on the disk in this file. */
51 #define MOUNT_DATA_FILE         MOUNT_CONFIGS_DIR"/"CONFIGS_FILE
52 #define LAST_RCVD               "last_rcvd"
53 #define REPLY_DATA              "reply_data"
54 #define LOV_OBJID               "lov_objid"
55 #define LOV_OBJSEQ              "lov_objseq"
56 #define HEALTH_CHECK            "health_check"
57 #define CAPA_KEYS               "capa_keys"
58 #define CHANGELOG_USERS         "changelog_users"
59 #define MGS_NIDTBL_DIR          "NIDTBL_VERSIONS"
60 #define QMT_DIR                 "quota_master"
61 #define QSD_DIR                 "quota_slave"
62 #define QSD_DIR_DT              "quota_slave_dt"
63 #define QSD_DIR_MD              "quota_slave_md"
64 #define HSM_ACTIONS             "hsm_actions"
65 #define LFSCK_DIR               "LFSCK"
66 #define LFSCK_BOOKMARK          "lfsck_bookmark"
67 #define LFSCK_LAYOUT            "lfsck_layout"
68 #define LFSCK_NAMESPACE         "lfsck_namespace"
69 #define REMOTE_PARENT_DIR       "REMOTE_PARENT_DIR"
70 #define INDEX_BACKUP_DIR        "index_backup"
71 #define MDT_ORPHAN_DIR          "PENDING"
72
73 /* On-disk configuration file. In host-endian order. */
74 struct lustre_disk_data {
75         __u32 ldd_magic;
76         __u32 ldd_feature_compat;       /* compatible feature flags */
77         __u32 ldd_feature_rocompat;     /* read-only compatible feature flags */
78         __u32 ldd_feature_incompat;     /* incompatible feature flags */
79
80         __u32 ldd_config_ver;           /* config rewrite count - not used */
81         __u32 ldd_flags;                /* LDD_SV_TYPE */
82         __u32 ldd_svindex;              /* server index (0001), must match
83                                          * svname
84                                          */
85         __u32 ldd_mount_type;           /* target fs type LDD_MT_* */
86         char  ldd_fsname[64];           /* filesystem this server is part of,
87                                          * MTI_NAME_MAXLEN
88                                          */
89         char  ldd_svname[64];           /* this server's name (lustre-mdt0001)*/
90         __u8  ldd_uuid[40];             /* server UUID (COMPAT_146) */
91
92         char  ldd_userdata[1024 - 200]; /* arbitrary user string '200' */
93         __u8  ldd_padding[4096 - 1024]; /* 1024 */
94         char  ldd_mount_opts[4096];     /* target fs mount opts '4096' */
95         char  ldd_params[4096];         /* key=value pairs '8192' */
96 };
97
98 /****************** persistent mount data *********************/
99
100 #define LDD_F_SV_TYPE_MDT       0x0001
101 #define LDD_F_SV_TYPE_OST       0x0002
102 #define LDD_F_SV_TYPE_MGS       0x0004
103 #define LDD_F_SV_TYPE_MASK      (LDD_F_SV_TYPE_MDT  | \
104                                  LDD_F_SV_TYPE_OST  | \
105                                  LDD_F_SV_TYPE_MGS)
106 #define LDD_F_SV_ALL            0x0008
107 /** need an index assignment */
108 #define LDD_F_NEED_INDEX        0x0010
109 /** never registered */
110 #define LDD_F_VIRGIN            0x0020
111 /** update the config logs for this server */
112 #define LDD_F_UPDATE            0x0040
113 /** rewrite the LDD */
114 #define LDD_F_REWRITE_LDD       0x0080
115 /** regenerate config logs for this fs or server */
116 #define LDD_F_WRITECONF         0x0100
117 /** COMPAT_14 */
118 /*#define LDD_F_UPGRADE14               0x0200 deprecated since 1.8 */
119 /** process as lctl conf_param */
120 #define LDD_F_PARAM             0x0400
121 /** all nodes are specified as service nodes */
122 #define LDD_F_NO_PRIMNODE       0x1000
123 /** IR enable flag */
124 #define LDD_F_IR_CAPABLE        0x2000
125 /** the MGS refused to register the target. */
126 #define LDD_F_ERROR             0x4000
127 /** process at lctl conf_param */
128 #define LDD_F_PARAM2            0x8000
129 /** the target shouldn't use local logs */
130 #define LDD_F_NO_LOCAL_LOGS     0x10000
131
132 #define LDD_MAGIC 0x1dd00001
133
134 #define XATTR_TARGET_RENAME "trusted.rename_tgt"
135
136 enum ldd_mount_type {
137         LDD_MT_EXT3 = 0,
138         LDD_MT_LDISKFS,
139         LDD_MT_SMFS,
140         LDD_MT_REISERFS,
141         LDD_MT_LDISKFS2,
142         LDD_MT_ZFS,
143         LDD_MT_LAST
144 };
145
146 /****************** last_rcvd file *********************/
147
148 #define LR_EXPIRE_INTERVALS 16  /**< number of intervals to track transno */
149 #define LR_SERVER_SIZE  512
150 #define LR_CLIENT_START 8192
151 #define LR_CLIENT_SIZE  128
152 #if LR_CLIENT_START < LR_SERVER_SIZE
153 #error "Can't have LR_CLIENT_START < LR_SERVER_SIZE"
154 #endif
155
156 /*
157  * Data stored per server at the head of the last_rcvd file. In le32 order.
158  */
159 struct lr_server_data {
160         __u8  lsd_uuid[40];        /* server UUID */
161         __u64 lsd_last_transno;    /* last completed transaction ID */
162         __u64 lsd_compat14;        /* reserved - compat with old last_rcvd */
163         __u64 lsd_mount_count;     /* incarnation number */
164         __u32 lsd_feature_compat;  /* compatible feature flags */
165         __u32 lsd_feature_rocompat;/* read-only compatible feature flags */
166         __u32 lsd_feature_incompat;/* incompatible feature flags */
167         __u32 lsd_server_size;     /* size of server data area */
168         __u32 lsd_client_start;    /* start of per-client data area */
169         __u16 lsd_client_size;     /* size of per-client data area */
170         __u16 lsd_subdir_count;    /* number of subdirectories for objects */
171         __u64 lsd_catalog_oid;     /* recovery catalog object id */
172         __u32 lsd_catalog_ogen;    /* recovery catalog inode generation */
173         __u8  lsd_peeruuid[40];    /* UUID of MDS associated with this OST */
174         __u32 lsd_osd_index;       /* index number of OST in LOV */
175         __u32 lsd_padding1;        /* was lsd_mdt_index, unused in 2.4.0 */
176         __u32 lsd_start_epoch;     /* VBR: start epoch from last boot */
177         /** transaction values since lsd_trans_table_time */
178         __u64 lsd_trans_table[LR_EXPIRE_INTERVALS];
179         /** start point of transno table below */
180         __u32 lsd_trans_table_time; /* time of first slot in table above */
181         __u32 lsd_expire_intervals; /* LR_EXPIRE_INTERVALS */
182         __u8  lsd_padding[LR_SERVER_SIZE - 288];
183 };
184
185 /* Data stored per client in the last_rcvd file. In le32 order. */
186 struct lsd_client_data {
187         __u8  lcd_uuid[40];             /* client UUID */
188         __u64 lcd_last_transno;         /* last completed transaction ID */
189         __u64 lcd_last_xid;             /* xid for the last transaction */
190         __u32 lcd_last_result;          /* result from last RPC */
191         __u32 lcd_last_data;            /* per-op data (disposition for
192                                          * open &c.)
193                                          */
194         /* for MDS_CLOSE requests */
195         __u64 lcd_last_close_transno;   /* last completed transaction ID */
196         __u64 lcd_last_close_xid;       /* xid for the last transaction */
197         __u32 lcd_last_close_result;    /* result from last RPC */
198         __u32 lcd_last_close_data;      /* per-op data */
199         /* VBR: last versions */
200         __u64 lcd_pre_versions[4];
201         __u32 lcd_last_epoch;
202         /* generation counter of client slot in last_rcvd */
203         __u32 lcd_generation;
204         __u8  lcd_padding[LR_CLIENT_SIZE - 128];
205 };
206
207 /* Data stored in each slot of the reply_data file.
208  *
209  * The lrd_client_gen field is assigned with lcd_generation value
210  * to allow identify which client the reply data belongs to.
211  */
212 struct lsd_reply_data {
213         __u64 lrd_transno;      /* transaction number */
214         __u64 lrd_xid;          /* transmission id */
215         __u64 lrd_data;         /* per-operation data */
216         __u32 lrd_result;       /* request result */
217         __u32 lrd_client_gen;   /* client generation */
218 };
219
220 /* Header of the reply_data file */
221 #define LRH_MAGIC 0xbdabda01
222 struct lsd_reply_header {
223         __u32   lrh_magic;
224         __u32   lrh_header_size;
225         __u32   lrh_reply_size;
226         __u8    lrh_pad[sizeof(struct lsd_reply_data) - 12];
227 };
228
229 /** @} disk */
230
231 #endif /* _UAPI_LUSTRE_DISK_H */