aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/inode.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-08-06 22:26:31 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-08-06 22:36:18 -0400
commit8ff660ab85f524bdc7652eb5d38aaef1d66aa9c7 (patch)
treec4a29cde4fc8654ae00e65cb520e13f9fe7f4e08 /fs/exofs/inode.c
parent9e9db45649eb5d3ee5622fdad741914ecf1016a0 (diff)
exofs: Rename raid engine from exofs/ios.c => ore
ORE stands for "Objects Raid Engine" This patch is a mechanical rename of everything that was in ios.c and its API declaration to an ore.c and an osd_ore.h header. The ore engine will later be used by the pnfs objects layout driver. * File ios.c => ore.c * Declaration of types and API are moved from exofs.h to a new osd_ore.h * All used types are prefixed by ore_ from their exofs_ name. * Shift includes from exofs.h to osd_ore.h so osd_ore.h is independent, include it from exofs.h. Other than a pure rename there are no other changes. Next patch will move the ore into it's own module and will export the API to be used by exofs and later the layout driver Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/inode.c')
-rw-r--r--fs/exofs/inode.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 3cc24f25844d..f39a38fc2349 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -43,7 +43,7 @@ enum { BIO_MAX_PAGES_KMALLOC =
43 PAGE_SIZE / sizeof(struct page *), 43 PAGE_SIZE / sizeof(struct page *),
44}; 44};
45 45
46unsigned exofs_max_io_pages(struct exofs_layout *layout, 46unsigned exofs_max_io_pages(struct ore_layout *layout,
47 unsigned expected_pages) 47 unsigned expected_pages)
48{ 48{
49 unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC); 49 unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC);
@@ -58,7 +58,7 @@ struct page_collect {
58 struct exofs_sb_info *sbi; 58 struct exofs_sb_info *sbi;
59 struct inode *inode; 59 struct inode *inode;
60 unsigned expected_pages; 60 unsigned expected_pages;
61 struct exofs_io_state *ios; 61 struct ore_io_state *ios;
62 62
63 struct page **pages; 63 struct page **pages;
64 unsigned alloc_pages; 64 unsigned alloc_pages;
@@ -133,7 +133,7 @@ static void pcol_free(struct page_collect *pcol)
133 pcol->pages = NULL; 133 pcol->pages = NULL;
134 134
135 if (pcol->ios) { 135 if (pcol->ios) {
136 exofs_put_io_state(pcol->ios); 136 ore_put_io_state(pcol->ios);
137 pcol->ios = NULL; 137 pcol->ios = NULL;
138 } 138 }
139} 139}
@@ -193,7 +193,7 @@ static int __readpages_done(struct page_collect *pcol)
193 u64 resid; 193 u64 resid;
194 u64 good_bytes; 194 u64 good_bytes;
195 u64 length = 0; 195 u64 length = 0;
196 int ret = exofs_check_io(pcol->ios, &resid); 196 int ret = ore_check_io(pcol->ios, &resid);
197 197
198 if (likely(!ret)) 198 if (likely(!ret))
199 good_bytes = pcol->length; 199 good_bytes = pcol->length;
@@ -234,7 +234,7 @@ static int __readpages_done(struct page_collect *pcol)
234} 234}
235 235
236/* callback of async reads */ 236/* callback of async reads */
237static void readpages_done(struct exofs_io_state *ios, void *p) 237static void readpages_done(struct ore_io_state *ios, void *p)
238{ 238{
239 struct page_collect *pcol = p; 239 struct page_collect *pcol = p;
240 240
@@ -262,7 +262,7 @@ static void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
262static int read_exec(struct page_collect *pcol) 262static int read_exec(struct page_collect *pcol)
263{ 263{
264 struct exofs_i_info *oi = exofs_i(pcol->inode); 264 struct exofs_i_info *oi = exofs_i(pcol->inode);
265 struct exofs_io_state *ios; 265 struct ore_io_state *ios;
266 struct page_collect *pcol_copy = NULL; 266 struct page_collect *pcol_copy = NULL;
267 int ret; 267 int ret;
268 268
@@ -270,7 +270,7 @@ static int read_exec(struct page_collect *pcol)
270 return 0; 270 return 0;
271 271
272 if (!pcol->ios) { 272 if (!pcol->ios) {
273 int ret = exofs_get_rw_state(&pcol->sbi->layout, &oi->comps, true, 273 int ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, true,
274 pcol->pg_first << PAGE_CACHE_SHIFT, 274 pcol->pg_first << PAGE_CACHE_SHIFT,
275 pcol->length, &pcol->ios); 275 pcol->length, &pcol->ios);
276 276
@@ -283,7 +283,7 @@ static int read_exec(struct page_collect *pcol)
283 ios->nr_pages = pcol->nr_pages; 283 ios->nr_pages = pcol->nr_pages;
284 284
285 if (pcol->read_4_write) { 285 if (pcol->read_4_write) {
286 exofs_sbi_read(pcol->ios); 286 ore_read(pcol->ios);
287 return __readpages_done(pcol); 287 return __readpages_done(pcol);
288 } 288 }
289 289
@@ -296,7 +296,7 @@ static int read_exec(struct page_collect *pcol)
296 *pcol_copy = *pcol; 296 *pcol_copy = *pcol;
297 ios->done = readpages_done; 297 ios->done = readpages_done;
298 ios->private = pcol_copy; 298 ios->private = pcol_copy;
299 ret = exofs_sbi_read(ios); 299 ret = ore_read(ios);
300 if (unlikely(ret)) 300 if (unlikely(ret))
301 goto err; 301 goto err;
302 302
@@ -458,14 +458,14 @@ static int exofs_readpage(struct file *file, struct page *page)
458} 458}
459 459
460/* Callback for osd_write. All writes are asynchronous */ 460/* Callback for osd_write. All writes are asynchronous */
461static void writepages_done(struct exofs_io_state *ios, void *p) 461static void writepages_done(struct ore_io_state *ios, void *p)
462{ 462{
463 struct page_collect *pcol = p; 463 struct page_collect *pcol = p;
464 int i; 464 int i;
465 u64 resid; 465 u64 resid;
466 u64 good_bytes; 466 u64 good_bytes;
467 u64 length = 0; 467 u64 length = 0;
468 int ret = exofs_check_io(ios, &resid); 468 int ret = ore_check_io(ios, &resid);
469 469
470 atomic_dec(&pcol->sbi->s_curr_pending); 470 atomic_dec(&pcol->sbi->s_curr_pending);
471 471
@@ -508,7 +508,7 @@ static void writepages_done(struct exofs_io_state *ios, void *p)
508static int write_exec(struct page_collect *pcol) 508static int write_exec(struct page_collect *pcol)
509{ 509{
510 struct exofs_i_info *oi = exofs_i(pcol->inode); 510 struct exofs_i_info *oi = exofs_i(pcol->inode);
511 struct exofs_io_state *ios; 511 struct ore_io_state *ios;
512 struct page_collect *pcol_copy = NULL; 512 struct page_collect *pcol_copy = NULL;
513 int ret; 513 int ret;
514 514
@@ -516,7 +516,7 @@ static int write_exec(struct page_collect *pcol)
516 return 0; 516 return 0;
517 517
518 BUG_ON(pcol->ios); 518 BUG_ON(pcol->ios);
519 ret = exofs_get_rw_state(&pcol->sbi->layout, &oi->comps, false, 519 ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, false,
520 pcol->pg_first << PAGE_CACHE_SHIFT, 520 pcol->pg_first << PAGE_CACHE_SHIFT,
521 pcol->length, &pcol->ios); 521 pcol->length, &pcol->ios);
522 522
@@ -538,9 +538,9 @@ static int write_exec(struct page_collect *pcol)
538 ios->done = writepages_done; 538 ios->done = writepages_done;
539 ios->private = pcol_copy; 539 ios->private = pcol_copy;
540 540
541 ret = exofs_sbi_write(ios); 541 ret = ore_write(ios);
542 if (unlikely(ret)) { 542 if (unlikely(ret)) {
543 EXOFS_ERR("write_exec: exofs_sbi_write() Failed\n"); 543 EXOFS_ERR("write_exec: ore_write() Failed\n");
544 goto err; 544 goto err;
545 } 545 }
546 546
@@ -860,7 +860,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize)
860 860
861 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 861 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
862 862
863 ret = exofs_truncate(&sbi->layout, &oi->comps, (u64)newsize); 863 ret = ore_truncate(&sbi->layout, &oi->comps, (u64)newsize);
864 if (likely(!ret)) 864 if (likely(!ret))
865 truncate_setsize(inode, newsize); 865 truncate_setsize(inode, newsize);
866 866
@@ -923,13 +923,13 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
923 [1] = g_attr_inode_file_layout, 923 [1] = g_attr_inode_file_layout,
924 [2] = g_attr_inode_dir_layout, 924 [2] = g_attr_inode_dir_layout,
925 }; 925 };
926 struct exofs_io_state *ios; 926 struct ore_io_state *ios;
927 struct exofs_on_disk_inode_layout *layout; 927 struct exofs_on_disk_inode_layout *layout;
928 int ret; 928 int ret;
929 929
930 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 930 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
931 if (unlikely(ret)) { 931 if (unlikely(ret)) {
932 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 932 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
933 return ret; 933 return ret;
934 } 934 }
935 935
@@ -939,7 +939,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
939 ios->in_attr = attrs; 939 ios->in_attr = attrs;
940 ios->in_attr_len = ARRAY_SIZE(attrs); 940 ios->in_attr_len = ARRAY_SIZE(attrs);
941 941
942 ret = exofs_sbi_read(ios); 942 ret = ore_read(ios);
943 if (unlikely(ret)) { 943 if (unlikely(ret)) {
944 EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n", 944 EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n",
945 _LLU(oi->one_comp.obj.id), ret); 945 _LLU(oi->one_comp.obj.id), ret);
@@ -992,7 +992,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
992 } 992 }
993 993
994out: 994out:
995 exofs_put_io_state(ios); 995 ore_put_io_state(ios);
996 return ret; 996 return ret;
997} 997}
998 998
@@ -1111,15 +1111,15 @@ int __exofs_wait_obj_created(struct exofs_i_info *oi)
1111 * set the obj_created flag so that other methods know that the object exists on 1111 * set the obj_created flag so that other methods know that the object exists on
1112 * the OSD. 1112 * the OSD.
1113 */ 1113 */
1114static void create_done(struct exofs_io_state *ios, void *p) 1114static void create_done(struct ore_io_state *ios, void *p)
1115{ 1115{
1116 struct inode *inode = p; 1116 struct inode *inode = p;
1117 struct exofs_i_info *oi = exofs_i(inode); 1117 struct exofs_i_info *oi = exofs_i(inode);
1118 struct exofs_sb_info *sbi = inode->i_sb->s_fs_info; 1118 struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
1119 int ret; 1119 int ret;
1120 1120
1121 ret = exofs_check_io(ios, NULL); 1121 ret = ore_check_io(ios, NULL);
1122 exofs_put_io_state(ios); 1122 ore_put_io_state(ios);
1123 1123
1124 atomic_dec(&sbi->s_curr_pending); 1124 atomic_dec(&sbi->s_curr_pending);
1125 1125
@@ -1149,7 +1149,7 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
1149 struct exofs_sb_info *sbi = sb->s_fs_info; 1149 struct exofs_sb_info *sbi = sb->s_fs_info;
1150 struct inode *inode; 1150 struct inode *inode;
1151 struct exofs_i_info *oi; 1151 struct exofs_i_info *oi;
1152 struct exofs_io_state *ios; 1152 struct ore_io_state *ios;
1153 int ret; 1153 int ret;
1154 1154
1155 inode = new_inode(sb); 1155 inode = new_inode(sb);
@@ -1178,18 +1178,18 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
1178 1178
1179 mark_inode_dirty(inode); 1179 mark_inode_dirty(inode);
1180 1180
1181 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 1181 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
1182 if (unlikely(ret)) { 1182 if (unlikely(ret)) {
1183 EXOFS_ERR("exofs_new_inode: exofs_get_io_state failed\n"); 1183 EXOFS_ERR("exofs_new_inode: ore_get_io_state failed\n");
1184 return ERR_PTR(ret); 1184 return ERR_PTR(ret);
1185 } 1185 }
1186 1186
1187 ios->done = create_done; 1187 ios->done = create_done;
1188 ios->private = inode; 1188 ios->private = inode;
1189 1189
1190 ret = exofs_sbi_create(ios); 1190 ret = ore_create(ios);
1191 if (ret) { 1191 if (ret) {
1192 exofs_put_io_state(ios); 1192 ore_put_io_state(ios);
1193 return ERR_PTR(ret); 1193 return ERR_PTR(ret);
1194 } 1194 }
1195 atomic_inc(&sbi->s_curr_pending); 1195 atomic_inc(&sbi->s_curr_pending);
@@ -1208,11 +1208,11 @@ struct updatei_args {
1208/* 1208/*
1209 * Callback function from exofs_update_inode(). 1209 * Callback function from exofs_update_inode().
1210 */ 1210 */
1211static void updatei_done(struct exofs_io_state *ios, void *p) 1211static void updatei_done(struct ore_io_state *ios, void *p)
1212{ 1212{
1213 struct updatei_args *args = p; 1213 struct updatei_args *args = p;
1214 1214
1215 exofs_put_io_state(ios); 1215 ore_put_io_state(ios);
1216 1216
1217 atomic_dec(&args->sbi->s_curr_pending); 1217 atomic_dec(&args->sbi->s_curr_pending);
1218 1218
@@ -1228,7 +1228,7 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
1228 struct exofs_i_info *oi = exofs_i(inode); 1228 struct exofs_i_info *oi = exofs_i(inode);
1229 struct super_block *sb = inode->i_sb; 1229 struct super_block *sb = inode->i_sb;
1230 struct exofs_sb_info *sbi = sb->s_fs_info; 1230 struct exofs_sb_info *sbi = sb->s_fs_info;
1231 struct exofs_io_state *ios; 1231 struct ore_io_state *ios;
1232 struct osd_attr attr; 1232 struct osd_attr attr;
1233 struct exofs_fcb *fcb; 1233 struct exofs_fcb *fcb;
1234 struct updatei_args *args; 1234 struct updatei_args *args;
@@ -1267,9 +1267,9 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
1267 } else 1267 } else
1268 memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data)); 1268 memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data));
1269 1269
1270 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 1270 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
1271 if (unlikely(ret)) { 1271 if (unlikely(ret)) {
1272 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 1272 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
1273 goto free_args; 1273 goto free_args;
1274 } 1274 }
1275 1275
@@ -1286,13 +1286,13 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
1286 ios->private = args; 1286 ios->private = args;
1287 } 1287 }
1288 1288
1289 ret = exofs_sbi_write(ios); 1289 ret = ore_write(ios);
1290 if (!do_sync && !ret) { 1290 if (!do_sync && !ret) {
1291 atomic_inc(&sbi->s_curr_pending); 1291 atomic_inc(&sbi->s_curr_pending);
1292 goto out; /* deallocation in updatei_done */ 1292 goto out; /* deallocation in updatei_done */
1293 } 1293 }
1294 1294
1295 exofs_put_io_state(ios); 1295 ore_put_io_state(ios);
1296free_args: 1296free_args:
1297 kfree(args); 1297 kfree(args);
1298out: 1298out:
@@ -1311,11 +1311,11 @@ int exofs_write_inode(struct inode *inode, struct writeback_control *wbc)
1311 * Callback function from exofs_delete_inode() - don't have much cleaning up to 1311 * Callback function from exofs_delete_inode() - don't have much cleaning up to
1312 * do. 1312 * do.
1313 */ 1313 */
1314static void delete_done(struct exofs_io_state *ios, void *p) 1314static void delete_done(struct ore_io_state *ios, void *p)
1315{ 1315{
1316 struct exofs_sb_info *sbi = p; 1316 struct exofs_sb_info *sbi = p;
1317 1317
1318 exofs_put_io_state(ios); 1318 ore_put_io_state(ios);
1319 1319
1320 atomic_dec(&sbi->s_curr_pending); 1320 atomic_dec(&sbi->s_curr_pending);
1321} 1321}
@@ -1330,7 +1330,7 @@ void exofs_evict_inode(struct inode *inode)
1330 struct exofs_i_info *oi = exofs_i(inode); 1330 struct exofs_i_info *oi = exofs_i(inode);
1331 struct super_block *sb = inode->i_sb; 1331 struct super_block *sb = inode->i_sb;
1332 struct exofs_sb_info *sbi = sb->s_fs_info; 1332 struct exofs_sb_info *sbi = sb->s_fs_info;
1333 struct exofs_io_state *ios; 1333 struct ore_io_state *ios;
1334 int ret; 1334 int ret;
1335 1335
1336 truncate_inode_pages(&inode->i_data, 0); 1336 truncate_inode_pages(&inode->i_data, 0);
@@ -1350,19 +1350,19 @@ void exofs_evict_inode(struct inode *inode)
1350 /* ignore the error, attempt a remove anyway */ 1350 /* ignore the error, attempt a remove anyway */
1351 1351
1352 /* Now Remove the OSD objects */ 1352 /* Now Remove the OSD objects */
1353 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 1353 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
1354 if (unlikely(ret)) { 1354 if (unlikely(ret)) {
1355 EXOFS_ERR("%s: exofs_get_io_state failed\n", __func__); 1355 EXOFS_ERR("%s: ore_get_io_state failed\n", __func__);
1356 return; 1356 return;
1357 } 1357 }
1358 1358
1359 ios->done = delete_done; 1359 ios->done = delete_done;
1360 ios->private = sbi; 1360 ios->private = sbi;
1361 1361
1362 ret = exofs_sbi_remove(ios); 1362 ret = ore_remove(ios);
1363 if (ret) { 1363 if (ret) {
1364 EXOFS_ERR("%s: exofs_sbi_remove failed\n", __func__); 1364 EXOFS_ERR("%s: ore_remove failed\n", __func__);
1365 exofs_put_io_state(ios); 1365 ore_put_io_state(ios);
1366 return; 1366 return;
1367 } 1367 }
1368 atomic_inc(&sbi->s_curr_pending); 1368 atomic_inc(&sbi->s_curr_pending);