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.c251
1 files changed, 162 insertions, 89 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index c57beddcc217..274894053b02 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -40,6 +40,8 @@
40 40
41#include "exofs.h" 41#include "exofs.h"
42 42
43#define EXOFS_DBGMSG2(M...) do {} while (0)
44
43/****************************************************************************** 45/******************************************************************************
44 * MOUNT OPTIONS 46 * MOUNT OPTIONS
45 *****************************************************************************/ 47 *****************************************************************************/
@@ -208,10 +210,48 @@ static void destroy_inodecache(void)
208} 210}
209 211
210/****************************************************************************** 212/******************************************************************************
211 * SUPERBLOCK FUNCTIONS 213 * Some osd helpers
212 *****************************************************************************/ 214 *****************************************************************************/
213static const struct super_operations exofs_sops; 215void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], const struct osd_obj_id *obj)
214static const struct export_operations exofs_export_ops; 216{
217 osd_sec_init_nosec_doall_caps(cred_a, obj, false, true);
218}
219
220static int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj,
221 u64 offset, void *p, unsigned length)
222{
223 struct osd_request *or = osd_start_request(od, GFP_KERNEL);
224/* struct osd_sense_info osi = {.key = 0};*/
225 int ret;
226
227 if (unlikely(!or)) {
228 EXOFS_DBGMSG("%s: osd_start_request failed.\n", __func__);
229 return -ENOMEM;
230 }
231 ret = osd_req_read_kern(or, obj, offset, p, length);
232 if (unlikely(ret)) {
233 EXOFS_DBGMSG("%s: osd_req_read_kern failed.\n", __func__);
234 goto out;
235 }
236
237 ret = osd_finalize_request(or, 0, cred, NULL);
238 if (unlikely(ret)) {
239 EXOFS_DBGMSG("Failed to osd_finalize_request() => %d\n", ret);
240 goto out;
241 }
242
243 ret = osd_execute_request(or);
244 if (unlikely(ret))
245 EXOFS_DBGMSG("osd_execute_request() => %d\n", ret);
246 /* osd_req_decode_sense(or, ret); */
247
248out:
249 osd_end_request(or);
250 EXOFS_DBGMSG2("read_kern(0x%llx) offset=0x%llx "
251 "length=0x%llx dev=%p ret=>%d\n",
252 _LLU(obj->id), _LLU(offset), _LLU(length), od, ret);
253 return ret;
254}
215 255
216static const struct osd_attr g_attr_sb_stats = ATTR_DEF( 256static const struct osd_attr g_attr_sb_stats = ATTR_DEF(
217 EXOFS_APAGE_SB_DATA, 257 EXOFS_APAGE_SB_DATA,
@@ -223,21 +263,19 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi)
223 struct osd_attr attrs[] = { 263 struct osd_attr attrs[] = {
224 [0] = g_attr_sb_stats, 264 [0] = g_attr_sb_stats,
225 }; 265 };
226 struct exofs_io_state *ios; 266 struct ore_io_state *ios;
227 int ret; 267 int ret;
228 268
229 ret = exofs_get_io_state(&sbi->layout, &ios); 269 ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
230 if (unlikely(ret)) { 270 if (unlikely(ret)) {
231 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 271 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
232 return ret; 272 return ret;
233 } 273 }
234 274
235 ios->cred = sbi->s_cred;
236
237 ios->in_attr = attrs; 275 ios->in_attr = attrs;
238 ios->in_attr_len = ARRAY_SIZE(attrs); 276 ios->in_attr_len = ARRAY_SIZE(attrs);
239 277
240 ret = exofs_sbi_read(ios); 278 ret = ore_read(ios);
241 if (unlikely(ret)) { 279 if (unlikely(ret)) {
242 EXOFS_ERR("Error reading super_block stats => %d\n", ret); 280 EXOFS_ERR("Error reading super_block stats => %d\n", ret);
243 goto out; 281 goto out;
@@ -264,13 +302,13 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi)
264 } 302 }
265 303
266out: 304out:
267 exofs_put_io_state(ios); 305 ore_put_io_state(ios);
268 return ret; 306 return ret;
269} 307}
270 308
271static void stats_done(struct exofs_io_state *ios, void *p) 309static void stats_done(struct ore_io_state *ios, void *p)
272{ 310{
273 exofs_put_io_state(ios); 311 ore_put_io_state(ios);
274 /* Good thanks nothing to do anymore */ 312 /* Good thanks nothing to do anymore */
275} 313}
276 314
@@ -280,12 +318,12 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi)
280 struct osd_attr attrs[] = { 318 struct osd_attr attrs[] = {
281 [0] = g_attr_sb_stats, 319 [0] = g_attr_sb_stats,
282 }; 320 };
283 struct exofs_io_state *ios; 321 struct ore_io_state *ios;
284 int ret; 322 int ret;
285 323
286 ret = exofs_get_io_state(&sbi->layout, &ios); 324 ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
287 if (unlikely(ret)) { 325 if (unlikely(ret)) {
288 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 326 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
289 return ret; 327 return ret;
290 } 328 }
291 329
@@ -293,21 +331,27 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi)
293 sbi->s_ess.s_numfiles = cpu_to_le64(sbi->s_numfiles); 331 sbi->s_ess.s_numfiles = cpu_to_le64(sbi->s_numfiles);
294 attrs[0].val_ptr = &sbi->s_ess; 332 attrs[0].val_ptr = &sbi->s_ess;
295 333
296 ios->cred = sbi->s_cred; 334
297 ios->done = stats_done; 335 ios->done = stats_done;
298 ios->private = sbi; 336 ios->private = sbi;
299 ios->out_attr = attrs; 337 ios->out_attr = attrs;
300 ios->out_attr_len = ARRAY_SIZE(attrs); 338 ios->out_attr_len = ARRAY_SIZE(attrs);
301 339
302 ret = exofs_sbi_write(ios); 340 ret = ore_write(ios);
303 if (unlikely(ret)) { 341 if (unlikely(ret)) {
304 EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__); 342 EXOFS_ERR("%s: ore_write failed.\n", __func__);
305 exofs_put_io_state(ios); 343 ore_put_io_state(ios);
306 } 344 }
307 345
308 return ret; 346 return ret;
309} 347}
310 348
349/******************************************************************************
350 * SUPERBLOCK FUNCTIONS
351 *****************************************************************************/
352static const struct super_operations exofs_sops;
353static const struct export_operations exofs_export_ops;
354
311/* 355/*
312 * Write the superblock to the OSD 356 * Write the superblock to the OSD
313 */ 357 */
@@ -315,7 +359,9 @@ int exofs_sync_fs(struct super_block *sb, int wait)
315{ 359{
316 struct exofs_sb_info *sbi; 360 struct exofs_sb_info *sbi;
317 struct exofs_fscb *fscb; 361 struct exofs_fscb *fscb;
318 struct exofs_io_state *ios; 362 struct ore_comp one_comp;
363 struct ore_components comps;
364 struct ore_io_state *ios;
319 int ret = -ENOMEM; 365 int ret = -ENOMEM;
320 366
321 fscb = kmalloc(sizeof(*fscb), GFP_KERNEL); 367 fscb = kmalloc(sizeof(*fscb), GFP_KERNEL);
@@ -331,7 +377,10 @@ int exofs_sync_fs(struct super_block *sb, int wait)
331 * version). Otherwise the exofs_fscb is read-only from mkfs time. All 377 * version). Otherwise the exofs_fscb is read-only from mkfs time. All
332 * the writeable info is set in exofs_sbi_write_stats() above. 378 * the writeable info is set in exofs_sbi_write_stats() above.
333 */ 379 */
334 ret = exofs_get_io_state(&sbi->layout, &ios); 380
381 exofs_init_comps(&comps, &one_comp, sbi, EXOFS_SUPER_ID);
382
383 ret = ore_get_io_state(&sbi->layout, &comps, &ios);
335 if (unlikely(ret)) 384 if (unlikely(ret))
336 goto out; 385 goto out;
337 386
@@ -345,14 +394,12 @@ int exofs_sync_fs(struct super_block *sb, int wait)
345 fscb->s_newfs = 0; 394 fscb->s_newfs = 0;
346 fscb->s_version = EXOFS_FSCB_VER; 395 fscb->s_version = EXOFS_FSCB_VER;
347 396
348 ios->obj.id = EXOFS_SUPER_ID;
349 ios->offset = 0; 397 ios->offset = 0;
350 ios->kern_buff = fscb; 398 ios->kern_buff = fscb;
351 ios->cred = sbi->s_cred;
352 399
353 ret = exofs_sbi_write(ios); 400 ret = ore_write(ios);
354 if (unlikely(ret)) 401 if (unlikely(ret))
355 EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__); 402 EXOFS_ERR("%s: ore_write failed.\n", __func__);
356 else 403 else
357 sb->s_dirt = 0; 404 sb->s_dirt = 0;
358 405
@@ -360,7 +407,7 @@ int exofs_sync_fs(struct super_block *sb, int wait)
360 unlock_super(sb); 407 unlock_super(sb);
361out: 408out:
362 EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret); 409 EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret);
363 exofs_put_io_state(ios); 410 ore_put_io_state(ios);
364 kfree(fscb); 411 kfree(fscb);
365 return ret; 412 return ret;
366} 413}
@@ -384,15 +431,17 @@ static void _exofs_print_device(const char *msg, const char *dev_path,
384 431
385void exofs_free_sbi(struct exofs_sb_info *sbi) 432void exofs_free_sbi(struct exofs_sb_info *sbi)
386{ 433{
387 while (sbi->layout.s_numdevs) { 434 while (sbi->comps.numdevs) {
388 int i = --sbi->layout.s_numdevs; 435 int i = --sbi->comps.numdevs;
389 struct osd_dev *od = sbi->layout.s_ods[i]; 436 struct osd_dev *od = sbi->comps.ods[i];
390 437
391 if (od) { 438 if (od) {
392 sbi->layout.s_ods[i] = NULL; 439 sbi->comps.ods[i] = NULL;
393 osduld_put_device(od); 440 osduld_put_device(od);
394 } 441 }
395 } 442 }
443 if (sbi->comps.ods != sbi->_min_one_dev)
444 kfree(sbi->comps.ods);
396 kfree(sbi); 445 kfree(sbi);
397} 446}
398 447
@@ -419,8 +468,8 @@ static void exofs_put_super(struct super_block *sb)
419 msecs_to_jiffies(100)); 468 msecs_to_jiffies(100));
420 } 469 }
421 470
422 _exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0], 471 _exofs_print_device("Unmounting", NULL, sbi->comps.ods[0],
423 sbi->layout.s_pid); 472 sbi->one_comp.obj.partition);
424 473
425 bdi_destroy(&sbi->bdi); 474 bdi_destroy(&sbi->bdi);
426 exofs_free_sbi(sbi); 475 exofs_free_sbi(sbi);
@@ -501,10 +550,19 @@ static int _read_and_match_data_map(struct exofs_sb_info *sbi, unsigned numdevs,
501 return -EINVAL; 550 return -EINVAL;
502 } 551 }
503 552
553 EXOFS_DBGMSG("exofs: layout: "
554 "num_comps=%u stripe_unit=0x%x group_width=%u "
555 "group_depth=0x%llx mirrors_p1=%u raid_algorithm=%u\n",
556 numdevs,
557 sbi->layout.stripe_unit,
558 sbi->layout.group_width,
559 _LLU(sbi->layout.group_depth),
560 sbi->layout.mirrors_p1,
561 sbi->data_map.odm_raid_algorithm);
504 return 0; 562 return 0;
505} 563}
506 564
507static unsigned __ra_pages(struct exofs_layout *layout) 565static unsigned __ra_pages(struct ore_layout *layout)
508{ 566{
509 const unsigned _MIN_RA = 32; /* min 128K read-ahead */ 567 const unsigned _MIN_RA = 32; /* min 128K read-ahead */
510 unsigned ra_pages = layout->group_width * layout->stripe_unit / 568 unsigned ra_pages = layout->group_width * layout->stripe_unit /
@@ -547,13 +605,11 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
547 return !(odi->systemid_len || odi->osdname_len); 605 return !(odi->systemid_len || odi->osdname_len);
548} 606}
549 607
550static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi, 608static int exofs_read_lookup_dev_table(struct exofs_sb_info *sbi,
609 struct osd_dev *fscb_od,
551 unsigned table_count) 610 unsigned table_count)
552{ 611{
553 struct exofs_sb_info *sbi = *psbi; 612 struct ore_comp comp;
554 struct osd_dev *fscb_od;
555 struct osd_obj_id obj = {.partition = sbi->layout.s_pid,
556 .id = EXOFS_DEVTABLE_ID};
557 struct exofs_device_table *dt; 613 struct exofs_device_table *dt;
558 unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) + 614 unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) +
559 sizeof(*dt); 615 sizeof(*dt);
@@ -567,10 +623,14 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
567 return -ENOMEM; 623 return -ENOMEM;
568 } 624 }
569 625
570 fscb_od = sbi->layout.s_ods[0]; 626 sbi->comps.numdevs = 0;
571 sbi->layout.s_ods[0] = NULL; 627
572 sbi->layout.s_numdevs = 0; 628 comp.obj.partition = sbi->one_comp.obj.partition;
573 ret = exofs_read_kern(fscb_od, sbi->s_cred, &obj, 0, dt, table_bytes); 629 comp.obj.id = EXOFS_DEVTABLE_ID;
630 exofs_make_credential(comp.cred, &comp.obj);
631
632 ret = exofs_read_kern(fscb_od, comp.cred, &comp.obj, 0, dt,
633 table_bytes);
574 if (unlikely(ret)) { 634 if (unlikely(ret)) {
575 EXOFS_ERR("ERROR: reading device table\n"); 635 EXOFS_ERR("ERROR: reading device table\n");
576 goto out; 636 goto out;
@@ -588,16 +648,18 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
588 goto out; 648 goto out;
589 649
590 if (likely(numdevs > 1)) { 650 if (likely(numdevs > 1)) {
591 unsigned size = numdevs * sizeof(sbi->layout.s_ods[0]); 651 unsigned size = numdevs * sizeof(sbi->comps.ods[0]);
592 652
593 sbi = krealloc(sbi, sizeof(*sbi) + size, GFP_KERNEL); 653 /* Twice bigger table: See exofs_init_comps() and below
594 if (unlikely(!sbi)) { 654 * comment
655 */
656 sbi->comps.ods = kzalloc(size + size - 1, GFP_KERNEL);
657 if (unlikely(!sbi->comps.ods)) {
658 EXOFS_ERR("ERROR: faild allocating Device array[%d]\n",
659 numdevs);
595 ret = -ENOMEM; 660 ret = -ENOMEM;
596 goto out; 661 goto out;
597 } 662 }
598 memset(&sbi->layout.s_ods[1], 0,
599 size - sizeof(sbi->layout.s_ods[0]));
600 *psbi = sbi;
601 } 663 }
602 664
603 for (i = 0; i < numdevs; i++) { 665 for (i = 0; i < numdevs; i++) {
@@ -619,8 +681,8 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
619 * line. We always keep them in device-table order. 681 * line. We always keep them in device-table order.
620 */ 682 */
621 if (fscb_od && osduld_device_same(fscb_od, &odi)) { 683 if (fscb_od && osduld_device_same(fscb_od, &odi)) {
622 sbi->layout.s_ods[i] = fscb_od; 684 sbi->comps.ods[i] = fscb_od;
623 ++sbi->layout.s_numdevs; 685 ++sbi->comps.numdevs;
624 fscb_od = NULL; 686 fscb_od = NULL;
625 continue; 687 continue;
626 } 688 }
@@ -633,13 +695,13 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
633 goto out; 695 goto out;
634 } 696 }
635 697
636 sbi->layout.s_ods[i] = od; 698 sbi->comps.ods[i] = od;
637 ++sbi->layout.s_numdevs; 699 ++sbi->comps.numdevs;
638 700
639 /* Read the fscb of the other devices to make sure the FS 701 /* Read the fscb of the other devices to make sure the FS
640 * partition is there. 702 * partition is there.
641 */ 703 */
642 ret = exofs_read_kern(od, sbi->s_cred, &obj, 0, &fscb, 704 ret = exofs_read_kern(od, comp.cred, &comp.obj, 0, &fscb,
643 sizeof(fscb)); 705 sizeof(fscb));
644 if (unlikely(ret)) { 706 if (unlikely(ret)) {
645 EXOFS_ERR("ERROR: Malformed participating device " 707 EXOFS_ERR("ERROR: Malformed participating device "
@@ -656,13 +718,22 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
656 718
657out: 719out:
658 kfree(dt); 720 kfree(dt);
659 if (unlikely(!ret && fscb_od)) { 721 if (likely(!ret)) {
660 EXOFS_ERR( 722 unsigned numdevs = sbi->comps.numdevs;
661 "ERROR: Bad device-table container device not present\n");
662 osduld_put_device(fscb_od);
663 ret = -EINVAL;
664 }
665 723
724 if (unlikely(fscb_od)) {
725 EXOFS_ERR("ERROR: Bad device-table container device not present\n");
726 osduld_put_device(fscb_od);
727 return -EINVAL;
728 }
729 /* exofs round-robins the device table view according to inode
730 * number. We hold a: twice bigger table hence inodes can point
731 * to any device and have a sequential view of the table
732 * starting at this device. See exofs_init_comps()
733 */
734 for (i = 0; i < numdevs - 1; ++i)
735 sbi->comps.ods[i + numdevs] = sbi->comps.ods[i];
736 }
666 return ret; 737 return ret;
667} 738}
668 739
@@ -676,7 +747,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
676 struct exofs_sb_info *sbi; /*extended info */ 747 struct exofs_sb_info *sbi; /*extended info */
677 struct osd_dev *od; /* Master device */ 748 struct osd_dev *od; /* Master device */
678 struct exofs_fscb fscb; /*on-disk superblock info */ 749 struct exofs_fscb fscb; /*on-disk superblock info */
679 struct osd_obj_id obj; 750 struct ore_comp comp;
680 unsigned table_count; 751 unsigned table_count;
681 int ret; 752 int ret;
682 753
@@ -684,10 +755,6 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
684 if (!sbi) 755 if (!sbi)
685 return -ENOMEM; 756 return -ENOMEM;
686 757
687 ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY);
688 if (ret)
689 goto free_bdi;
690
691 /* use mount options to fill superblock */ 758 /* use mount options to fill superblock */
692 if (opts->is_osdname) { 759 if (opts->is_osdname) {
693 struct osd_dev_info odi = {.systemid_len = 0}; 760 struct osd_dev_info odi = {.systemid_len = 0};
@@ -695,6 +762,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
695 odi.osdname_len = strlen(opts->dev_name); 762 odi.osdname_len = strlen(opts->dev_name);
696 odi.osdname = (u8 *)opts->dev_name; 763 odi.osdname = (u8 *)opts->dev_name;
697 od = osduld_info_lookup(&odi); 764 od = osduld_info_lookup(&odi);
765 kfree(opts->dev_name);
766 opts->dev_name = NULL;
698 } else { 767 } else {
699 od = osduld_path_lookup(opts->dev_name); 768 od = osduld_path_lookup(opts->dev_name);
700 } 769 }
@@ -709,11 +778,16 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
709 sbi->layout.group_width = 1; 778 sbi->layout.group_width = 1;
710 sbi->layout.group_depth = -1; 779 sbi->layout.group_depth = -1;
711 sbi->layout.group_count = 1; 780 sbi->layout.group_count = 1;
712 sbi->layout.s_ods[0] = od;
713 sbi->layout.s_numdevs = 1;
714 sbi->layout.s_pid = opts->pid;
715 sbi->s_timeout = opts->timeout; 781 sbi->s_timeout = opts->timeout;
716 782
783 sbi->one_comp.obj.partition = opts->pid;
784 sbi->one_comp.obj.id = 0;
785 exofs_make_credential(sbi->one_comp.cred, &sbi->one_comp.obj);
786 sbi->comps.numdevs = 1;
787 sbi->comps.single_comp = EC_SINGLE_COMP;
788 sbi->comps.comps = &sbi->one_comp;
789 sbi->comps.ods = sbi->_min_one_dev;
790
717 /* fill in some other data by hand */ 791 /* fill in some other data by hand */
718 memset(sb->s_id, 0, sizeof(sb->s_id)); 792 memset(sb->s_id, 0, sizeof(sb->s_id));
719 strcpy(sb->s_id, "exofs"); 793 strcpy(sb->s_id, "exofs");
@@ -724,11 +798,11 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
724 sb->s_bdev = NULL; 798 sb->s_bdev = NULL;
725 sb->s_dev = 0; 799 sb->s_dev = 0;
726 800
727 obj.partition = sbi->layout.s_pid; 801 comp.obj.partition = sbi->one_comp.obj.partition;
728 obj.id = EXOFS_SUPER_ID; 802 comp.obj.id = EXOFS_SUPER_ID;
729 exofs_make_credential(sbi->s_cred, &obj); 803 exofs_make_credential(comp.cred, &comp.obj);
730 804
731 ret = exofs_read_kern(od, sbi->s_cred, &obj, 0, &fscb, sizeof(fscb)); 805 ret = exofs_read_kern(od, comp.cred, &comp.obj, 0, &fscb, sizeof(fscb));
732 if (unlikely(ret)) 806 if (unlikely(ret))
733 goto free_sbi; 807 goto free_sbi;
734 808
@@ -757,9 +831,11 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
757 831
758 table_count = le64_to_cpu(fscb.s_dev_table_count); 832 table_count = le64_to_cpu(fscb.s_dev_table_count);
759 if (table_count) { 833 if (table_count) {
760 ret = exofs_read_lookup_dev_table(&sbi, table_count); 834 ret = exofs_read_lookup_dev_table(sbi, od, table_count);
761 if (unlikely(ret)) 835 if (unlikely(ret))
762 goto free_sbi; 836 goto free_sbi;
837 } else {
838 sbi->comps.ods[0] = od;
763 } 839 }
764 840
765 __sbi_read_stats(sbi); 841 __sbi_read_stats(sbi);
@@ -793,20 +869,20 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
793 goto free_sbi; 869 goto free_sbi;
794 } 870 }
795 871
796 _exofs_print_device("Mounting", opts->dev_name, sbi->layout.s_ods[0], 872 ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY);
797 sbi->layout.s_pid); 873 if (ret) {
798 if (opts->is_osdname) 874 EXOFS_DBGMSG("Failed to bdi_setup_and_register\n");
799 kfree(opts->dev_name); 875 goto free_sbi;
876 }
877
878 _exofs_print_device("Mounting", opts->dev_name, sbi->comps.ods[0],
879 sbi->one_comp.obj.partition);
800 return 0; 880 return 0;
801 881
802free_sbi: 882free_sbi:
803 bdi_destroy(&sbi->bdi);
804free_bdi:
805 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", 883 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n",
806 opts->dev_name, sbi->layout.s_pid, ret); 884 opts->dev_name, sbi->one_comp.obj.partition, ret);
807 exofs_free_sbi(sbi); 885 exofs_free_sbi(sbi);
808 if (opts->is_osdname)
809 kfree(opts->dev_name);
810 return ret; 886 return ret;
811} 887}
812 888
@@ -837,7 +913,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
837{ 913{
838 struct super_block *sb = dentry->d_sb; 914 struct super_block *sb = dentry->d_sb;
839 struct exofs_sb_info *sbi = sb->s_fs_info; 915 struct exofs_sb_info *sbi = sb->s_fs_info;
840 struct exofs_io_state *ios; 916 struct ore_io_state *ios;
841 struct osd_attr attrs[] = { 917 struct osd_attr attrs[] = {
842 ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS, 918 ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS,
843 OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)), 919 OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)),
@@ -846,21 +922,18 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
846 }; 922 };
847 uint64_t capacity = ULLONG_MAX; 923 uint64_t capacity = ULLONG_MAX;
848 uint64_t used = ULLONG_MAX; 924 uint64_t used = ULLONG_MAX;
849 uint8_t cred_a[OSD_CAP_LEN];
850 int ret; 925 int ret;
851 926
852 ret = exofs_get_io_state(&sbi->layout, &ios); 927 ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
853 if (ret) { 928 if (ret) {
854 EXOFS_DBGMSG("exofs_get_io_state failed.\n"); 929 EXOFS_DBGMSG("ore_get_io_state failed.\n");
855 return ret; 930 return ret;
856 } 931 }
857 932
858 exofs_make_credential(cred_a, &ios->obj);
859 ios->cred = sbi->s_cred;
860 ios->in_attr = attrs; 933 ios->in_attr = attrs;
861 ios->in_attr_len = ARRAY_SIZE(attrs); 934 ios->in_attr_len = ARRAY_SIZE(attrs);
862 935
863 ret = exofs_sbi_read(ios); 936 ret = ore_read(ios);
864 if (unlikely(ret)) 937 if (unlikely(ret))
865 goto out; 938 goto out;
866 939
@@ -889,7 +962,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
889 buf->f_namelen = EXOFS_NAME_LEN; 962 buf->f_namelen = EXOFS_NAME_LEN;
890 963
891out: 964out:
892 exofs_put_io_state(ios); 965 ore_put_io_state(ios);
893 return ret; 966 return ret;
894} 967}
895 968