aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-02 12:32:47 -0500
committerSage Weil <sage@newdream.net>2009-11-02 12:32:47 -0500
commit859e7b149362475672e2a996f29b8f45cbb34d82 (patch)
treeee7a68f0ff01c21f8aca68ee67af203abf69c939 /fs/ceph
parent33aa96e7430d215e2ee779f65cdad0f6d4571fe1 (diff)
ceph: init/destroy bdi in client create/destroy helpers
This keeps bdi setup/teardown in line with client life cycle. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/super.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 9b7815dfc035..0ae40bad53c4 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -508,10 +508,14 @@ static struct ceph_client *ceph_create_client(struct ceph_mount_args *args)
508 client->signed_ticket = NULL; 508 client->signed_ticket = NULL;
509 client->signed_ticket_len = 0; 509 client->signed_ticket_len = 0;
510 510
511 err = bdi_init(&client->backing_dev_info);
512 if (err < 0)
513 goto fail;
514
511 err = -ENOMEM; 515 err = -ENOMEM;
512 client->wb_wq = create_workqueue("ceph-writeback"); 516 client->wb_wq = create_workqueue("ceph-writeback");
513 if (client->wb_wq == NULL) 517 if (client->wb_wq == NULL)
514 goto fail; 518 goto fail_bdi;
515 client->pg_inv_wq = create_singlethread_workqueue("ceph-pg-invalid"); 519 client->pg_inv_wq = create_singlethread_workqueue("ceph-pg-invalid");
516 if (client->pg_inv_wq == NULL) 520 if (client->pg_inv_wq == NULL)
517 goto fail_wb_wq; 521 goto fail_wb_wq;
@@ -537,6 +541,8 @@ fail_pg_inv_wq:
537 destroy_workqueue(client->pg_inv_wq); 541 destroy_workqueue(client->pg_inv_wq);
538fail_wb_wq: 542fail_wb_wq:
539 destroy_workqueue(client->wb_wq); 543 destroy_workqueue(client->wb_wq);
544fail_bdi:
545 bdi_destroy(&client->backing_dev_info);
540fail: 546fail:
541 kfree(client); 547 kfree(client);
542 return ERR_PTR(err); 548 return ERR_PTR(err);
@@ -774,13 +780,10 @@ static int ceph_compare_super(struct super_block *sb, void *data)
774/* 780/*
775 * construct our own bdi so we can control readahead, etc. 781 * construct our own bdi so we can control readahead, etc.
776 */ 782 */
777static int ceph_init_bdi(struct super_block *sb, struct ceph_client *client) 783static int ceph_register_bdi(struct super_block *sb, struct ceph_client *client)
778{ 784{
779 int err; 785 int err;
780 786
781 err = bdi_init(&client->backing_dev_info);
782 if (err < 0)
783 return err;
784 sb->s_bdi = &client->backing_dev_info; 787 sb->s_bdi = &client->backing_dev_info;
785 788
786 /* set ra_pages based on rsize mount option? */ 789 /* set ra_pages based on rsize mount option? */
@@ -840,7 +843,7 @@ static int ceph_get_sb(struct file_system_type *fs_type,
840 if (!client->wb_pagevec_pool) 843 if (!client->wb_pagevec_pool)
841 goto out_splat; 844 goto out_splat;
842 845
843 err = ceph_init_bdi(sb, client); 846 err = ceph_register_bdi(sb, client);
844 if (err < 0) 847 if (err < 0)
845 goto out_splat; 848 goto out_splat;
846 } 849 }