diff options
Diffstat (limited to 'fs/exofs')
| -rw-r--r-- | fs/exofs/exofs.h | 3 | ||||
| -rw-r--r-- | fs/exofs/file.c | 30 | ||||
| -rw-r--r-- | fs/exofs/inode.c | 136 | ||||
| -rw-r--r-- | fs/exofs/ios.c | 46 | ||||
| -rw-r--r-- | fs/exofs/super.c | 3 |
5 files changed, 87 insertions, 131 deletions
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h index 22721b2fd890..2dc925fa1010 100644 --- a/fs/exofs/exofs.h +++ b/fs/exofs/exofs.h | |||
| @@ -256,7 +256,6 @@ static inline int exofs_oi_read(struct exofs_i_info *oi, | |||
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | /* inode.c */ | 258 | /* inode.c */ |
| 259 | void exofs_truncate(struct inode *inode); | ||
| 260 | int exofs_setattr(struct dentry *, struct iattr *); | 259 | int exofs_setattr(struct dentry *, struct iattr *); |
| 261 | int exofs_write_begin(struct file *file, struct address_space *mapping, | 260 | int exofs_write_begin(struct file *file, struct address_space *mapping, |
| 262 | loff_t pos, unsigned len, unsigned flags, | 261 | loff_t pos, unsigned len, unsigned flags, |
| @@ -264,7 +263,7 @@ int exofs_write_begin(struct file *file, struct address_space *mapping, | |||
| 264 | extern struct inode *exofs_iget(struct super_block *, unsigned long); | 263 | extern struct inode *exofs_iget(struct super_block *, unsigned long); |
| 265 | struct inode *exofs_new_inode(struct inode *, int); | 264 | struct inode *exofs_new_inode(struct inode *, int); |
| 266 | extern int exofs_write_inode(struct inode *, struct writeback_control *wbc); | 265 | extern int exofs_write_inode(struct inode *, struct writeback_control *wbc); |
| 267 | extern void exofs_delete_inode(struct inode *); | 266 | extern void exofs_evict_inode(struct inode *); |
| 268 | 267 | ||
| 269 | /* dir.c: */ | 268 | /* dir.c: */ |
| 270 | int exofs_add_link(struct dentry *, struct inode *); | 269 | int exofs_add_link(struct dentry *, struct inode *); |
diff --git a/fs/exofs/file.c b/fs/exofs/file.c index fef6899be397..68cb23e3bb98 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 | ||
| 38 | static int exofs_release_file(struct inode *inode, struct file *filp) | 35 | static 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 | */ | ||
| 43 | static int exofs_file_fsync(struct file *filp, int datasync) | 45 | static 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 | ||
| 66 | static int exofs_flush(struct file *file, fl_owner_t id) | 71 | static 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 | ||
| 73 | const struct file_operations exofs_file_operations = { | 78 | const struct file_operations exofs_file_operations = { |
| @@ -86,6 +91,5 @@ const struct file_operations exofs_file_operations = { | |||
| 86 | }; | 91 | }; |
| 87 | 92 | ||
| 88 | const struct inode_operations exofs_file_inode_operations = { | 93 | const struct inode_operations exofs_file_inode_operations = { |
| 89 | .truncate = exofs_truncate, | ||
| 90 | .setattr = exofs_setattr, | 94 | .setattr = exofs_setattr, |
| 91 | }; | 95 | }; |
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index 4bb6ef822e46..eb7368ebd8cd 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 | ||
| @@ -697,6 +694,13 @@ static int exofs_writepage(struct page *page, struct writeback_control *wbc) | |||
| 697 | return write_exec(&pcol); | 694 | return write_exec(&pcol); |
| 698 | } | 695 | } |
| 699 | 696 | ||
| 697 | /* i_mutex held using inode->i_size directly */ | ||
| 698 | static void _write_failed(struct inode *inode, loff_t to) | ||
| 699 | { | ||
| 700 | if (to > inode->i_size) | ||
| 701 | truncate_pagecache(inode, to, inode->i_size); | ||
| 702 | } | ||
| 703 | |||
| 700 | int exofs_write_begin(struct file *file, struct address_space *mapping, | 704 | int exofs_write_begin(struct file *file, struct address_space *mapping, |
| 701 | loff_t pos, unsigned len, unsigned flags, | 705 | loff_t pos, unsigned len, unsigned flags, |
| 702 | struct page **pagep, void **fsdata) | 706 | struct page **pagep, void **fsdata) |
| @@ -710,7 +714,7 @@ int exofs_write_begin(struct file *file, struct address_space *mapping, | |||
| 710 | fsdata); | 714 | fsdata); |
| 711 | if (ret) { | 715 | if (ret) { |
| 712 | EXOFS_DBGMSG("simple_write_begin faild\n"); | 716 | EXOFS_DBGMSG("simple_write_begin faild\n"); |
| 713 | return ret; | 717 | goto out; |
| 714 | } | 718 | } |
| 715 | 719 | ||
| 716 | page = *pagep; | 720 | page = *pagep; |
| @@ -725,6 +729,9 @@ int exofs_write_begin(struct file *file, struct address_space *mapping, | |||
| 725 | EXOFS_DBGMSG("__readpage_filler faild\n"); | 729 | EXOFS_DBGMSG("__readpage_filler faild\n"); |
| 726 | } | 730 | } |
| 727 | } | 731 | } |
| 732 | out: | ||
| 733 | if (unlikely(ret)) | ||
| 734 | _write_failed(mapping->host, pos + len); | ||
| 728 | 735 | ||
| 729 | return ret; | 736 | return ret; |
| 730 | } | 737 | } |
| @@ -750,6 +757,10 @@ static int exofs_write_end(struct file *file, struct address_space *mapping, | |||
| 750 | int ret; | 757 | int ret; |
| 751 | 758 | ||
| 752 | ret = simple_write_end(file, mapping,pos, len, copied, page, fsdata); | 759 | ret = simple_write_end(file, mapping,pos, len, copied, page, fsdata); |
| 760 | if (unlikely(ret)) | ||
| 761 | _write_failed(inode, pos + len); | ||
| 762 | |||
| 763 | /* TODO: once simple_write_end marks inode dirty remove */ | ||
| 753 | if (i_size != inode->i_size) | 764 | if (i_size != inode->i_size) |
| 754 | mark_inode_dirty(inode); | 765 | mark_inode_dirty(inode); |
| 755 | return ret; | 766 | return ret; |
| @@ -759,15 +770,13 @@ static int exofs_releasepage(struct page *page, gfp_t gfp) | |||
| 759 | { | 770 | { |
| 760 | EXOFS_DBGMSG("page 0x%lx\n", page->index); | 771 | EXOFS_DBGMSG("page 0x%lx\n", page->index); |
| 761 | WARN_ON(1); | 772 | WARN_ON(1); |
| 762 | return try_to_free_buffers(page); | 773 | return 0; |
| 763 | } | 774 | } |
| 764 | 775 | ||
| 765 | static void exofs_invalidatepage(struct page *page, unsigned long offset) | 776 | static void exofs_invalidatepage(struct page *page, unsigned long offset) |
| 766 | { | 777 | { |
| 767 | EXOFS_DBGMSG("page_has_buffers=>%d\n", page_has_buffers(page)); | 778 | EXOFS_DBGMSG("page 0x%lx offset 0x%lx\n", page->index, offset); |
| 768 | WARN_ON(1); | 779 | WARN_ON(1); |
| 769 | |||
| 770 | block_invalidatepage(page, offset); | ||
| 771 | } | 780 | } |
| 772 | 781 | ||
| 773 | const struct address_space_operations exofs_aops = { | 782 | const struct address_space_operations exofs_aops = { |
| @@ -808,87 +817,55 @@ static inline int exofs_inode_is_fast_symlink(struct inode *inode) | |||
| 808 | return S_ISLNK(inode->i_mode) && (oi->i_data[0] != 0); | 817 | return S_ISLNK(inode->i_mode) && (oi->i_data[0] != 0); |
| 809 | } | 818 | } |
| 810 | 819 | ||
| 811 | /* | ||
| 812 | * get_block_t - Fill in a buffer_head | ||
| 813 | * An OSD takes care of block allocation so we just fake an allocation by | ||
| 814 | * putting in the inode's sector_t in the buffer_head. | ||
| 815 | * TODO: What about the case of create==0 and @iblock does not exist in the | ||
| 816 | * object? | ||
| 817 | */ | ||
| 818 | static int exofs_get_block(struct inode *inode, sector_t iblock, | ||
| 819 | struct buffer_head *bh_result, int create) | ||
| 820 | { | ||
| 821 | map_bh(bh_result, inode->i_sb, iblock); | ||
| 822 | return 0; | ||
| 823 | } | ||
| 824 | |||
| 825 | const struct osd_attr g_attr_logical_length = ATTR_DEF( | 820 | const struct osd_attr g_attr_logical_length = ATTR_DEF( |
| 826 | OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8); | 821 | OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8); |
| 827 | 822 | ||
| 828 | static int _do_truncate(struct inode *inode) | 823 | static int _do_truncate(struct inode *inode, loff_t newsize) |
| 829 | { | 824 | { |
| 830 | struct exofs_i_info *oi = exofs_i(inode); | 825 | struct exofs_i_info *oi = exofs_i(inode); |
| 831 | loff_t isize = i_size_read(inode); | ||
| 832 | int ret; | 826 | int ret; |
| 833 | 827 | ||
| 834 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 828 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
| 835 | 829 | ||
| 836 | nobh_truncate_page(inode->i_mapping, isize, exofs_get_block); | 830 | ret = exofs_oi_truncate(oi, (u64)newsize); |
| 831 | if (likely(!ret)) | ||
| 832 | truncate_setsize(inode, newsize); | ||
| 837 | 833 | ||
| 838 | ret = exofs_oi_truncate(oi, (u64)isize); | 834 | EXOFS_DBGMSG("(0x%lx) size=0x%llx ret=>%d\n", |
| 839 | EXOFS_DBGMSG("(0x%lx) size=0x%llx\n", inode->i_ino, isize); | 835 | inode->i_ino, newsize, ret); |
| 840 | return ret; | 836 | return ret; |
| 841 | } | 837 | } |
| 842 | 838 | ||
| 843 | /* | 839 | /* |
| 844 | * Truncate a file to the specified size - all we have to do is set the size | 840 | * Set inode attributes - update size attribute on OSD if needed, |
| 845 | * attribute. We make sure the object exists first. | 841 | * otherwise just call generic functions. |
| 846 | */ | ||
| 847 | void exofs_truncate(struct inode *inode) | ||
| 848 | { | ||
| 849 | struct exofs_i_info *oi = exofs_i(inode); | ||
| 850 | int ret; | ||
| 851 | |||
| 852 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) | ||
| 853 | || S_ISLNK(inode->i_mode))) | ||
| 854 | return; | ||
| 855 | if (exofs_inode_is_fast_symlink(inode)) | ||
| 856 | return; | ||
| 857 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | ||
| 858 | return; | ||
| 859 | |||
| 860 | /* if we are about to truncate an object, and it hasn't been | ||
| 861 | * created yet, wait | ||
| 862 | */ | ||
| 863 | if (unlikely(wait_obj_created(oi))) | ||
| 864 | goto fail; | ||
| 865 | |||
| 866 | ret = _do_truncate(inode); | ||
| 867 | if (ret) | ||
| 868 | goto fail; | ||
| 869 | |||
| 870 | out: | ||
| 871 | mark_inode_dirty(inode); | ||
| 872 | return; | ||
| 873 | fail: | ||
| 874 | make_bad_inode(inode); | ||
| 875 | goto out; | ||
| 876 | } | ||
| 877 | |||
| 878 | /* | ||
| 879 | * Set inode attributes - just call generic functions. | ||
| 880 | */ | 842 | */ |
| 881 | int exofs_setattr(struct dentry *dentry, struct iattr *iattr) | 843 | int exofs_setattr(struct dentry *dentry, struct iattr *iattr) |
| 882 | { | 844 | { |
| 883 | struct inode *inode = dentry->d_inode; | 845 | struct inode *inode = dentry->d_inode; |
| 884 | int error; | 846 | int error; |
| 885 | 847 | ||
| 848 | /* if we are about to modify an object, and it hasn't been | ||
| 849 | * created yet, wait | ||
| 850 | */ | ||
| 851 | error = wait_obj_created(exofs_i(inode)); | ||
| 852 | if (unlikely(error)) | ||
| 853 | return error; | ||
| 854 | |||
| 886 | error = inode_change_ok(inode, iattr); | 855 | error = inode_change_ok(inode, iattr); |
| 887 | if (error) | 856 | if (unlikely(error)) |
| 888 | return error; | 857 | return error; |
| 889 | 858 | ||
| 890 | error = inode_setattr(inode, iattr); | 859 | if ((iattr->ia_valid & ATTR_SIZE) && |
| 891 | return error; | 860 | iattr->ia_size != i_size_read(inode)) { |
| 861 | error = _do_truncate(inode, iattr->ia_size); | ||
| 862 | if (unlikely(error)) | ||
| 863 | return error; | ||
| 864 | } | ||
| 865 | |||
| 866 | setattr_copy(inode, iattr); | ||
| 867 | mark_inode_dirty(inode); | ||
| 868 | return 0; | ||
| 892 | } | 869 | } |
| 893 | 870 | ||
| 894 | static const struct osd_attr g_attr_inode_file_layout = ATTR_DEF( | 871 | static const struct osd_attr g_attr_inode_file_layout = ATTR_DEF( |
| @@ -1325,7 +1302,7 @@ static void delete_done(struct exofs_io_state *ios, void *p) | |||
| 1325 | * from the OSD here. We make sure the object was created before we try and | 1302 | * from the OSD here. We make sure the object was created before we try and |
| 1326 | * delete it. | 1303 | * delete it. |
| 1327 | */ | 1304 | */ |
| 1328 | void exofs_delete_inode(struct inode *inode) | 1305 | void exofs_evict_inode(struct inode *inode) |
| 1329 | { | 1306 | { |
| 1330 | struct exofs_i_info *oi = exofs_i(inode); | 1307 | struct exofs_i_info *oi = exofs_i(inode); |
| 1331 | struct super_block *sb = inode->i_sb; | 1308 | struct super_block *sb = inode->i_sb; |
| @@ -1335,30 +1312,27 @@ void exofs_delete_inode(struct inode *inode) | |||
| 1335 | 1312 | ||
| 1336 | truncate_inode_pages(&inode->i_data, 0); | 1313 | truncate_inode_pages(&inode->i_data, 0); |
| 1337 | 1314 | ||
| 1338 | if (is_bad_inode(inode)) | 1315 | /* TODO: should do better here */ |
| 1316 | if (inode->i_nlink || is_bad_inode(inode)) | ||
| 1339 | goto no_delete; | 1317 | goto no_delete; |
| 1340 | 1318 | ||
| 1341 | mark_inode_dirty(inode); | ||
| 1342 | exofs_update_inode(inode, inode_needs_sync(inode)); | ||
| 1343 | |||
| 1344 | inode->i_size = 0; | 1319 | inode->i_size = 0; |
| 1345 | if (inode->i_blocks) | 1320 | end_writeback(inode); |
| 1346 | exofs_truncate(inode); | ||
| 1347 | 1321 | ||
| 1348 | clear_inode(inode); | 1322 | /* if we are deleting an obj that hasn't been created yet, wait */ |
| 1323 | if (!obj_created(oi)) { | ||
| 1324 | BUG_ON(!obj_2bcreated(oi)); | ||
| 1325 | wait_event(oi->i_wq, obj_created(oi)); | ||
| 1326 | /* ignore the error attempt a remove anyway */ | ||
| 1327 | } | ||
| 1349 | 1328 | ||
| 1329 | /* Now Remove the OSD objects */ | ||
| 1350 | ret = exofs_get_io_state(&sbi->layout, &ios); | 1330 | ret = exofs_get_io_state(&sbi->layout, &ios); |
| 1351 | if (unlikely(ret)) { | 1331 | if (unlikely(ret)) { |
| 1352 | EXOFS_ERR("%s: exofs_get_io_state failed\n", __func__); | 1332 | EXOFS_ERR("%s: exofs_get_io_state failed\n", __func__); |
| 1353 | return; | 1333 | return; |
| 1354 | } | 1334 | } |
| 1355 | 1335 | ||
| 1356 | /* if we are deleting an obj that hasn't been created yet, wait */ | ||
| 1357 | if (!obj_created(oi)) { | ||
| 1358 | BUG_ON(!obj_2bcreated(oi)); | ||
| 1359 | wait_event(oi->i_wq, obj_created(oi)); | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | ios->obj.id = exofs_oi_objno(oi); | 1336 | ios->obj.id = exofs_oi_objno(oi); |
| 1363 | ios->done = delete_done; | 1337 | ios->done = delete_done; |
| 1364 | ios->private = sbi; | 1338 | ios->private = sbi; |
| @@ -1374,5 +1348,5 @@ void exofs_delete_inode(struct inode *inode) | |||
| 1374 | return; | 1348 | return; |
| 1375 | 1349 | ||
| 1376 | no_delete: | 1350 | no_delete: |
| 1377 | clear_inode(inode); | 1351 | end_writeback(inode); |
| 1378 | } | 1352 | } |
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c index 4337cad7777b..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: |
| @@ -599,7 +579,7 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp) | |||
| 599 | } else { | 579 | } else { |
| 600 | bio = master_dev->bio; | 580 | bio = master_dev->bio; |
| 601 | /* FIXME: bio_set_dir() */ | 581 | /* FIXME: bio_set_dir() */ |
| 602 | bio->bi_rw |= (1 << BIO_RW); | 582 | bio->bi_rw |= REQ_WRITE; |
| 603 | } | 583 | } |
| 604 | 584 | ||
| 605 | osd_req_write(or, &ios->obj, per_dev->offset, bio, | 585 | osd_req_write(or, &ios->obj, per_dev->offset, bio, |
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 03149b9a5178..047e92fa3af8 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> |
| @@ -743,7 +742,7 @@ static const struct super_operations exofs_sops = { | |||
| 743 | .alloc_inode = exofs_alloc_inode, | 742 | .alloc_inode = exofs_alloc_inode, |
| 744 | .destroy_inode = exofs_destroy_inode, | 743 | .destroy_inode = exofs_destroy_inode, |
| 745 | .write_inode = exofs_write_inode, | 744 | .write_inode = exofs_write_inode, |
| 746 | .delete_inode = exofs_delete_inode, | 745 | .evict_inode = exofs_evict_inode, |
| 747 | .put_super = exofs_put_super, | 746 | .put_super = exofs_put_super, |
| 748 | .write_super = exofs_write_super, | 747 | .write_super = exofs_write_super, |
| 749 | .sync_fs = exofs_sync_fs, | 748 | .sync_fs = exofs_sync_fs, |
