aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 12:19:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 12:19:43 -0400
commitbf25db365428dbd182768baa9850bef7afaac80d (patch)
tree4373037b00459643f0d661672eb6688f80800d72 /fs/exofs
parent682c30ed2165d5694a414d31eac7c63ac5700fb0 (diff)
parent5002dd18c5940ce63b917d84f2b852c3b96009bb (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')
-rw-r--r--fs/exofs/file.c29
-rw-r--r--fs/exofs/inode.c9
-rw-r--r--fs/exofs/ios.c44
-rw-r--r--fs/exofs/super.c1
4 files changed, 31 insertions, 52 deletions
diff --git a/fs/exofs/file.c b/fs/exofs/file.c
index f9bfe2b501d..68cb23e3bb9 100644
--- a/fs/exofs/file.c
+++ b/fs/exofs/file.c
@@ -30,9 +30,6 @@
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
34#include <linux/buffer_head.h>
35
36#include "exofs.h" 33#include "exofs.h"
37 34
38static int exofs_release_file(struct inode *inode, struct file *filp) 35static int exofs_release_file(struct inode *inode, struct file *filp)
@@ -40,19 +37,27 @@ static int exofs_release_file(struct inode *inode, struct file *filp)
40 return 0; 37 return 0;
41} 38}
42 39
40/* exofs_file_fsync - flush the inode to disk
41 *
42 * Note, in exofs all metadata is written as part of inode, regardless.
43 * The writeout is synchronous
44 */
43static int exofs_file_fsync(struct file *filp, int datasync) 45static int exofs_file_fsync(struct file *filp, int datasync)
44{ 46{
45 int ret; 47 int ret;
46 struct address_space *mapping = filp->f_mapping; 48 struct inode *inode = filp->f_mapping->host;
47 struct inode *inode = mapping->host; 49 struct writeback_control wbc = {
50 .sync_mode = WB_SYNC_ALL,
51 .nr_to_write = 0, /* metadata-only; caller takes care of data */
52 };
48 struct super_block *sb; 53 struct super_block *sb;
49 54
50 ret = filemap_write_and_wait(mapping); 55 if (!(inode->i_state & I_DIRTY))
51 if (ret) 56 return 0;
52 return ret; 57 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
58 return 0;
53 59
54 /* sync the inode attributes */ 60 ret = sync_inode(inode, &wbc);
55 ret = write_inode_now(inode, 1);
56 61
57 /* This is a good place to write the sb */ 62 /* This is a good place to write the sb */
58 /* TODO: Sechedule an sb-sync on create */ 63 /* TODO: Sechedule an sb-sync on create */
@@ -65,9 +70,9 @@ static int exofs_file_fsync(struct file *filp, int datasync)
65 70
66static int exofs_flush(struct file *file, fl_owner_t id) 71static int exofs_flush(struct file *file, fl_owner_t id)
67{ 72{
68 exofs_file_fsync(file, 1); 73 int ret = vfs_fsync(file, 0);
69 /* TODO: Flush the OSD target */ 74 /* TODO: Flush the OSD target */
70 return 0; 75 return ret;
71} 76}
72 77
73const struct file_operations exofs_file_operations = { 78const struct file_operations exofs_file_operations = {
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 088cb476b68..eb7368ebd8c 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -32,9 +32,6 @@
32 */ 32 */
33 33
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/writeback.h>
36#include <linux/buffer_head.h>
37#include <scsi/scsi_device.h>
38 35
39#include "exofs.h" 36#include "exofs.h"
40 37
@@ -773,15 +770,13 @@ static int exofs_releasepage(struct page *page, gfp_t gfp)
773{ 770{
774 EXOFS_DBGMSG("page 0x%lx\n", page->index); 771 EXOFS_DBGMSG("page 0x%lx\n", page->index);
775 WARN_ON(1); 772 WARN_ON(1);
776 return try_to_free_buffers(page); 773 return 0;
777} 774}
778 775
779static void exofs_invalidatepage(struct page *page, unsigned long offset) 776static void exofs_invalidatepage(struct page *page, unsigned long offset)
780{ 777{
781 EXOFS_DBGMSG("page_has_buffers=>%d\n", page_has_buffers(page)); 778 EXOFS_DBGMSG("page 0x%lx offset 0x%lx\n", page->index, offset);
782 WARN_ON(1); 779 WARN_ON(1);
783
784 block_invalidatepage(page, offset);
785} 780}
786 781
787const struct address_space_operations exofs_aops = { 782const struct address_space_operations exofs_aops = {
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c
index e2732203fa9..6550bf70e41 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)
305struct _striping_info { 305struct _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
350static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg, 346static 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
394static int _prepare_one_group(struct exofs_io_state *ios, u64 length, 390static 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:
454static int _prepare_for_striping(struct exofs_io_state *ios) 446static 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
504out: 484out:
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 32cfd61def5..047e92fa3af 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -31,7 +31,6 @@
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 33
34#include <linux/smp_lock.h>
35#include <linux/string.h> 34#include <linux/string.h>
36#include <linux/parser.h> 35#include <linux/parser.h>
37#include <linux/vfs.h> 36#include <linux/vfs.h>