staging/lustre: Replace sun.com GPLv2 URL with gnu.org one.
[deliverable/linux.git] / drivers / staging / lustre / lustre / include / 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, 2012, 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 * lustre/include/lustre_disk.h
33 *
34 * Lustre disk format definitions.
35 *
36 * Author: Nathan Rutman <nathan@clusterfs.com>
37 */
38
39 #ifndef _LUSTRE_DISK_H
40 #define _LUSTRE_DISK_H
41
42 /** \defgroup disk disk
43 *
44 * @{
45 */
46
47 #include "../../include/linux/libcfs/libcfs.h"
48 #include "../../include/linux/lnet/types.h"
49 #include <linux/backing-dev.h>
50
51 /****************** persistent mount data *********************/
52
53 #define LDD_F_SV_TYPE_MDT 0x0001
54 #define LDD_F_SV_TYPE_OST 0x0002
55 #define LDD_F_SV_TYPE_MGS 0x0004
56 #define LDD_F_SV_TYPE_MASK (LDD_F_SV_TYPE_MDT | \
57 LDD_F_SV_TYPE_OST | \
58 LDD_F_SV_TYPE_MGS)
59 #define LDD_F_SV_ALL 0x0008
60
61 /****************** mount command *********************/
62
63 /* The lmd is only used internally by Lustre; mount simply passes
64 * everything as string options
65 */
66
67 #define LMD_MAGIC 0xbdacbd03
68 #define LMD_PARAMS_MAXLEN 4096
69
70 /* gleaned from the mount command - no persistent info here */
71 struct lustre_mount_data {
72 __u32 lmd_magic;
73 __u32 lmd_flags; /* lustre mount flags */
74 int lmd_mgs_failnodes; /* mgs failover node count */
75 int lmd_exclude_count;
76 int lmd_recovery_time_soft;
77 int lmd_recovery_time_hard;
78 char *lmd_dev; /* device name */
79 char *lmd_profile; /* client only */
80 char *lmd_mgssec; /* sptlrpc flavor to mgs */
81 char *lmd_opts; /* lustre mount options (as opposed to
82 * _device_ mount options)
83 */
84 char *lmd_params; /* lustre params */
85 __u32 *lmd_exclude; /* array of OSTs to ignore */
86 char *lmd_mgs; /* MGS nid */
87 char *lmd_osd_type; /* OSD type */
88 };
89
90 #define LMD_FLG_SERVER 0x0001 /* Mounting a server */
91 #define LMD_FLG_CLIENT 0x0002 /* Mounting a client */
92 #define LMD_FLG_ABORT_RECOV 0x0008 /* Abort recovery */
93 #define LMD_FLG_NOSVC 0x0010 /* Only start MGS/MGC for servers,
94 * no other services
95 */
96 #define LMD_FLG_NOMGS 0x0020 /* Only start target for servers,
97 * reusing existing MGS services
98 */
99 #define LMD_FLG_WRITECONF 0x0040 /* Rewrite config log */
100 #define LMD_FLG_NOIR 0x0080 /* NO imperative recovery */
101 #define LMD_FLG_NOSCRUB 0x0100 /* Do not trigger scrub automatically */
102 #define LMD_FLG_MGS 0x0200 /* Also start MGS along with server */
103 #define LMD_FLG_IAM 0x0400 /* IAM dir */
104 #define LMD_FLG_NO_PRIMNODE 0x0800 /* all nodes are service nodes */
105 #define LMD_FLG_VIRGIN 0x1000 /* the service registers first time */
106 #define LMD_FLG_UPDATE 0x2000 /* update parameters */
107 #define LMD_FLG_HSM 0x4000 /* Start coordinator */
108
109 #define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
110
111 /****************** last_rcvd file *********************/
112
113 /** version recovery epoch */
114 #define LR_EPOCH_BITS 32
115 #define lr_epoch(a) ((a) >> LR_EPOCH_BITS)
116 #define LR_EXPIRE_INTERVALS 16 /**< number of intervals to track transno */
117 #define ENOENT_VERSION 1 /** 'virtual' version of non-existent object */
118
119 /****************** superblock additional info *********************/
120
121 struct ll_sb_info;
122
123 struct lustre_sb_info {
124 int lsi_flags;
125 struct obd_device *lsi_mgc; /* mgc obd */
126 struct lustre_mount_data *lsi_lmd; /* mount command info */
127 struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */
128 struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/
129 atomic_t lsi_mounts; /* references to the srv_mnt */
130 char lsi_svname[MTI_NAME_MAXLEN];
131 char lsi_osd_obdname[64];
132 char lsi_osd_uuid[64];
133 struct obd_export *lsi_osd_exp;
134 char lsi_osd_type[16];
135 char lsi_fstype[16];
136 struct backing_dev_info lsi_bdi; /* each client mountpoint needs
137 * own backing_dev_info
138 */
139 };
140
141 #define LSI_UMOUNT_FAILOVER 0x00200000
142 #define LSI_BDI_INITIALIZED 0x00400000
143
144 #define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info))
145 #define s2lsi_nocast(sb) ((sb)->s_fs_info)
146
147 #define get_profile_name(sb) (s2lsi(sb)->lsi_lmd->lmd_profile)
148 #define get_mount_flags(sb) (s2lsi(sb)->lsi_lmd->lmd_flags)
149 #define get_mntdev_name(sb) (s2lsi(sb)->lsi_lmd->lmd_dev)
150
151 /****************** mount lookup info *********************/
152
153 struct lustre_mount_info {
154 char *lmi_name;
155 struct super_block *lmi_sb;
156 struct list_head lmi_list_chain;
157 };
158
159 /****************** prototypes *********************/
160
161 /* obd_mount.c */
162
163 int lustre_start_mgc(struct super_block *sb);
164 void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
165 struct vfsmount *mnt));
166 void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb));
167 int lustre_common_put_super(struct super_block *sb);
168
169 int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
170
171 /** @} disk */
172
173 #endif /* _LUSTRE_DISK_H */
This page took 0.064548 seconds and 6 git commands to generate.