Commit b3d0ab7e60d1865bb6f6a79a77aaba22f2543236

Authored by Jens Axboe
1 parent 9df9c8b930

exofs: add bdi backing to mount session

This ensures that dirty data gets flushed properly.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 2 changed files with 10 additions and 0 deletions Side-by-side Diff

... ... @@ -35,6 +35,7 @@
35 35  
36 36 #include <linux/fs.h>
37 37 #include <linux/time.h>
  38 +#include <linux/backing-dev.h>
38 39 #include "common.h"
39 40  
40 41 /* FIXME: Remove once pnfs hits mainline
... ... @@ -92,6 +93,7 @@
92 93 struct exofs_layout layout; /* Default files layout,
93 94 * contains the variable osd_dev
94 95 * array. Keep last */
  96 + struct backing_dev_info bdi;
95 97 struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */
96 98 };
97 99  
... ... @@ -302,6 +302,7 @@
302 302 _exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0],
303 303 sbi->layout.s_pid);
304 304  
  305 + bdi_destroy(&sbi->bdi);
305 306 exofs_free_sbi(sbi);
306 307 sb->s_fs_info = NULL;
307 308 }
... ... @@ -546,6 +547,10 @@
546 547 if (!sbi)
547 548 return -ENOMEM;
548 549  
  550 + ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY);
  551 + if (ret)
  552 + goto free_bdi;
  553 +
549 554 /* use mount options to fill superblock */
550 555 od = osduld_path_lookup(opts->dev_name);
551 556 if (IS_ERR(od)) {
... ... @@ -612,6 +617,7 @@
612 617 }
613 618  
614 619 /* set up operation vectors */
  620 + sb->s_bdi = &sbi->bdi;
615 621 sb->s_fs_info = sbi;
616 622 sb->s_op = &exofs_sops;
617 623 sb->s_export_op = &exofs_export_ops;
... ... @@ -643,6 +649,8 @@
643 649 return 0;
644 650  
645 651 free_sbi:
  652 + bdi_destroy(&sbi->bdi);
  653 +free_bdi:
646 654 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n",
647 655 opts->dev_name, sbi->layout.s_pid, ret);
648 656 exofs_free_sbi(sbi);