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.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2012, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lustre_disk.h
38 * Lustre disk format definitions.
40 * Author: Nathan Rutman <nathan@clusterfs.com>
43 #ifndef _LUSTRE_DISK_H
44 #define _LUSTRE_DISK_H
46 /** \defgroup disk disk
51 #include "../../include/linux/libcfs/libcfs.h"
52 #include "../../include/linux/lnet/types.h"
53 #include <linux/backing-dev.h>
55 /****************** persistent mount data *********************/
57 #define LDD_F_SV_TYPE_MDT 0x0001
58 #define LDD_F_SV_TYPE_OST 0x0002
59 #define LDD_F_SV_TYPE_MGS 0x0004
60 #define LDD_F_SV_TYPE_MASK (LDD_F_SV_TYPE_MDT | \
63 #define LDD_F_SV_ALL 0x0008
65 /****************** mount command *********************/
67 /* The lmd is only used internally by Lustre; mount simply passes
68 * everything as string options
71 #define LMD_MAGIC 0xbdacbd03
72 #define LMD_PARAMS_MAXLEN 4096
74 /* gleaned from the mount command - no persistent info here */
75 struct lustre_mount_data {
77 __u32 lmd_flags; /* lustre mount flags */
78 int lmd_mgs_failnodes; /* mgs failover node count */
79 int lmd_exclude_count;
80 int lmd_recovery_time_soft;
81 int lmd_recovery_time_hard;
82 char *lmd_dev; /* device name */
83 char *lmd_profile; /* client only */
84 char *lmd_mgssec; /* sptlrpc flavor to mgs */
85 char *lmd_opts; /* lustre mount options (as opposed to
86 * _device_ mount options)
88 char *lmd_params; /* lustre params */
89 __u32 *lmd_exclude; /* array of OSTs to ignore */
90 char *lmd_mgs; /* MGS nid */
91 char *lmd_osd_type; /* OSD type */
94 #define LMD_FLG_SERVER 0x0001 /* Mounting a server */
95 #define LMD_FLG_CLIENT 0x0002 /* Mounting a client */
96 #define LMD_FLG_ABORT_RECOV 0x0008 /* Abort recovery */
97 #define LMD_FLG_NOSVC 0x0010 /* Only start MGS/MGC for servers,
100 #define LMD_FLG_NOMGS 0x0020 /* Only start target for servers,
101 * reusing existing MGS services
103 #define LMD_FLG_WRITECONF 0x0040 /* Rewrite config log */
104 #define LMD_FLG_NOIR 0x0080 /* NO imperative recovery */
105 #define LMD_FLG_NOSCRUB 0x0100 /* Do not trigger scrub automatically */
106 #define LMD_FLG_MGS 0x0200 /* Also start MGS along with server */
107 #define LMD_FLG_IAM 0x0400 /* IAM dir */
108 #define LMD_FLG_NO_PRIMNODE 0x0800 /* all nodes are service nodes */
109 #define LMD_FLG_VIRGIN 0x1000 /* the service registers first time */
110 #define LMD_FLG_UPDATE 0x2000 /* update parameters */
111 #define LMD_FLG_HSM 0x4000 /* Start coordinator */
113 #define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
115 /****************** last_rcvd file *********************/
117 /** version recovery epoch */
118 #define LR_EPOCH_BITS 32
119 #define lr_epoch(a) ((a) >> LR_EPOCH_BITS)
120 #define LR_EXPIRE_INTERVALS 16 /**< number of intervals to track transno */
121 #define ENOENT_VERSION 1 /** 'virtual' version of non-existent object */
123 /****************** superblock additional info *********************/
127 struct lustre_sb_info {
129 struct obd_device *lsi_mgc; /* mgc obd */
130 struct lustre_mount_data *lsi_lmd; /* mount command info */
131 struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */
132 struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/
133 atomic_t lsi_mounts; /* references to the srv_mnt */
134 char lsi_svname[MTI_NAME_MAXLEN];
135 char lsi_osd_obdname[64];
136 char lsi_osd_uuid[64];
137 struct obd_export *lsi_osd_exp;
138 char lsi_osd_type[16];
140 struct backing_dev_info lsi_bdi; /* each client mountpoint needs
141 * own backing_dev_info
145 #define LSI_UMOUNT_FAILOVER 0x00200000
146 #define LSI_BDI_INITIALIZED 0x00400000
148 #define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info))
149 #define s2lsi_nocast(sb) ((sb)->s_fs_info)
151 #define get_profile_name(sb) (s2lsi(sb)->lsi_lmd->lmd_profile)
152 #define get_mount_flags(sb) (s2lsi(sb)->lsi_lmd->lmd_flags)
153 #define get_mntdev_name(sb) (s2lsi(sb)->lsi_lmd->lmd_dev)
155 /****************** mount lookup info *********************/
157 struct lustre_mount_info {
159 struct super_block *lmi_sb;
160 struct list_head lmi_list_chain;
163 /****************** prototypes *********************/
167 int lustre_start_mgc(struct super_block *sb);
168 void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
169 struct vfsmount *mnt));
170 void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb));
171 int lustre_common_put_super(struct super_block *sb);
173 int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
177 #endif /* _LUSTRE_DISK_H */