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 "../../include/linux/libcfs/libcfs.h"
48 #include "../../include/linux/lnet/types.h"
49 #include <linux/backing-dev.h>
51 /****************** persistent mount data *********************/
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 | \
59 #define LDD_F_SV_ALL 0x0008
61 /****************** mount command *********************/
63 /* The lmd is only used internally by Lustre; mount simply passes
64 * everything as string options
67 #define LMD_MAGIC 0xbdacbd03
68 #define LMD_PARAMS_MAXLEN 4096
70 /* gleaned from the mount command - no persistent info here */
71 struct lustre_mount_data {
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)
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 */
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,
96 #define LMD_FLG_NOMGS 0x0020 /* Only start target for servers,
97 * reusing existing MGS services
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 */
109 #define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
111 /****************** last_rcvd file *********************/
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 */
119 /****************** superblock additional info *********************/
123 struct lustre_sb_info {
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];
136 struct backing_dev_info lsi_bdi; /* each client mountpoint needs
137 * own backing_dev_info
141 #define LSI_UMOUNT_FAILOVER 0x00200000
142 #define LSI_BDI_INITIALIZED 0x00400000
144 #define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info))
145 #define s2lsi_nocast(sb) ((sb)->s_fs_info)
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)
151 /****************** mount lookup info *********************/
153 struct lustre_mount_info {
155 struct super_block *lmi_sb;
156 struct list_head lmi_list_chain;
159 /****************** prototypes *********************/
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);
169 int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
173 #endif /* _LUSTRE_DISK_H */