aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exofs/super.c')
-rw-r--r--fs/exofs/super.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index a1d1e77b12eb..fc8875186ae8 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -210,7 +210,7 @@ int exofs_sync_fs(struct super_block *sb, int wait)
210 sbi = sb->s_fs_info; 210 sbi = sb->s_fs_info;
211 fscb = &sbi->s_fscb; 211 fscb = &sbi->s_fscb;
212 212
213 ret = exofs_get_io_state(sbi, &ios); 213 ret = exofs_get_io_state(&sbi->layout, &ios);
214 if (ret) 214 if (ret)
215 goto out; 215 goto out;
216 216
@@ -264,12 +264,12 @@ static void _exofs_print_device(const char *msg, const char *dev_path,
264 264
265void exofs_free_sbi(struct exofs_sb_info *sbi) 265void exofs_free_sbi(struct exofs_sb_info *sbi)
266{ 266{
267 while (sbi->s_numdevs) { 267 while (sbi->layout.s_numdevs) {
268 int i = --sbi->s_numdevs; 268 int i = --sbi->layout.s_numdevs;
269 struct osd_dev *od = sbi->s_ods[i]; 269 struct osd_dev *od = sbi->layout.s_ods[i];
270 270
271 if (od) { 271 if (od) {
272 sbi->s_ods[i] = NULL; 272 sbi->layout.s_ods[i] = NULL;
273 osduld_put_device(od); 273 osduld_put_device(od);
274 } 274 }
275 } 275 }
@@ -298,7 +298,8 @@ static void exofs_put_super(struct super_block *sb)
298 msecs_to_jiffies(100)); 298 msecs_to_jiffies(100));
299 } 299 }
300 300
301 _exofs_print_device("Unmounting", NULL, sbi->s_ods[0], sbi->s_pid); 301 _exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0],
302 sbi->layout.s_pid);
302 303
303 exofs_free_sbi(sbi); 304 exofs_free_sbi(sbi);
304 sb->s_fs_info = NULL; 305 sb->s_fs_info = NULL;
@@ -361,7 +362,7 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
361{ 362{
362 struct exofs_sb_info *sbi = *psbi; 363 struct exofs_sb_info *sbi = *psbi;
363 struct osd_dev *fscb_od; 364 struct osd_dev *fscb_od;
364 struct osd_obj_id obj = {.partition = sbi->s_pid, 365 struct osd_obj_id obj = {.partition = sbi->layout.s_pid,
365 .id = EXOFS_DEVTABLE_ID}; 366 .id = EXOFS_DEVTABLE_ID};
366 struct exofs_device_table *dt; 367 struct exofs_device_table *dt;
367 unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) + 368 unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) +
@@ -376,9 +377,9 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
376 return -ENOMEM; 377 return -ENOMEM;
377 } 378 }
378 379
379 fscb_od = sbi->s_ods[0]; 380 fscb_od = sbi->layout.s_ods[0];
380 sbi->s_ods[0] = NULL; 381 sbi->layout.s_ods[0] = NULL;
381 sbi->s_numdevs = 0; 382 sbi->layout.s_numdevs = 0;
382 ret = exofs_read_kern(fscb_od, sbi->s_cred, &obj, 0, dt, table_bytes); 383 ret = exofs_read_kern(fscb_od, sbi->s_cred, &obj, 0, dt, table_bytes);
383 if (unlikely(ret)) { 384 if (unlikely(ret)) {
384 EXOFS_ERR("ERROR: reading device table\n"); 385 EXOFS_ERR("ERROR: reading device table\n");
@@ -397,14 +398,15 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
397 goto out; 398 goto out;
398 399
399 if (likely(numdevs > 1)) { 400 if (likely(numdevs > 1)) {
400 unsigned size = numdevs * sizeof(sbi->s_ods[0]); 401 unsigned size = numdevs * sizeof(sbi->layout.s_ods[0]);
401 402
402 sbi = krealloc(sbi, sizeof(*sbi) + size, GFP_KERNEL); 403 sbi = krealloc(sbi, sizeof(*sbi) + size, GFP_KERNEL);
403 if (unlikely(!sbi)) { 404 if (unlikely(!sbi)) {
404 ret = -ENOMEM; 405 ret = -ENOMEM;
405 goto out; 406 goto out;
406 } 407 }
407 memset(&sbi->s_ods[1], 0, size - sizeof(sbi->s_ods[0])); 408 memset(&sbi->layout.s_ods[1], 0,
409 size - sizeof(sbi->layout.s_ods[0]));
408 *psbi = sbi; 410 *psbi = sbi;
409 } 411 }
410 412
@@ -427,8 +429,8 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
427 * line. We always keep them in device-table order. 429 * line. We always keep them in device-table order.
428 */ 430 */
429 if (fscb_od && osduld_device_same(fscb_od, &odi)) { 431 if (fscb_od && osduld_device_same(fscb_od, &odi)) {
430 sbi->s_ods[i] = fscb_od; 432 sbi->layout.s_ods[i] = fscb_od;
431 ++sbi->s_numdevs; 433 ++sbi->layout.s_numdevs;
432 fscb_od = NULL; 434 fscb_od = NULL;
433 continue; 435 continue;
434 } 436 }
@@ -441,8 +443,8 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
441 goto out; 443 goto out;
442 } 444 }
443 445
444 sbi->s_ods[i] = od; 446 sbi->layout.s_ods[i] = od;
445 ++sbi->s_numdevs; 447 ++sbi->layout.s_numdevs;
446 448
447 /* Read the fscb of the other devices to make sure the FS 449 /* Read the fscb of the other devices to make sure the FS
448 * partition is there. 450 * partition is there.
@@ -499,9 +501,10 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
499 goto free_sbi; 501 goto free_sbi;
500 } 502 }
501 503
502 sbi->s_ods[0] = od; 504 /* Default layout in case we do not have a device-table */
503 sbi->s_numdevs = 1; 505 sbi->layout.s_ods[0] = od;
504 sbi->s_pid = opts->pid; 506 sbi->layout.s_numdevs = 1;
507 sbi->layout.s_pid = opts->pid;
505 sbi->s_timeout = opts->timeout; 508 sbi->s_timeout = opts->timeout;
506 509
507 /* fill in some other data by hand */ 510 /* fill in some other data by hand */
@@ -514,7 +517,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
514 sb->s_bdev = NULL; 517 sb->s_bdev = NULL;
515 sb->s_dev = 0; 518 sb->s_dev = 0;
516 519
517 obj.partition = sbi->s_pid; 520 obj.partition = sbi->layout.s_pid;
518 obj.id = EXOFS_SUPER_ID; 521 obj.id = EXOFS_SUPER_ID;
519 exofs_make_credential(sbi->s_cred, &obj); 522 exofs_make_credential(sbi->s_cred, &obj);
520 523
@@ -578,13 +581,13 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
578 goto free_sbi; 581 goto free_sbi;
579 } 582 }
580 583
581 _exofs_print_device("Mounting", opts->dev_name, sbi->s_ods[0], 584 _exofs_print_device("Mounting", opts->dev_name, sbi->layout.s_ods[0],
582 sbi->s_pid); 585 sbi->layout.s_pid);
583 return 0; 586 return 0;
584 587
585free_sbi: 588free_sbi:
586 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", 589 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n",
587 opts->dev_name, sbi->s_pid, ret); 590 opts->dev_name, sbi->layout.s_pid, ret);
588 exofs_free_sbi(sbi); 591 exofs_free_sbi(sbi);
589 return ret; 592 return ret;
590} 593}
@@ -627,7 +630,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
627 uint8_t cred_a[OSD_CAP_LEN]; 630 uint8_t cred_a[OSD_CAP_LEN];
628 int ret; 631 int ret;
629 632
630 ret = exofs_get_io_state(sbi, &ios); 633 ret = exofs_get_io_state(&sbi->layout, &ios);
631 if (ret) { 634 if (ret) {
632 EXOFS_DBGMSG("exofs_get_io_state failed.\n"); 635 EXOFS_DBGMSG("exofs_get_io_state failed.\n");
633 return ret; 636 return ret;