4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2012, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * lustre/include/lustre_disk.h
34 * Lustre disk format definitions.
36 * Author: Nathan Rutman <nathan@clusterfs.com>
39 #ifndef _LUSTRE_DISK_H
40 #define _LUSTRE_DISK_H
42 /** \defgroup disk disk
47 #include <asm/byteorder.h>
48 #include <linux/types.h>
49 #include <linux/backing-dev.h>
50 #include <linux/libcfs/libcfs.h>
52 /****************** persistent mount data *********************/
54 #define LDD_F_SV_TYPE_MDT 0x0001
55 #define LDD_F_SV_TYPE_OST 0x0002
56 #define LDD_F_SV_TYPE_MGS 0x0004
57 #define LDD_F_SV_TYPE_MASK (LDD_F_SV_TYPE_MDT | \
60 #define LDD_F_SV_ALL 0x0008
62 /****************** mount command *********************/
64 /* The lmd is only used internally by Lustre; mount simply passes
65 * everything as string options
68 #define LMD_MAGIC 0xbdacbd03
69 #define LMD_PARAMS_MAXLEN 4096
71 /* gleaned from the mount command - no persistent info here */
72 struct lustre_mount_data {
74 __u32 lmd_flags; /* lustre mount flags */
75 int lmd_mgs_failnodes; /* mgs failover node count */
76 int lmd_exclude_count;
77 int lmd_recovery_time_soft;
78 int lmd_recovery_time_hard;
79 char *lmd_dev; /* device name */
80 char *lmd_profile; /* client only */
81 char *lmd_mgssec; /* sptlrpc flavor to mgs */
82 char *lmd_opts; /* lustre mount options (as opposed to
83 * _device_ mount options)
85 char *lmd_params; /* lustre params */
86 __u32 *lmd_exclude; /* array of OSTs to ignore */
87 char *lmd_mgs; /* MGS nid */
88 char *lmd_osd_type; /* OSD type */
91 #define LMD_FLG_SERVER 0x0001 /* Mounting a server */
92 #define LMD_FLG_CLIENT 0x0002 /* Mounting a client */
93 #define LMD_FLG_ABORT_RECOV 0x0008 /* Abort recovery */
94 #define LMD_FLG_NOSVC 0x0010 /* Only start MGS/MGC for servers,
97 #define LMD_FLG_NOMGS 0x0020 /* Only start target for servers,
98 * reusing existing MGS services
100 #define LMD_FLG_WRITECONF 0x0040 /* Rewrite config log */
101 #define LMD_FLG_NOIR 0x0080 /* NO imperative recovery */
102 #define LMD_FLG_NOSCRUB 0x0100 /* Do not trigger scrub automatically */
103 #define LMD_FLG_MGS 0x0200 /* Also start MGS along with server */
104 #define LMD_FLG_IAM 0x0400 /* IAM dir */
105 #define LMD_FLG_NO_PRIMNODE 0x0800 /* all nodes are service nodes */
106 #define LMD_FLG_VIRGIN 0x1000 /* the service registers first time */
107 #define LMD_FLG_UPDATE 0x2000 /* update parameters */
108 #define LMD_FLG_HSM 0x4000 /* Start coordinator */
110 #define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
112 /****************** superblock additional info *********************/
116 struct lustre_sb_info {
118 struct obd_device *lsi_mgc; /* mgc obd */
119 struct lustre_mount_data *lsi_lmd; /* mount command info */
120 struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */
121 struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/
122 atomic_t lsi_mounts; /* references to the srv_mnt */
123 char lsi_svname[MTI_NAME_MAXLEN];
124 char lsi_osd_obdname[64];
125 char lsi_osd_uuid[64];
126 struct obd_export *lsi_osd_exp;
127 char lsi_osd_type[16];
131 #define LSI_UMOUNT_FAILOVER 0x00200000
133 #define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info))
134 #define s2lsi_nocast(sb) ((sb)->s_fs_info)
136 #define get_profile_name(sb) (s2lsi(sb)->lsi_lmd->lmd_profile)
138 /****************** prototypes *********************/
142 int lustre_start_mgc(struct super_block *sb);
143 void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
144 struct vfsmount *mnt));
145 void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb));
146 int lustre_common_put_super(struct super_block *sb);
148 int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
152 #endif /* _LUSTRE_DISK_H */