aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exofs/common.h')
-rw-r--r--fs/exofs/common.h112
1 files changed, 92 insertions, 20 deletions
diff --git a/fs/exofs/common.h b/fs/exofs/common.h
index c6718e4817fe..f0d520312d8b 100644
--- a/fs/exofs/common.h
+++ b/fs/exofs/common.h
@@ -49,11 +49,14 @@
49#define EXOFS_MIN_PID 0x10000 /* Smallest partition ID */ 49#define EXOFS_MIN_PID 0x10000 /* Smallest partition ID */
50#define EXOFS_OBJ_OFF 0x10000 /* offset for objects */ 50#define EXOFS_OBJ_OFF 0x10000 /* offset for objects */
51#define EXOFS_SUPER_ID 0x10000 /* object ID for on-disk superblock */ 51#define EXOFS_SUPER_ID 0x10000 /* object ID for on-disk superblock */
52#define EXOFS_DEVTABLE_ID 0x10001 /* object ID for on-disk device table */
52#define EXOFS_ROOT_ID 0x10002 /* object ID for root directory */ 53#define EXOFS_ROOT_ID 0x10002 /* object ID for root directory */
53 54
54/* exofs Application specific page/attribute */ 55/* exofs Application specific page/attribute */
55# define EXOFS_APAGE_FS_DATA (OSD_APAGE_APP_DEFINED_FIRST + 3) 56# define EXOFS_APAGE_FS_DATA (OSD_APAGE_APP_DEFINED_FIRST + 3)
56# define EXOFS_ATTR_INODE_DATA 1 57# define EXOFS_ATTR_INODE_DATA 1
58# define EXOFS_ATTR_INODE_FILE_LAYOUT 2
59# define EXOFS_ATTR_INODE_DIR_LAYOUT 3
57 60
58/* 61/*
59 * The maximum number of files we can have is limited by the size of the 62 * The maximum number of files we can have is limited by the size of the
@@ -78,17 +81,67 @@ enum {
78#define EXOFS_SUPER_MAGIC 0x5DF5 81#define EXOFS_SUPER_MAGIC 0x5DF5
79 82
80/* 83/*
81 * The file system control block - stored in an object's data (mainly, the one 84 * The file system control block - stored in object EXOFS_SUPER_ID's data.
82 * with ID EXOFS_SUPER_ID). This is where the in-memory superblock is stored 85 * This is where the in-memory superblock is stored on disk.
83 * on disk. Right now it just has a magic value, which is basically a sanity
84 * check on our ability to communicate with the object store.
85 */ 86 */
87enum {EXOFS_FSCB_VER = 1, EXOFS_DT_VER = 1};
86struct exofs_fscb { 88struct exofs_fscb {
87 __le64 s_nextid; /* Highest object ID used */ 89 __le64 s_nextid; /* Highest object ID used */
88 __le32 s_numfiles; /* Number of files on fs */ 90 __le64 s_numfiles; /* Number of files on fs */
91 __le32 s_version; /* == EXOFS_FSCB_VER */
89 __le16 s_magic; /* Magic signature */ 92 __le16 s_magic; /* Magic signature */
90 __le16 s_newfs; /* Non-zero if this is a new fs */ 93 __le16 s_newfs; /* Non-zero if this is a new fs */
91}; 94
95 /* From here on it's a static part, only written by mkexofs */
96 __le64 s_dev_table_oid; /* Resurved, not used */
97 __le64 s_dev_table_count; /* == 0 means no dev_table */
98} __packed;
99
100/*
101 * Describes the raid used in the FS. It is part of the device table.
102 * This here is taken from the pNFS-objects definition. In exofs we
103 * use one raid policy through-out the filesystem. (NOTE: the funny
104 * alignment at begining. We take care of it at exofs_device_table.
105 */
106struct exofs_dt_data_map {
107 __le32 cb_num_comps;
108 __le64 cb_stripe_unit;
109 __le32 cb_group_width;
110 __le32 cb_group_depth;
111 __le32 cb_mirror_cnt;
112 __le32 cb_raid_algorithm;
113} __packed;
114
115/*
116 * This is an osd device information descriptor. It is a single entry in
117 * the exofs device table. It describes an osd target lun which
118 * contains data belonging to this FS. (Same partition_id on all devices)
119 */
120struct exofs_dt_device_info {
121 __le32 systemid_len;
122 u8 systemid[OSD_SYSTEMID_LEN];
123 __le64 long_name_offset; /* If !0 then offset-in-file */
124 __le32 osdname_len; /* */
125 u8 osdname[44]; /* Embbeded, Ususally an asci uuid */
126} __packed;
127
128/*
129 * The EXOFS device table - stored in object EXOFS_DEVTABLE_ID's data.
130 * It contains the raid used for this multy-device FS and an array of
131 * participating devices.
132 */
133struct exofs_device_table {
134 __le32 dt_version; /* == EXOFS_DT_VER */
135 struct exofs_dt_data_map dt_data_map; /* Raid policy to use */
136
137 /* Resurved space For future use. Total includeing this:
138 * (8 * sizeof(le64))
139 */
140 __le64 __Resurved[4];
141
142 __le64 dt_num_devices; /* Array size */
143 struct exofs_dt_device_info dt_dev_table[]; /* Array of devices */
144} __packed;
92 145
93/**************************************************************************** 146/****************************************************************************
94 * inode-related things 147 * inode-related things
@@ -155,22 +208,41 @@ enum {
155 (((name_len) + offsetof(struct exofs_dir_entry, name) + \ 208 (((name_len) + offsetof(struct exofs_dir_entry, name) + \
156 EXOFS_DIR_ROUND) & ~EXOFS_DIR_ROUND) 209 EXOFS_DIR_ROUND) & ~EXOFS_DIR_ROUND)
157 210
158/************************* 211/*
159 * function declarations * 212 * The on-disk (optional) layout structure.
160 *************************/ 213 * sits in an EXOFS_ATTR_INODE_FILE_LAYOUT or EXOFS_ATTR_INODE_DIR_LAYOUT
161/* osd.c */ 214 * attribute, attached to any inode, usually to a directory.
162void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], 215 */
163 const struct osd_obj_id *obj); 216
217enum exofs_inode_layout_gen_functions {
218 LAYOUT_MOVING_WINDOW = 0,
219 LAYOUT_IMPLICT = 1,
220};
164 221
165int exofs_check_ok_resid(struct osd_request *or, u64 *in_resid, u64 *out_resid); 222struct exofs_on_disk_inode_layout {
166static inline int exofs_check_ok(struct osd_request *or) 223 __le16 gen_func; /* One of enum exofs_inode_layout_gen_functions */
224 __le16 pad;
225 union {
226 /* gen_func == LAYOUT_MOVING_WINDOW (default) */
227 struct exofs_layout_sliding_window {
228 __le32 num_devices; /* first n devices in global-table*/
229 } sliding_window __packed;
230
231 /* gen_func == LAYOUT_IMPLICT */
232 struct exofs_layout_implict_list {
233 struct exofs_dt_data_map data_map;
234 /* Variable array of size data_map.cb_num_comps. These
235 * are device indexes of the devices in the global table
236 */
237 __le32 dev_indexes[];
238 } implict __packed;
239 };
240} __packed;
241
242static inline size_t exofs_on_disk_inode_layout_size(unsigned max_devs)
167{ 243{
168 return exofs_check_ok_resid(or, NULL, NULL); 244 return sizeof(struct exofs_on_disk_inode_layout) +
245 max_devs * sizeof(__le32);
169} 246}
170int exofs_sync_op(struct osd_request *or, int timeout, u8 *cred);
171int exofs_async_op(struct osd_request *or,
172 osd_req_done_fn *async_done, void *caller_context, u8 *cred);
173
174int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr);
175 247
176#endif /*ifndef __EXOFS_COM_H__*/ 248#endif /*ifndef __EXOFS_COM_H__*/