Whamcloud - gitweb
LU-819 utils: Fix lfs getstripe -M
[fs/lustre-release.git] / lustre / include / lustre_disk.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
31  *
32  * Copyright (c) 2011 Whamcloud, Inc.
33  *
34  */
35 /*
36  * This file is part of Lustre, http://www.lustre.org/
37  * Lustre is a trademark of Sun Microsystems, Inc.
38  *
39  * lustre/include/lustre_disk.h
40  *
41  * Lustre disk format definitions.
42  *
43  * Author: Nathan Rutman <nathan@clusterfs.com>
44  */
45
46 #ifndef _LUSTRE_DISK_H
47 #define _LUSTRE_DISK_H
48
49 /** \defgroup disk disk
50  *
51  * @{
52  */
53
54 #include <libcfs/libcfs.h>
55 #include <lnet/types.h>
56
57 /****************** on-disk files *********************/
58
59 #define MDT_LOGS_DIR      "LOGS"  /* COMPAT_146 */
60 #define MOUNT_CONFIGS_DIR "CONFIGS"
61 #define CONFIGS_FILE      "mountdata"
62 /** Persistent mount data are stored on the disk in this file. */
63 #define MOUNT_DATA_FILE    MOUNT_CONFIGS_DIR"/"CONFIGS_FILE
64 #define LAST_RCVD         "last_rcvd"
65 #define LOV_OBJID         "lov_objid"
66 #define HEALTH_CHECK      "health_check"
67 #define CAPA_KEYS         "capa_keys"
68 #define CHANGELOG_USERS   "changelog_users"
69 #define MGS_NIDTBL_DIR    "NIDTBL_VERSIONS"
70
71
72 /****************** persistent mount data *********************/
73
74 #define LDD_F_SV_TYPE_MDT   0x0001
75 #define LDD_F_SV_TYPE_OST   0x0002
76 #define LDD_F_SV_TYPE_MGS   0x0004
77 #define LDD_F_SV_TYPE_MASK (LDD_F_SV_TYPE_MDT  | \
78                             LDD_F_SV_TYPE_OST  | \
79                             LDD_F_SV_TYPE_MGS)
80 #define LDD_F_SV_ALL        0x0008
81 /** need an index assignment */
82 #define LDD_F_NEED_INDEX    0x0010
83 /** never registered */
84 #define LDD_F_VIRGIN        0x0020
85 /** update the config logs for this server */
86 #define LDD_F_UPDATE        0x0040
87 /** rewrite the LDD */
88 #define LDD_F_REWRITE_LDD   0x0080
89 /** regenerate config logs for this fs or server */
90 #define LDD_F_WRITECONF     0x0100
91 /** COMPAT_14 */
92 #define LDD_F_UPGRADE14     0x0200
93 /** process as lctl conf_param */
94 #define LDD_F_PARAM         0x0400
95 /** backend fs make use of IAM directory format. */
96 #define LDD_F_IAM_DIR       0x0800
97 /** all nodes are specified as service nodes */
98 #define LDD_F_NO_PRIMNODE   0x1000
99 /** IR enable flag */
100 #define LDD_F_IR_CAPABLE    0x2000
101 /** the MGS refused to register the target. */
102 #define LDD_F_ERROR         0x4000
103
104 /* opc for target register */
105 #define LDD_F_OPC_REG   0x10000000
106 #define LDD_F_OPC_UNREG 0x20000000
107 #define LDD_F_OPC_READY 0x40000000
108 #define LDD_F_OPC_MASK  0xf0000000
109
110 #define LDD_F_ONDISK_MASK  (LDD_F_SV_TYPE_MASK | LDD_F_IAM_DIR)
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_LAST
119 };
120
121 static inline char *mt_str(enum ldd_mount_type mt)
122 {
123         static char *mount_type_string[] = {
124                 "ext3",
125                 "ldiskfs",
126                 "smfs",
127                 "reiserfs",
128                 "ldiskfs2"
129         };
130         return mount_type_string[mt];
131 }
132
133 #define LDD_INCOMPAT_SUPP 0
134 #define LDD_ROCOMPAT_SUPP 0
135
136 #define LDD_MAGIC 0x1dd00001
137
138 /* On-disk configuration file. In host-endian order. */
139 struct lustre_disk_data {
140         __u32      ldd_magic;
141         __u32      ldd_feature_compat;  /* compatible feature flags */
142         __u32      ldd_feature_rocompat;/* read-only compatible feature flags */
143         __u32      ldd_feature_incompat;/* incompatible feature flags */
144
145         __u32      ldd_config_ver;      /* config rewrite count - not used */
146         __u32      ldd_flags;           /* LDD_SV_TYPE */
147         __u32      ldd_svindex;         /* server index (0001), must match
148                                            svname */
149         __u32      ldd_mount_type;      /* target fs type LDD_MT_* */
150         char       ldd_fsname[64];      /* filesystem this server is part of,
151                                            MTI_NAME_MAXLEN */
152         char       ldd_svname[64];      /* this server's name (lustre-mdt0001)*/
153         __u8       ldd_uuid[40];        /* server UUID (COMPAT_146) */
154
155 /*200*/ char       ldd_userdata[1024 - 200]; /* arbitrary user string */
156 /*1024*/__u8       ldd_padding[4096 - 1024];
157 /*4096*/char       ldd_mount_opts[4096]; /* target fs mount opts */
158 /*8192*/char       ldd_params[4096];     /* key=value pairs */
159 };
160
161 #define IS_MDT(data)   ((data)->ldd_flags & LDD_F_SV_TYPE_MDT)
162 #define IS_OST(data)   ((data)->ldd_flags & LDD_F_SV_TYPE_OST)
163 #define IS_MGS(data)  ((data)->ldd_flags & LDD_F_SV_TYPE_MGS)
164 #define MT_STR(data)   mt_str((data)->ldd_mount_type)
165
166 /* Make the mdt/ost server obd name based on the filesystem name */
167 static inline int server_make_name(__u32 flags, __u16 index, char *fs,
168                                    char *name)
169 {
170         if (flags & (LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST)) {
171                 if (!(flags & LDD_F_SV_ALL))
172                         sprintf(name, "%.8s-%s%04x", fs,
173                                 (flags & LDD_F_SV_TYPE_MDT) ? "MDT" : "OST",
174                                 index);
175         } else if (flags & LDD_F_SV_TYPE_MGS) {
176                 sprintf(name, "MGS");
177         } else {
178                 CERROR("unknown server type %#x\n", flags);
179                 return 1;
180         }
181         return 0;
182 }
183
184 /* Get the index from the obd name */
185 int server_name2index(char *svname, __u32 *idx, char **endptr);
186
187
188 /****************** mount command *********************/
189
190 /* The lmd is only used internally by Lustre; mount simply passes
191    everything as string options */
192
193 #define LMD_MAGIC    0xbdacbd03
194
195 /* gleaned from the mount command - no persistent info here */
196 struct lustre_mount_data {
197         __u32      lmd_magic;
198         __u32      lmd_flags;         /* lustre mount flags */
199         int        lmd_mgs_failnodes; /* mgs failover node count */
200         int        lmd_exclude_count;
201         int        lmd_recovery_time_soft;
202         int        lmd_recovery_time_hard;
203         char      *lmd_dev;           /* device name */
204         char      *lmd_profile;       /* client only */
205         char      *lmd_mgssec;        /* sptlrpc flavor to mgs */
206         char      *lmd_opts;          /* lustre mount options (as opposed to
207                                          _device_ mount options) */
208         __u32     *lmd_exclude;       /* array of OSTs to ignore */
209 };
210
211 #define LMD_FLG_SERVER       0x0001  /* Mounting a server */
212 #define LMD_FLG_CLIENT       0x0002  /* Mounting a client */
213 #define LMD_FLG_ABORT_RECOV  0x0008  /* Abort recovery */
214 #define LMD_FLG_NOSVC        0x0010  /* Only start MGS/MGC for servers,
215                                         no other services */
216 #define LMD_FLG_NOMGS        0x0020  /* Only start target for servers, reusing
217                                         existing MGS services */
218 #define LMD_FLG_WRITECONF    0x0040  /* Rewrite config log */
219 #define LMD_FLG_NOIR         0x0080  /* NO imperative recovery */
220
221 #define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
222
223
224 /****************** last_rcvd file *********************/
225
226 /** version recovery epoch */
227 #define LR_EPOCH_BITS   32
228 #define lr_epoch(a) ((a) >> LR_EPOCH_BITS)
229 #define LR_EXPIRE_INTERVALS 16 /**< number of intervals to track transno */
230 #define ENOENT_VERSION 1 /** 'virtual' version of non-existent object */
231
232 #define LR_SERVER_SIZE   512
233 #define LR_CLIENT_START 8192
234 #define LR_CLIENT_SIZE   128
235 #if LR_CLIENT_START < LR_SERVER_SIZE
236 #error "Can't have LR_CLIENT_START < LR_SERVER_SIZE"
237 #endif
238
239 /*
240  * This limit is arbitrary (131072 clients on x86), but it is convenient to use
241  * 2^n * CFS_PAGE_SIZE * 8 for the number of bits that fit an order-n allocation.
242  * If we need more than 131072 clients (order-2 allocation on x86) then this
243  * should become an array of single-page pointers that are allocated on demand.
244  */
245 #if (128 * 1024UL) > (CFS_PAGE_SIZE * 8)
246 #define LR_MAX_CLIENTS (128 * 1024UL)
247 #else
248 #define LR_MAX_CLIENTS (CFS_PAGE_SIZE * 8)
249 #endif
250
251 /** COMPAT_146: this is an OST (temporary) */
252 #define OBD_COMPAT_OST          0x00000002
253 /** COMPAT_146: this is an MDT (temporary) */
254 #define OBD_COMPAT_MDT          0x00000004
255 /** 2.0 server, interop flag to show server version is changed */
256 #define OBD_COMPAT_20           0x00000008
257
258 /** MDS handles LOV_OBJID file */
259 #define OBD_ROCOMPAT_LOVOBJID   0x00000001
260
261 /** OST handles group subdirs */
262 #define OBD_INCOMPAT_GROUPS     0x00000001
263 /** this is an OST */
264 #define OBD_INCOMPAT_OST        0x00000002
265 /** this is an MDT */
266 #define OBD_INCOMPAT_MDT        0x00000004
267 /** common last_rvcd format */
268 #define OBD_INCOMPAT_COMMON_LR  0x00000008
269 /** FID is enabled */
270 #define OBD_INCOMPAT_FID        0x00000010
271 /** Size-on-MDS is enabled */
272 #define OBD_INCOMPAT_SOM        0x00000020
273 /** filesystem using iam format to store directory entries */
274 #define OBD_INCOMPAT_IAM_DIR    0x00000040
275 /** LMA attribute contains per-inode incompatible flags */
276 #define OBD_INCOMPAT_LMA        0x00000080
277 /** lmm_stripe_count has been shrunk from __u32 to __u16 and the remaining 16
278  * bits are now used to store a generation. Once we start changing the layout
279  * and bumping the generation, old versions expecting a 32-bit lmm_stripe_count
280  * will be confused by interpreting stripe_count | gen << 16 as the actual
281  * stripe count */
282 #define OBD_INCOMPAT_LMM_VER    0x00000100
283 /** multiple OI files for MDT */
284 #define OBD_INCOMPAT_MULTI_OI   0x00000200
285
286 /* Data stored per server at the head of the last_rcvd file.  In le32 order.
287    This should be common to filter_internal.h, lustre_mds.h */
288 struct lr_server_data {
289         __u8  lsd_uuid[40];        /* server UUID */
290         __u64 lsd_last_transno;    /* last completed transaction ID */
291         __u64 lsd_compat14;        /* reserved - compat with old last_rcvd */
292         __u64 lsd_mount_count;     /* incarnation number */
293         __u32 lsd_feature_compat;  /* compatible feature flags */
294         __u32 lsd_feature_rocompat;/* read-only compatible feature flags */
295         __u32 lsd_feature_incompat;/* incompatible feature flags */
296         __u32 lsd_server_size;     /* size of server data area */
297         __u32 lsd_client_start;    /* start of per-client data area */
298         __u16 lsd_client_size;     /* size of per-client data area */
299         __u16 lsd_subdir_count;    /* number of subdirectories for objects */
300         __u64 lsd_catalog_oid;     /* recovery catalog object id */
301         __u32 lsd_catalog_ogen;    /* recovery catalog inode generation */
302         __u8  lsd_peeruuid[40];    /* UUID of MDS associated with this OST */
303         __u32 lsd_ost_index;       /* index number of OST in LOV */
304         __u32 lsd_mdt_index;       /* index number of MDT in LMV */
305         __u32 lsd_start_epoch;     /* VBR: start epoch from last boot */
306         /** transaction values since lsd_trans_table_time */
307         __u64 lsd_trans_table[LR_EXPIRE_INTERVALS];
308         /** start point of transno table below */
309         __u32 lsd_trans_table_time; /* time of first slot in table above */
310         __u32 lsd_expire_intervals; /* LR_EXPIRE_INTERVALS */
311         __u8  lsd_padding[LR_SERVER_SIZE - 288];
312 };
313
314 /* Data stored per client in the last_rcvd file.  In le32 order. */
315 struct lsd_client_data {
316         __u8  lcd_uuid[40];      /* client UUID */
317         __u64 lcd_last_transno; /* last completed transaction ID */
318         __u64 lcd_last_xid;     /* xid for the last transaction */
319         __u32 lcd_last_result;  /* result from last RPC */
320         __u32 lcd_last_data;    /* per-op data (disposition for open &c.) */
321         /* for MDS_CLOSE requests */
322         __u64 lcd_last_close_transno; /* last completed transaction ID */
323         __u64 lcd_last_close_xid;     /* xid for the last transaction */
324         __u32 lcd_last_close_result;  /* result from last RPC */
325         __u32 lcd_last_close_data;    /* per-op data */
326         /* VBR: last versions */
327         __u64 lcd_pre_versions[4];
328         __u32 lcd_last_epoch;
329         /** orphans handling for delayed export rely on that */
330         __u32 lcd_first_epoch;
331         __u8  lcd_padding[LR_CLIENT_SIZE - 128];
332 };
333
334 /* bug20354: the lcd_uuid for export of clients may be wrong */
335 static inline void check_lcd(char *obd_name, int index,
336                              struct lsd_client_data *lcd)
337 {
338         int length = sizeof(lcd->lcd_uuid);
339         if (strnlen((char*)lcd->lcd_uuid, length) == length) {
340                 lcd->lcd_uuid[length - 1] = '\0';
341
342                 LCONSOLE_ERROR("the client UUID (%s) on %s for exports"
343                                "stored in last_rcvd(index = %d) is bad!\n",
344                                lcd->lcd_uuid, obd_name, index);
345         }
346 }
347
348 /* last_rcvd handling */
349 static inline void lsd_le_to_cpu(struct lr_server_data *buf,
350                                  struct lr_server_data *lsd)
351 {
352         int i;
353         memcpy(lsd->lsd_uuid, buf->lsd_uuid, sizeof (lsd->lsd_uuid));
354         lsd->lsd_last_transno     = le64_to_cpu(buf->lsd_last_transno);
355         lsd->lsd_compat14         = le64_to_cpu(buf->lsd_compat14);
356         lsd->lsd_mount_count      = le64_to_cpu(buf->lsd_mount_count);
357         lsd->lsd_feature_compat   = le32_to_cpu(buf->lsd_feature_compat);
358         lsd->lsd_feature_rocompat = le32_to_cpu(buf->lsd_feature_rocompat);
359         lsd->lsd_feature_incompat = le32_to_cpu(buf->lsd_feature_incompat);
360         lsd->lsd_server_size      = le32_to_cpu(buf->lsd_server_size);
361         lsd->lsd_client_start     = le32_to_cpu(buf->lsd_client_start);
362         lsd->lsd_client_size      = le16_to_cpu(buf->lsd_client_size);
363         lsd->lsd_subdir_count     = le16_to_cpu(buf->lsd_subdir_count);
364         lsd->lsd_catalog_oid      = le64_to_cpu(buf->lsd_catalog_oid);
365         lsd->lsd_catalog_ogen     = le32_to_cpu(buf->lsd_catalog_ogen);
366         memcpy(lsd->lsd_peeruuid, buf->lsd_peeruuid, sizeof(lsd->lsd_peeruuid));
367         lsd->lsd_ost_index        = le32_to_cpu(buf->lsd_ost_index);
368         lsd->lsd_mdt_index        = le32_to_cpu(buf->lsd_mdt_index);
369         lsd->lsd_start_epoch      = le32_to_cpu(buf->lsd_start_epoch);
370         for (i = 0; i < LR_EXPIRE_INTERVALS; i++)
371                 lsd->lsd_trans_table[i] = le64_to_cpu(buf->lsd_trans_table[i]);
372         lsd->lsd_trans_table_time = le32_to_cpu(buf->lsd_trans_table_time);
373         lsd->lsd_expire_intervals = le32_to_cpu(buf->lsd_expire_intervals);
374 }
375
376 static inline void lsd_cpu_to_le(struct lr_server_data *lsd,
377                                  struct lr_server_data *buf)
378 {
379         int i;
380         memcpy(buf->lsd_uuid, lsd->lsd_uuid, sizeof (buf->lsd_uuid));
381         buf->lsd_last_transno     = cpu_to_le64(lsd->lsd_last_transno);
382         buf->lsd_compat14         = cpu_to_le64(lsd->lsd_compat14);
383         buf->lsd_mount_count      = cpu_to_le64(lsd->lsd_mount_count);
384         buf->lsd_feature_compat   = cpu_to_le32(lsd->lsd_feature_compat);
385         buf->lsd_feature_rocompat = cpu_to_le32(lsd->lsd_feature_rocompat);
386         buf->lsd_feature_incompat = cpu_to_le32(lsd->lsd_feature_incompat);
387         buf->lsd_server_size      = cpu_to_le32(lsd->lsd_server_size);
388         buf->lsd_client_start     = cpu_to_le32(lsd->lsd_client_start);
389         buf->lsd_client_size      = cpu_to_le16(lsd->lsd_client_size);
390         buf->lsd_subdir_count     = cpu_to_le16(lsd->lsd_subdir_count);
391         buf->lsd_catalog_oid      = cpu_to_le64(lsd->lsd_catalog_oid);
392         buf->lsd_catalog_ogen     = cpu_to_le32(lsd->lsd_catalog_ogen);
393         memcpy(buf->lsd_peeruuid, lsd->lsd_peeruuid, sizeof(buf->lsd_peeruuid));
394         buf->lsd_ost_index        = cpu_to_le32(lsd->lsd_ost_index);
395         buf->lsd_mdt_index        = cpu_to_le32(lsd->lsd_mdt_index);
396         buf->lsd_start_epoch      = cpu_to_le32(lsd->lsd_start_epoch);
397         for (i = 0; i < LR_EXPIRE_INTERVALS; i++)
398                 buf->lsd_trans_table[i] = cpu_to_le64(lsd->lsd_trans_table[i]);
399         buf->lsd_trans_table_time = cpu_to_le32(lsd->lsd_trans_table_time);
400         buf->lsd_expire_intervals = cpu_to_le32(lsd->lsd_expire_intervals);
401 }
402
403 static inline void lcd_le_to_cpu(struct lsd_client_data *buf,
404                                  struct lsd_client_data *lcd)
405 {
406         memcpy(lcd->lcd_uuid, buf->lcd_uuid, sizeof (lcd->lcd_uuid));
407         lcd->lcd_last_transno       = le64_to_cpu(buf->lcd_last_transno);
408         lcd->lcd_last_xid           = le64_to_cpu(buf->lcd_last_xid);
409         lcd->lcd_last_result        = le32_to_cpu(buf->lcd_last_result);
410         lcd->lcd_last_data          = le32_to_cpu(buf->lcd_last_data);
411         lcd->lcd_last_close_transno = le64_to_cpu(buf->lcd_last_close_transno);
412         lcd->lcd_last_close_xid     = le64_to_cpu(buf->lcd_last_close_xid);
413         lcd->lcd_last_close_result  = le32_to_cpu(buf->lcd_last_close_result);
414         lcd->lcd_last_close_data    = le32_to_cpu(buf->lcd_last_close_data);
415         lcd->lcd_pre_versions[0]    = le64_to_cpu(buf->lcd_pre_versions[0]);
416         lcd->lcd_pre_versions[1]    = le64_to_cpu(buf->lcd_pre_versions[1]);
417         lcd->lcd_pre_versions[2]    = le64_to_cpu(buf->lcd_pre_versions[2]);
418         lcd->lcd_pre_versions[3]    = le64_to_cpu(buf->lcd_pre_versions[3]);
419         lcd->lcd_last_epoch         = le32_to_cpu(buf->lcd_last_epoch);
420         lcd->lcd_first_epoch        = le32_to_cpu(buf->lcd_first_epoch);
421 }
422
423 static inline void lcd_cpu_to_le(struct lsd_client_data *lcd,
424                                  struct lsd_client_data *buf)
425 {
426         memcpy(buf->lcd_uuid, lcd->lcd_uuid, sizeof (lcd->lcd_uuid));
427         buf->lcd_last_transno       = cpu_to_le64(lcd->lcd_last_transno);
428         buf->lcd_last_xid           = cpu_to_le64(lcd->lcd_last_xid);
429         buf->lcd_last_result        = cpu_to_le32(lcd->lcd_last_result);
430         buf->lcd_last_data          = cpu_to_le32(lcd->lcd_last_data);
431         buf->lcd_last_close_transno = cpu_to_le64(lcd->lcd_last_close_transno);
432         buf->lcd_last_close_xid     = cpu_to_le64(lcd->lcd_last_close_xid);
433         buf->lcd_last_close_result  = cpu_to_le32(lcd->lcd_last_close_result);
434         buf->lcd_last_close_data    = cpu_to_le32(lcd->lcd_last_close_data);
435         buf->lcd_pre_versions[0]    = cpu_to_le64(lcd->lcd_pre_versions[0]);
436         buf->lcd_pre_versions[1]    = cpu_to_le64(lcd->lcd_pre_versions[1]);
437         buf->lcd_pre_versions[2]    = cpu_to_le64(lcd->lcd_pre_versions[2]);
438         buf->lcd_pre_versions[3]    = cpu_to_le64(lcd->lcd_pre_versions[3]);
439         buf->lcd_last_epoch         = cpu_to_le32(lcd->lcd_last_epoch);
440         buf->lcd_first_epoch        = cpu_to_le32(lcd->lcd_first_epoch);
441 }
442
443 static inline __u64 lcd_last_transno(struct lsd_client_data *lcd)
444 {
445         return (lcd->lcd_last_transno > lcd->lcd_last_close_transno ?
446                 lcd->lcd_last_transno : lcd->lcd_last_close_transno);
447 }
448
449 static inline __u64 lcd_last_xid(struct lsd_client_data *lcd)
450 {
451         return (lcd->lcd_last_xid > lcd->lcd_last_close_xid ?
452                 lcd->lcd_last_xid : lcd->lcd_last_close_xid);
453 }
454
455 /****************** superblock additional info *********************/
456 #ifdef __KERNEL__
457
458 struct ll_sb_info;
459
460 struct lustre_sb_info {
461         int                       lsi_flags;
462         struct obd_device        *lsi_mgc;     /* mgc obd */
463         struct lustre_mount_data *lsi_lmd;     /* mount command info */
464         struct lustre_disk_data  *lsi_ldd;     /* mount info on-disk */
465         struct ll_sb_info        *lsi_llsbi;   /* add'l client sbi info */
466         struct vfsmount          *lsi_srv_mnt; /* the one server mount */
467         cfs_atomic_t              lsi_mounts;  /* references to the srv_mnt */
468         struct backing_dev_info   lsi_bdi;     /* each client mountpoint needs
469                                                   own backing_dev_info */
470 };
471
472 #define LSI_SERVER                       0x00000001
473 #define LSI_UMOUNT_FORCE                 0x00000010
474 #define LSI_UMOUNT_FAILOVER              0x00000020
475 #define LSI_BDI_INITIALIZED              0x00000040
476 #define LSI_IR_CAPABLE                   0x00000080
477
478 #define     s2lsi(sb)        ((struct lustre_sb_info *)((sb)->s_fs_info))
479 #define     s2lsi_nocast(sb) ((sb)->s_fs_info)
480
481 #define     get_profile_name(sb)   (s2lsi(sb)->lsi_lmd->lmd_profile)
482
483 #endif /* __KERNEL__ */
484
485 /****************** mount lookup info *********************/
486
487 struct lustre_mount_info {
488         char                 *lmi_name;
489         struct super_block   *lmi_sb;
490         struct vfsmount      *lmi_mnt;
491         cfs_list_t            lmi_list_chain;
492 };
493
494 /****************** prototypes *********************/
495
496 #ifdef __KERNEL__
497
498 /* obd_mount.c */
499 void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
500                                                   struct vfsmount *mnt));
501 void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb));
502
503
504 int lustre_common_put_super(struct super_block *sb);
505 struct lustre_mount_info *server_find_mount_locked(const char *name);
506 struct lustre_mount_info *server_get_mount(const char *name);
507 struct lustre_mount_info *server_get_mount_2(const char *name);
508 int server_put_mount(const char *name, struct vfsmount *mnt);
509 int server_put_mount_2(const char *name, struct vfsmount *mnt);
510 int server_register_target(struct super_block *sb);
511 struct mgs_target_info;
512 int server_mti_print(char *title, struct mgs_target_info *mti);
513 void server_calc_timeout(struct lustre_sb_info *lsi, struct obd_device *obd);
514
515 /* mgc_request.c */
516 int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
517
518 #endif
519
520 /** @} disk */
521
522 #endif // _LUSTRE_DISK_H