diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 12:19:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 12:19:43 -0400 |
commit | bf25db365428dbd182768baa9850bef7afaac80d (patch) | |
tree | 4373037b00459643f0d661672eb6688f80800d72 /fs/exofs/ios.c | |
parent | 682c30ed2165d5694a414d31eac7c63ac5700fb0 (diff) | |
parent | 5002dd18c5940ce63b917d84f2b852c3b96009bb (diff) |
Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
* 'for-linus' of git://git.open-osd.org/linux-open-osd:
exofs: Fix groups code when num_devices is not divisible by group_width
exofs: Remove useless optimization
exofs: exofs_file_fsync and exofs_file_flush correctness
exofs: Remove superfluous dependency on buffer_head and writeback
Diffstat (limited to 'fs/exofs/ios.c')
-rw-r--r-- | fs/exofs/ios.c | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c index e2732203fa93..6550bf70e41d 100644 --- a/fs/exofs/ios.c +++ b/fs/exofs/ios.c | |||
@@ -305,8 +305,6 @@ int exofs_check_io(struct exofs_io_state *ios, u64 *resid) | |||
305 | struct _striping_info { | 305 | struct _striping_info { |
306 | u64 obj_offset; | 306 | u64 obj_offset; |
307 | u64 group_length; | 307 | u64 group_length; |
308 | u64 total_group_length; | ||
309 | u64 Major; | ||
310 | unsigned dev; | 308 | unsigned dev; |
311 | unsigned unit_off; | 309 | unsigned unit_off; |
312 | }; | 310 | }; |
@@ -343,8 +341,6 @@ static void _calc_stripe_info(struct exofs_io_state *ios, u64 file_offset, | |||
343 | (M * group_depth * stripe_unit); | 341 | (M * group_depth * stripe_unit); |
344 | 342 | ||
345 | si->group_length = T - H; | 343 | si->group_length = T - H; |
346 | si->total_group_length = T; | ||
347 | si->Major = M; | ||
348 | } | 344 | } |
349 | 345 | ||
350 | static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg, | 346 | static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg, |
@@ -392,20 +388,19 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg, | |||
392 | } | 388 | } |
393 | 389 | ||
394 | static int _prepare_one_group(struct exofs_io_state *ios, u64 length, | 390 | static int _prepare_one_group(struct exofs_io_state *ios, u64 length, |
395 | struct _striping_info *si, unsigned first_comp) | 391 | struct _striping_info *si) |
396 | { | 392 | { |
397 | unsigned stripe_unit = ios->layout->stripe_unit; | 393 | unsigned stripe_unit = ios->layout->stripe_unit; |
398 | unsigned mirrors_p1 = ios->layout->mirrors_p1; | 394 | unsigned mirrors_p1 = ios->layout->mirrors_p1; |
399 | unsigned devs_in_group = ios->layout->group_width * mirrors_p1; | 395 | unsigned devs_in_group = ios->layout->group_width * mirrors_p1; |
400 | unsigned dev = si->dev; | 396 | unsigned dev = si->dev; |
401 | unsigned first_dev = dev - (dev % devs_in_group); | 397 | unsigned first_dev = dev - (dev % devs_in_group); |
402 | unsigned comp = first_comp + (dev - first_dev); | ||
403 | unsigned max_comp = ios->numdevs ? ios->numdevs - mirrors_p1 : 0; | 398 | unsigned max_comp = ios->numdevs ? ios->numdevs - mirrors_p1 : 0; |
404 | unsigned cur_pg = ios->pages_consumed; | 399 | unsigned cur_pg = ios->pages_consumed; |
405 | int ret = 0; | 400 | int ret = 0; |
406 | 401 | ||
407 | while (length) { | 402 | while (length) { |
408 | struct exofs_per_dev_state *per_dev = &ios->per_dev[comp]; | 403 | struct exofs_per_dev_state *per_dev = &ios->per_dev[dev]; |
409 | unsigned cur_len, page_off = 0; | 404 | unsigned cur_len, page_off = 0; |
410 | 405 | ||
411 | if (!per_dev->length) { | 406 | if (!per_dev->length) { |
@@ -424,11 +419,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length, | |||
424 | cur_len = stripe_unit; | 419 | cur_len = stripe_unit; |
425 | } | 420 | } |
426 | 421 | ||
427 | if (max_comp < comp) | 422 | if (max_comp < dev) |
428 | max_comp = comp; | 423 | max_comp = dev; |
429 | |||
430 | dev += mirrors_p1; | ||
431 | dev = (dev % devs_in_group) + first_dev; | ||
432 | } else { | 424 | } else { |
433 | cur_len = stripe_unit; | 425 | cur_len = stripe_unit; |
434 | } | 426 | } |
@@ -440,8 +432,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length, | |||
440 | if (unlikely(ret)) | 432 | if (unlikely(ret)) |
441 | goto out; | 433 | goto out; |
442 | 434 | ||
443 | comp += mirrors_p1; | 435 | dev += mirrors_p1; |
444 | comp = (comp % devs_in_group) + first_comp; | 436 | dev = (dev % devs_in_group) + first_dev; |
445 | 437 | ||
446 | length -= cur_len; | 438 | length -= cur_len; |
447 | } | 439 | } |
@@ -454,18 +446,15 @@ out: | |||
454 | static int _prepare_for_striping(struct exofs_io_state *ios) | 446 | static int _prepare_for_striping(struct exofs_io_state *ios) |
455 | { | 447 | { |
456 | u64 length = ios->length; | 448 | u64 length = ios->length; |
449 | u64 offset = ios->offset; | ||
457 | struct _striping_info si; | 450 | struct _striping_info si; |
458 | unsigned devs_in_group = ios->layout->group_width * | ||
459 | ios->layout->mirrors_p1; | ||
460 | unsigned first_comp = 0; | ||
461 | int ret = 0; | 451 | int ret = 0; |
462 | 452 | ||
463 | _calc_stripe_info(ios, ios->offset, &si); | ||
464 | |||
465 | if (!ios->pages) { | 453 | if (!ios->pages) { |
466 | if (ios->kern_buff) { | 454 | if (ios->kern_buff) { |
467 | struct exofs_per_dev_state *per_dev = &ios->per_dev[0]; | 455 | struct exofs_per_dev_state *per_dev = &ios->per_dev[0]; |
468 | 456 | ||
457 | _calc_stripe_info(ios, ios->offset, &si); | ||
469 | per_dev->offset = si.obj_offset; | 458 | per_dev->offset = si.obj_offset; |
470 | per_dev->dev = si.dev; | 459 | per_dev->dev = si.dev; |
471 | 460 | ||
@@ -479,26 +468,17 @@ static int _prepare_for_striping(struct exofs_io_state *ios) | |||
479 | } | 468 | } |
480 | 469 | ||
481 | while (length) { | 470 | while (length) { |
471 | _calc_stripe_info(ios, offset, &si); | ||
472 | |||
482 | if (length < si.group_length) | 473 | if (length < si.group_length) |
483 | si.group_length = length; | 474 | si.group_length = length; |
484 | 475 | ||
485 | ret = _prepare_one_group(ios, si.group_length, &si, first_comp); | 476 | ret = _prepare_one_group(ios, si.group_length, &si); |
486 | if (unlikely(ret)) | 477 | if (unlikely(ret)) |
487 | goto out; | 478 | goto out; |
488 | 479 | ||
480 | offset += si.group_length; | ||
489 | length -= si.group_length; | 481 | length -= si.group_length; |
490 | |||
491 | si.group_length = si.total_group_length; | ||
492 | si.unit_off = 0; | ||
493 | ++si.Major; | ||
494 | si.obj_offset = si.Major * ios->layout->stripe_unit * | ||
495 | ios->layout->group_depth; | ||
496 | |||
497 | si.dev = (si.dev - (si.dev % devs_in_group)) + devs_in_group; | ||
498 | si.dev %= ios->layout->s_numdevs; | ||
499 | |||
500 | first_comp += devs_in_group; | ||
501 | first_comp %= ios->layout->s_numdevs; | ||
502 | } | 482 | } |
503 | 483 | ||
504 | out: | 484 | out: |