diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2010-01-28 04:58:08 -0500 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2010-02-28 06:35:28 -0500 |
commit | d9c740d2253e75db8cef8f87a3125c450f3ebd82 (patch) | |
tree | 7217cf62b8d102e00257be6e0675d25852045bc6 /fs/exofs/ios.c | |
parent | 46f4d973f6874c06b7a41a3bf8f4c1717d90f97a (diff) |
exofs: Define on-disk per-inode optional layout attribute
* Layouts describe the way a file is spread on multiple devices.
The layout information is stored in the objects attribute introduced
in this patch.
* There can be multiple generating function for the layout.
Currently defined:
- No attribute present - use below moving-window on global
device table, all devices.
(This is the only one currently used in exofs)
- an obj_id generated moving window - the obj_id is a randomizing
factor in the otherwise global map layout.
- An explicit layout stored, including a data_map and a device
index list.
- More might be defined in future ...
* There are two attributes defined of the same structure:
A-data-files-layout - This layout is used by data-files. If present
at a directory, all files of that directory will
be created with this layout.
A-meta-data-layout - This layout is used by a directory and other
meta-data information. Also inherited at creation
of subdirectories.
* At creation time inodes are created with the layout specified above.
A usermode utility may change the creation layout on a give directory
or file. Which in the case of directories, will also apply to newly
created files/subdirectories, children of that directory.
In the simple unaltered case of a newly created exofs, no layout
attributes are present, and all layouts adhere to the layout specified
at the device-table.
* In case of a future file system loaded in an old exofs-driver.
At iget(), the generating_function is inspected and if not supported
will return an IO error to the application and the inode will not
be loaded. So not to damage any data.
Note: After this patch we do not yet support any type of layout
only the RAID0 patch that enables striping at the super-block
level will add support for RAID0 layouts above. This way we
are past and future compatible and fully bisectable.
* Access to the device table is done by an accessor since
it will change according to above information.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/ios.c')
-rw-r--r-- | fs/exofs/ios.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c index 4f679317ca54..2b81f99fd62c 100644 --- a/fs/exofs/ios.c +++ b/fs/exofs/ios.c | |||
@@ -107,6 +107,19 @@ void exofs_put_io_state(struct exofs_io_state *ios) | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | unsigned exofs_layout_od_id(struct exofs_layout *layout, | ||
111 | osd_id obj_no, unsigned layout_index) | ||
112 | { | ||
113 | return layout_index; | ||
114 | } | ||
115 | |||
116 | static inline struct osd_dev *exofs_ios_od(struct exofs_io_state *ios, | ||
117 | unsigned layout_index) | ||
118 | { | ||
119 | return ios->layout->s_ods[ | ||
120 | exofs_layout_od_id(ios->layout, ios->obj.id, layout_index)]; | ||
121 | } | ||
122 | |||
110 | static void _sync_done(struct exofs_io_state *ios, void *p) | 123 | static void _sync_done(struct exofs_io_state *ios, void *p) |
111 | { | 124 | { |
112 | struct completion *waiting = p; | 125 | struct completion *waiting = p; |
@@ -242,7 +255,7 @@ int exofs_sbi_create(struct exofs_io_state *ios) | |||
242 | for (i = 0; i < ios->layout->s_numdevs; i++) { | 255 | for (i = 0; i < ios->layout->s_numdevs; i++) { |
243 | struct osd_request *or; | 256 | struct osd_request *or; |
244 | 257 | ||
245 | or = osd_start_request(ios->layout->s_ods[i], GFP_KERNEL); | 258 | or = osd_start_request(exofs_ios_od(ios, i), GFP_KERNEL); |
246 | if (unlikely(!or)) { | 259 | if (unlikely(!or)) { |
247 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); | 260 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); |
248 | ret = -ENOMEM; | 261 | ret = -ENOMEM; |
@@ -266,7 +279,7 @@ int exofs_sbi_remove(struct exofs_io_state *ios) | |||
266 | for (i = 0; i < ios->layout->s_numdevs; i++) { | 279 | for (i = 0; i < ios->layout->s_numdevs; i++) { |
267 | struct osd_request *or; | 280 | struct osd_request *or; |
268 | 281 | ||
269 | or = osd_start_request(ios->layout->s_ods[i], GFP_KERNEL); | 282 | or = osd_start_request(exofs_ios_od(ios, i), GFP_KERNEL); |
270 | if (unlikely(!or)) { | 283 | if (unlikely(!or)) { |
271 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); | 284 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); |
272 | ret = -ENOMEM; | 285 | ret = -ENOMEM; |
@@ -290,7 +303,7 @@ int exofs_sbi_write(struct exofs_io_state *ios) | |||
290 | for (i = 0; i < ios->layout->s_numdevs; i++) { | 303 | for (i = 0; i < ios->layout->s_numdevs; i++) { |
291 | struct osd_request *or; | 304 | struct osd_request *or; |
292 | 305 | ||
293 | or = osd_start_request(ios->layout->s_ods[i], GFP_KERNEL); | 306 | or = osd_start_request(exofs_ios_od(ios, i), GFP_KERNEL); |
294 | if (unlikely(!or)) { | 307 | if (unlikely(!or)) { |
295 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); | 308 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); |
296 | ret = -ENOMEM; | 309 | ret = -ENOMEM; |
@@ -361,7 +374,7 @@ int exofs_sbi_read(struct exofs_io_state *ios) | |||
361 | unsigned first_dev = (unsigned)ios->obj.id; | 374 | unsigned first_dev = (unsigned)ios->obj.id; |
362 | 375 | ||
363 | first_dev %= ios->layout->s_numdevs; | 376 | first_dev %= ios->layout->s_numdevs; |
364 | or = osd_start_request(ios->layout->s_ods[first_dev], GFP_KERNEL); | 377 | or = osd_start_request(exofs_ios_od(ios, first_dev), GFP_KERNEL); |
365 | if (unlikely(!or)) { | 378 | if (unlikely(!or)) { |
366 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); | 379 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); |
367 | return -ENOMEM; | 380 | return -ENOMEM; |
@@ -442,7 +455,7 @@ int exofs_oi_truncate(struct exofs_i_info *oi, u64 size) | |||
442 | for (i = 0; i < sbi->layout.s_numdevs; i++) { | 455 | for (i = 0; i < sbi->layout.s_numdevs; i++) { |
443 | struct osd_request *or; | 456 | struct osd_request *or; |
444 | 457 | ||
445 | or = osd_start_request(sbi->layout.s_ods[i], GFP_KERNEL); | 458 | or = osd_start_request(exofs_ios_od(ios, i), GFP_KERNEL); |
446 | if (unlikely(!or)) { | 459 | if (unlikely(!or)) { |
447 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); | 460 | EXOFS_ERR("%s: osd_start_request failed\n", __func__); |
448 | ret = -ENOMEM; | 461 | ret = -ENOMEM; |