aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/exofs.h
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-08-06 22:26:31 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-08-06 22:36:18 -0400
commit8ff660ab85f524bdc7652eb5d38aaef1d66aa9c7 (patch)
treec4a29cde4fc8654ae00e65cb520e13f9fe7f4e08 /fs/exofs/exofs.h
parent9e9db45649eb5d3ee5622fdad741914ecf1016a0 (diff)
exofs: Rename raid engine from exofs/ios.c => ore
ORE stands for "Objects Raid Engine" This patch is a mechanical rename of everything that was in ios.c and its API declaration to an ore.c and an osd_ore.h header. The ore engine will later be used by the pnfs objects layout driver. * File ios.c => ore.c * Declaration of types and API are moved from exofs.h to a new osd_ore.h * All used types are prefixed by ore_ from their exofs_ name. * Shift includes from exofs.h to osd_ore.h so osd_ore.h is independent, include it from exofs.h. Other than a pure rename there are no other changes. Next patch will move the ore into it's own module and will export the API to be used by exofs and later the layout driver Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/exofs.h')
-rw-r--r--fs/exofs/exofs.h119
1 files changed, 12 insertions, 107 deletions
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h
index 39ad50165162..f4e442ec7445 100644
--- a/fs/exofs/exofs.h
+++ b/fs/exofs/exofs.h
@@ -36,7 +36,8 @@
36#include <linux/fs.h> 36#include <linux/fs.h>
37#include <linux/time.h> 37#include <linux/time.h>
38#include <linux/backing-dev.h> 38#include <linux/backing-dev.h>
39#include <linux/pnfs_osd_xdr.h> 39#include <scsi/osd_ore.h>
40
40#include "common.h" 41#include "common.h"
41 42
42#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) 43#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a)
@@ -52,33 +53,6 @@
52/* u64 has problems with printk this will cast it to unsigned long long */ 53/* u64 has problems with printk this will cast it to unsigned long long */
53#define _LLU(x) (unsigned long long)(x) 54#define _LLU(x) (unsigned long long)(x)
54 55
55struct exofs_comp {
56 struct osd_obj_id obj;
57 u8 cred[OSD_CAP_LEN];
58};
59
60struct exofs_layout {
61 /* Our way of looking at the data_map */
62 unsigned stripe_unit;
63 unsigned mirrors_p1;
64
65 unsigned group_width;
66 u64 group_depth;
67 unsigned group_count;
68};
69
70struct exofs_components {
71 unsigned numdevs; /* Num of devices in array */
72 /* If @single_comp == EC_SINGLE_COMP, @comps points to a single
73 * component. else there are @numdevs components
74 */
75 enum EC_COMP_USAGE {
76 EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff
77 } single_comp;
78 struct exofs_comp *comps;
79 struct osd_dev **ods; /* osd_dev array */
80};
81
82/* 56/*
83 * our extension to the in-memory superblock 57 * our extension to the in-memory superblock
84 */ 58 */
@@ -95,9 +69,9 @@ struct exofs_sb_info {
95 struct pnfs_osd_data_map data_map; /* Default raid to use 69 struct pnfs_osd_data_map data_map; /* Default raid to use
96 * FIXME: Needed ? 70 * FIXME: Needed ?
97 */ 71 */
98 struct exofs_layout layout; /* Default files layout */ 72 struct ore_layout layout; /* Default files layout */
99 struct exofs_comp one_comp; /* id & cred of partition id=0*/ 73 struct ore_comp one_comp; /* id & cred of partition id=0*/
100 struct exofs_components comps; /* comps for the partition */ 74 struct ore_components comps; /* comps for the partition */
101 struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ 75 struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */
102}; 76};
103 77
@@ -111,8 +85,8 @@ struct exofs_i_info {
111 uint32_t i_data[EXOFS_IDATA];/*short symlink names and device #s*/ 85 uint32_t i_data[EXOFS_IDATA];/*short symlink names and device #s*/
112 uint32_t i_dir_start_lookup; /* which page to start lookup */ 86 uint32_t i_dir_start_lookup; /* which page to start lookup */
113 uint64_t i_commit_size; /* the object's written length */ 87 uint64_t i_commit_size; /* the object's written length */
114 struct exofs_comp one_comp; /* same component for all devices */ 88 struct ore_comp one_comp; /* same component for all devices */
115 struct exofs_components comps; /* inode view of the device table */ 89 struct ore_components comps; /* inode view of the device table */
116}; 90};
117 91
118static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) 92static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
@@ -120,53 +94,6 @@ static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
120 return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF; 94 return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF;
121} 95}
122 96
123struct exofs_io_state;
124typedef void (*exofs_io_done_fn)(struct exofs_io_state *ios, void *private);
125
126struct exofs_io_state {
127 struct kref kref;
128
129 void *private;
130 exofs_io_done_fn done;
131
132 struct exofs_layout *layout;
133 struct exofs_components *comps;
134
135 /* Global read/write IO*/
136 loff_t offset;
137 unsigned long length;
138 void *kern_buff;
139
140 struct page **pages;
141 unsigned nr_pages;
142 unsigned pgbase;
143 unsigned pages_consumed;
144
145 /* Attributes */
146 unsigned in_attr_len;
147 struct osd_attr *in_attr;
148 unsigned out_attr_len;
149 struct osd_attr *out_attr;
150
151 bool reading;
152
153 /* Variable array of size numdevs */
154 unsigned numdevs;
155 struct exofs_per_dev_state {
156 struct osd_request *or;
157 struct bio *bio;
158 loff_t offset;
159 unsigned length;
160 unsigned dev;
161 } per_dev[];
162};
163
164static inline unsigned exofs_io_state_size(unsigned numdevs)
165{
166 return sizeof(struct exofs_io_state) +
167 sizeof(struct exofs_per_dev_state) * numdevs;
168}
169
170/* 97/*
171 * our inode flags 98 * our inode flags
172 */ 99 */
@@ -219,30 +146,8 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
219 * function declarations * 146 * function declarations *
220 *************************/ 147 *************************/
221 148
222/* ios.c */
223int exofs_get_rw_state(struct exofs_layout *layout,
224 struct exofs_components *comps,
225 bool is_reading, u64 offset, u64 length,
226 struct exofs_io_state **ios);
227int exofs_get_io_state(struct exofs_layout *layout,
228 struct exofs_components *comps,
229 struct exofs_io_state **ios);
230void exofs_put_io_state(struct exofs_io_state *ios);
231
232int exofs_check_io(struct exofs_io_state *ios, u64 *resid);
233
234int exofs_sbi_create(struct exofs_io_state *ios);
235int exofs_sbi_remove(struct exofs_io_state *ios);
236int exofs_sbi_write(struct exofs_io_state *ios);
237int exofs_sbi_read(struct exofs_io_state *ios);
238int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
239 u64 size);
240
241int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr);
242extern const struct osd_attr g_attr_logical_length;
243
244/* inode.c */ 149/* inode.c */
245unsigned exofs_max_io_pages(struct exofs_layout *layout, 150unsigned exofs_max_io_pages(struct ore_layout *layout,
246 unsigned expected_pages); 151 unsigned expected_pages);
247int exofs_setattr(struct dentry *, struct iattr *); 152int exofs_setattr(struct dentry *, struct iattr *);
248int exofs_write_begin(struct file *file, struct address_space *mapping, 153int exofs_write_begin(struct file *file, struct address_space *mapping,
@@ -292,8 +197,8 @@ extern const struct inode_operations exofs_special_inode_operations;
292extern const struct inode_operations exofs_symlink_inode_operations; 197extern const struct inode_operations exofs_symlink_inode_operations;
293extern const struct inode_operations exofs_fast_symlink_inode_operations; 198extern const struct inode_operations exofs_fast_symlink_inode_operations;
294 199
295/* exofs_init_comps will initialize an exofs_components device array 200/* exofs_init_comps will initialize an ore_components device array
296 * pointing to a single exofs_comp struct, and a round-robin view 201 * pointing to a single ore_comp struct, and a round-robin view
297 * of the device table. 202 * of the device table.
298 * The first device of each inode is the [inode->ino % num_devices] 203 * The first device of each inode is the [inode->ino % num_devices]
299 * and the rest of the devices sequentially following where the 204 * and the rest of the devices sequentially following where the
@@ -302,8 +207,8 @@ extern const struct inode_operations exofs_fast_symlink_inode_operations;
302 * bigger and that the device table repeats twice. 207 * bigger and that the device table repeats twice.
303 * See: exofs_read_lookup_dev_table() 208 * See: exofs_read_lookup_dev_table()
304 */ 209 */
305static inline void exofs_init_comps(struct exofs_components *comps, 210static inline void exofs_init_comps(struct ore_components *comps,
306 struct exofs_comp *one_comp, 211 struct ore_comp *one_comp,
307 struct exofs_sb_info *sbi, osd_id oid) 212 struct exofs_sb_info *sbi, osd_id oid)
308{ 213{
309 unsigned dev_mod = (unsigned)oid, first_dev; 214 unsigned dev_mod = (unsigned)oid, first_dev;