diff options
Diffstat (limited to 'fs/exofs/exofs.h')
-rw-r--r-- | fs/exofs/exofs.h | 97 |
1 files changed, 93 insertions, 4 deletions
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h index 5ec72e020b22..c35fd4623986 100644 --- a/fs/exofs/exofs.h +++ b/fs/exofs/exofs.h | |||
@@ -30,13 +30,17 @@ | |||
30 | * along with exofs; if not, write to the Free Software | 30 | * along with exofs; if not, write to the Free Software |
31 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 31 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
32 | */ | 32 | */ |
33 | #ifndef __EXOFS_H__ | ||
34 | #define __EXOFS_H__ | ||
33 | 35 | ||
34 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
35 | #include <linux/time.h> | 37 | #include <linux/time.h> |
36 | #include "common.h" | 38 | #include "common.h" |
37 | 39 | ||
38 | #ifndef __EXOFS_H__ | 40 | /* FIXME: Remove once pnfs hits mainline |
39 | #define __EXOFS_H__ | 41 | * #include <linux/exportfs/pnfs_osd_xdr.h> |
42 | */ | ||
43 | #include "pnfs.h" | ||
40 | 44 | ||
41 | #define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) | 45 | #define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) |
42 | 46 | ||
@@ -55,7 +59,7 @@ | |||
55 | * our extension to the in-memory superblock | 59 | * our extension to the in-memory superblock |
56 | */ | 60 | */ |
57 | struct exofs_sb_info { | 61 | struct exofs_sb_info { |
58 | struct osd_dev *s_dev; /* returned by get_osd_dev */ | 62 | struct exofs_fscb s_fscb; /* Written often, pre-allocate*/ |
59 | osd_id s_pid; /* partition ID of file system*/ | 63 | osd_id s_pid; /* partition ID of file system*/ |
60 | int s_timeout; /* timeout for OSD operations */ | 64 | int s_timeout; /* timeout for OSD operations */ |
61 | uint64_t s_nextid; /* highest object ID used */ | 65 | uint64_t s_nextid; /* highest object ID used */ |
@@ -63,7 +67,11 @@ struct exofs_sb_info { | |||
63 | spinlock_t s_next_gen_lock; /* spinlock for gen # update */ | 67 | spinlock_t s_next_gen_lock; /* spinlock for gen # update */ |
64 | u32 s_next_generation; /* next gen # to use */ | 68 | u32 s_next_generation; /* next gen # to use */ |
65 | atomic_t s_curr_pending; /* number of pending commands */ | 69 | atomic_t s_curr_pending; /* number of pending commands */ |
66 | uint8_t s_cred[OSD_CAP_LEN]; /* all-powerful credential */ | 70 | uint8_t s_cred[OSD_CAP_LEN]; /* credential for the fscb */ |
71 | |||
72 | struct pnfs_osd_data_map data_map; /* Default raid to use */ | ||
73 | unsigned s_numdevs; /* Num of devices in array */ | ||
74 | struct osd_dev *s_ods[1]; /* Variable length, minimum 1 */ | ||
67 | }; | 75 | }; |
68 | 76 | ||
69 | /* | 77 | /* |
@@ -79,6 +87,50 @@ struct exofs_i_info { | |||
79 | struct inode vfs_inode; /* normal in-memory inode */ | 87 | struct inode vfs_inode; /* normal in-memory inode */ |
80 | }; | 88 | }; |
81 | 89 | ||
90 | static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) | ||
91 | { | ||
92 | return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF; | ||
93 | } | ||
94 | |||
95 | struct exofs_io_state; | ||
96 | typedef void (*exofs_io_done_fn)(struct exofs_io_state *or, void *private); | ||
97 | |||
98 | struct exofs_io_state { | ||
99 | struct kref kref; | ||
100 | |||
101 | void *private; | ||
102 | exofs_io_done_fn done; | ||
103 | |||
104 | struct exofs_sb_info *sbi; | ||
105 | struct osd_obj_id obj; | ||
106 | u8 *cred; | ||
107 | |||
108 | /* Global read/write IO*/ | ||
109 | loff_t offset; | ||
110 | unsigned long length; | ||
111 | void *kern_buff; | ||
112 | struct bio *bio; | ||
113 | |||
114 | /* Attributes */ | ||
115 | unsigned in_attr_len; | ||
116 | struct osd_attr *in_attr; | ||
117 | unsigned out_attr_len; | ||
118 | struct osd_attr *out_attr; | ||
119 | |||
120 | /* Variable array of size numdevs */ | ||
121 | unsigned numdevs; | ||
122 | struct exofs_per_dev_state { | ||
123 | struct osd_request *or; | ||
124 | struct bio *bio; | ||
125 | } per_dev[]; | ||
126 | }; | ||
127 | |||
128 | static inline unsigned exofs_io_state_size(unsigned numdevs) | ||
129 | { | ||
130 | return sizeof(struct exofs_io_state) + | ||
131 | sizeof(struct exofs_per_dev_state) * numdevs; | ||
132 | } | ||
133 | |||
82 | /* | 134 | /* |
83 | * our inode flags | 135 | * our inode flags |
84 | */ | 136 | */ |
@@ -130,6 +182,42 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode) | |||
130 | /************************* | 182 | /************************* |
131 | * function declarations * | 183 | * function declarations * |
132 | *************************/ | 184 | *************************/ |
185 | |||
186 | /* ios.c */ | ||
187 | void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], | ||
188 | const struct osd_obj_id *obj); | ||
189 | int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj, | ||
190 | u64 offset, void *p, unsigned length); | ||
191 | |||
192 | int exofs_get_io_state(struct exofs_sb_info *sbi, struct exofs_io_state** ios); | ||
193 | void exofs_put_io_state(struct exofs_io_state *ios); | ||
194 | |||
195 | int exofs_check_io(struct exofs_io_state *ios, u64 *resid); | ||
196 | |||
197 | int exofs_sbi_create(struct exofs_io_state *ios); | ||
198 | int exofs_sbi_remove(struct exofs_io_state *ios); | ||
199 | int exofs_sbi_write(struct exofs_io_state *ios); | ||
200 | int exofs_sbi_read(struct exofs_io_state *ios); | ||
201 | |||
202 | int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr); | ||
203 | |||
204 | int exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len); | ||
205 | static inline int exofs_oi_write(struct exofs_i_info *oi, | ||
206 | struct exofs_io_state *ios) | ||
207 | { | ||
208 | ios->obj.id = exofs_oi_objno(oi); | ||
209 | ios->cred = oi->i_cred; | ||
210 | return exofs_sbi_write(ios); | ||
211 | } | ||
212 | |||
213 | static inline int exofs_oi_read(struct exofs_i_info *oi, | ||
214 | struct exofs_io_state *ios) | ||
215 | { | ||
216 | ios->obj.id = exofs_oi_objno(oi); | ||
217 | ios->cred = oi->i_cred; | ||
218 | return exofs_sbi_read(ios); | ||
219 | } | ||
220 | |||
133 | /* inode.c */ | 221 | /* inode.c */ |
134 | void exofs_truncate(struct inode *inode); | 222 | void exofs_truncate(struct inode *inode); |
135 | int exofs_setattr(struct dentry *, struct iattr *); | 223 | int exofs_setattr(struct dentry *, struct iattr *); |
@@ -169,6 +257,7 @@ extern const struct file_operations exofs_file_operations; | |||
169 | 257 | ||
170 | /* inode.c */ | 258 | /* inode.c */ |
171 | extern const struct address_space_operations exofs_aops; | 259 | extern const struct address_space_operations exofs_aops; |
260 | extern const struct osd_attr g_attr_logical_length; | ||
172 | 261 | ||
173 | /* namei.c */ | 262 | /* namei.c */ |
174 | extern const struct inode_operations exofs_dir_inode_operations; | 263 | extern const struct inode_operations exofs_dir_inode_operations; |