Whamcloud - gitweb
85654411712a6ea405e72ef261b9eeb21598e790
[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  * Lustre is a trademark of Sun Microsystems, Inc.
31  *
32  * uapi/linux/lustre_disk.h
33  *
34  * Lustre disk format definitions.
35  *
36  * Author: Nathan Rutman <nathan.rutman@seagate.com>
37  */
38
39 #ifndef _UAPI_LUSTRE_DISK_H
40 #define _UAPI_LUSTRE_DISK_H
41
42 /** \defgroup disk disk
43  *
44  * @{
45  */
46 #include <linux/types.h>
47
48 /****************** on-disk files ********************/
49
50 #define MDT_LOGS_DIR            "LOGS"  /* COMPAT_146 */
51 #define MOUNT_CONFIGS_DIR       "CONFIGS"
52 #define CONFIGS_FILE            "mountdata"
53 /** Persistent mount data are stored on the disk in this file. */
54 #define MOUNT_DATA_FILE         MOUNT_CONFIGS_DIR"/"CONFIGS_FILE
55 #define LAST_RCVD               "last_rcvd"
56 #define REPLY_DATA              "reply_data"
57 #define LOV_OBJID               "lov_objid"
58 #define LOV_OBJSEQ              "lov_objseq"
59 #define HEALTH_CHECK            "health_check"
60 #define CAPA_KEYS               "capa_keys"
61 #define CHANGELOG_USERS         "changelog_users"
62 #define MGS_NIDTBL_DIR          "NIDTBL_VERSIONS"
63 #define QMT_DIR                 "quota_master"
64 #define QSD_DIR                 "quota_slave"
65 #define QSD_DIR_DT              "quota_slave_dt"
66 #define QSD_DIR_MD              "quota_slave_md"
67 #define HSM_ACTIONS             "hsm_actions"
68 #define LFSCK_DIR               "LFSCK"
69 #define LFSCK_BOOKMARK          "lfsck_bookmark"
70 #define LFSCK_LAYOUT            "lfsck_layout"
71 #define LFSCK_NAMESPACE         "lfsck_namespace"
72 #define REMOTE_PARENT_DIR       "REMOTE_PARENT_DIR"
73 #define INDEX_BACKUP_DIR        "index_backup"
74 #define MDT_ORPHAN_DIR          "PENDING"
75
76 /****************** persistent mount data *********************/
77
78 #define LDD_F_SV_TYPE_MDT       0x0001
79 #define LDD_F_SV_TYPE_OST       0x0002
80 #define LDD_F_SV_TYPE_MGS       0x0004
81 #define LDD_F_SV_TYPE_MASK      (LDD_F_SV_TYPE_MDT  | \
82                                  LDD_F_SV_TYPE_OST  | \
83                                  LDD_F_SV_TYPE_MGS)
84 #define LDD_F_SV_ALL            0x0008
85 /** need an index assignment */
86 #define LDD_F_NEED_INDEX        0x0010
87 /** never registered */
88 #define LDD_F_VIRGIN            0x0020
89 /** update the config logs for this server */
90 #define LDD_F_UPDATE            0x0040
91 /** rewrite the LDD */
92 #define LDD_F_REWRITE_LDD       0x0080
93 /** regenerate config logs for this fs or server */
94 #define LDD_F_WRITECONF         0x0100
95 /** COMPAT_14 */
96 /*#define LDD_F_UPGRADE14               0x0200 deprecated since 1.8 */
97 /** process as lctl conf_param */
98 #define LDD_F_PARAM             0x0400
99 /** all nodes are specified as service nodes */
100 #define LDD_F_NO_PRIMNODE       0x1000
101 /** IR enable flag */
102 #define LDD_F_IR_CAPABLE        0x2000
103 /** the MGS refused to register the target. */
104 #define LDD_F_ERROR             0x4000
105 /** process at lctl conf_param */
106 #define LDD_F_PARAM2            0x8000
107
108 #define LDD_MAGIC 0x1dd00001
109
110 #define XATTR_TARGET_RENAME "trusted.rename_tgt"
111
112 enum ldd_mount_type {
113         LDD_MT_EXT3 = 0,
114         LDD_MT_LDISKFS,
115         LDD_MT_SMFS,
116         LDD_MT_REISERFS,
117         LDD_MT_LDISKFS2,
118         LDD_MT_ZFS,
119         LDD_MT_LAST
120 };
121
122 /****************** last_rcvd file *********************/
123
124 #define LR_EXPIRE_INTERVALS 16  /**< number of intervals to track transno */
125 #define LR_SERVER_SIZE  512
126 #define LR_CLIENT_START 8192
127 #define LR_CLIENT_SIZE  128
128 #if LR_CLIENT_START < LR_SERVER_SIZE
129 #error "Can't have LR_CLIENT_START < LR_SERVER_SIZE"
130 #endif
131
132 /*
133  * Data stored per server at the head of the last_rcvd file. In le32 order.
134  */
135 struct lr_server_data {
136         __u8  lsd_uuid[40];        /* server UUID */
137         __u64 lsd_last_transno;    /* last completed transaction ID */
138         __u64 lsd_compat14;        /* reserved - compat with old last_rcvd */
139         __u64 lsd_mount_count;     /* incarnation number */
140         __u32 lsd_feature_compat;  /* compatible feature flags */
141         __u32 lsd_feature_rocompat;/* read-only compatible feature flags */
142         __u32 lsd_feature_incompat;/* incompatible feature flags */
143         __u32 lsd_server_size;     /* size of server data area */
144         __u32 lsd_client_start;    /* start of per-client data area */
145         __u16 lsd_client_size;     /* size of per-client data area */
146         __u16 lsd_subdir_count;    /* number of subdirectories for objects */
147         __u64 lsd_catalog_oid;     /* recovery catalog object id */
148         __u32 lsd_catalog_ogen;    /* recovery catalog inode generation */
149         __u8  lsd_peeruuid[40];    /* UUID of MDS associated with this OST */
150         __u32 lsd_osd_index;       /* index number of OST in LOV */
151         __u32 lsd_padding1;        /* was lsd_mdt_index, unused in 2.4.0 */
152         __u32 lsd_start_epoch;     /* VBR: start epoch from last boot */
153         /** transaction values since lsd_trans_table_time */
154         __u64 lsd_trans_table[LR_EXPIRE_INTERVALS];
155         /** start point of transno table below */
156         __u32 lsd_trans_table_time; /* time of first slot in table above */
157         __u32 lsd_expire_intervals; /* LR_EXPIRE_INTERVALS */
158         __u8  lsd_padding[LR_SERVER_SIZE - 288];
159 };
160
161 /* Data stored per client in the last_rcvd file. In le32 order. */
162 struct lsd_client_data {
163         __u8  lcd_uuid[40];             /* client UUID */
164         __u64 lcd_last_transno;         /* last completed transaction ID */
165         __u64 lcd_last_xid;             /* xid for the last transaction */
166         __u32 lcd_last_result;          /* result from last RPC */
167         __u32 lcd_last_data;            /* per-op data (disposition for
168                                          * open &c.)
169                                          */
170         /* for MDS_CLOSE requests */
171         __u64 lcd_last_close_transno;   /* last completed transaction ID */
172         __u64 lcd_last_close_xid;       /* xid for the last transaction */
173         __u32 lcd_last_close_result;    /* result from last RPC */
174         __u32 lcd_last_close_data;      /* per-op data */
175         /* VBR: last versions */
176         __u64 lcd_pre_versions[4];
177         __u32 lcd_last_epoch;
178         /* generation counter of client slot in last_rcvd */
179         __u32 lcd_generation;
180         __u8  lcd_padding[LR_CLIENT_SIZE - 128];
181 };
182
183 /* Data stored in each slot of the reply_data file.
184  *
185  * The lrd_client_gen field is assigned with lcd_generation value
186  * to allow identify which client the reply data belongs to.
187  */
188 struct lsd_reply_data {
189         __u64 lrd_transno;      /* transaction number */
190         __u64 lrd_xid;          /* transmission id */
191         __u64 lrd_data;         /* per-operation data */
192         __u32 lrd_result;       /* request result */
193         __u32 lrd_client_gen;   /* client generation */
194 };
195
196 /* Header of the reply_data file */
197 #define LRH_MAGIC 0xbdabda01
198 struct lsd_reply_header {
199         __u32   lrh_magic;
200         __u32   lrh_header_size;
201         __u32   lrh_reply_size;
202         __u8    lrh_pad[sizeof(struct lsd_reply_data) - 12];
203 };
204
205 /** @} disk */
206
207 #endif /* _UAPI_LUSTRE_DISK_H */