aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dlm/config.c')
-rw-r--r--fs/dlm/config.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index eac23bd288b2..492d8caaaf25 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -41,16 +41,20 @@ struct comm;
41struct nodes; 41struct nodes;
42struct node; 42struct node;
43 43
44static struct config_group *make_cluster(struct config_group *, const char *); 44static int make_cluster(struct config_group *, const char *,
45 struct config_group **);
45static void drop_cluster(struct config_group *, struct config_item *); 46static void drop_cluster(struct config_group *, struct config_item *);
46static void release_cluster(struct config_item *); 47static void release_cluster(struct config_item *);
47static struct config_group *make_space(struct config_group *, const char *); 48static int make_space(struct config_group *, const char *,
49 struct config_group **);
48static void drop_space(struct config_group *, struct config_item *); 50static void drop_space(struct config_group *, struct config_item *);
49static void release_space(struct config_item *); 51static void release_space(struct config_item *);
50static struct config_item *make_comm(struct config_group *, const char *); 52static int make_comm(struct config_group *, const char *,
53 struct config_item **);
51static void drop_comm(struct config_group *, struct config_item *); 54static void drop_comm(struct config_group *, struct config_item *);
52static void release_comm(struct config_item *); 55static void release_comm(struct config_item *);
53static struct config_item *make_node(struct config_group *, const char *); 56static int make_node(struct config_group *, const char *,
57 struct config_item **);
54static void drop_node(struct config_group *, struct config_item *); 58static void drop_node(struct config_group *, struct config_item *);
55static void release_node(struct config_item *); 59static void release_node(struct config_item *);
56 60
@@ -392,8 +396,8 @@ static struct node *to_node(struct config_item *i)
392 return i ? container_of(i, struct node, item) : NULL; 396 return i ? container_of(i, struct node, item) : NULL;
393} 397}
394 398
395static struct config_group *make_cluster(struct config_group *g, 399static int make_cluster(struct config_group *g, const char *name,
396 const char *name) 400 struct config_group **new_g)
397{ 401{
398 struct cluster *cl = NULL; 402 struct cluster *cl = NULL;
399 struct spaces *sps = NULL; 403 struct spaces *sps = NULL;
@@ -431,14 +435,15 @@ static struct config_group *make_cluster(struct config_group *g,
431 435
432 space_list = &sps->ss_group; 436 space_list = &sps->ss_group;
433 comm_list = &cms->cs_group; 437 comm_list = &cms->cs_group;
434 return &cl->group; 438 *new_g = &cl->group;
439 return 0;
435 440
436 fail: 441 fail:
437 kfree(cl); 442 kfree(cl);
438 kfree(gps); 443 kfree(gps);
439 kfree(sps); 444 kfree(sps);
440 kfree(cms); 445 kfree(cms);
441 return NULL; 446 return -ENOMEM;
442} 447}
443 448
444static void drop_cluster(struct config_group *g, struct config_item *i) 449static void drop_cluster(struct config_group *g, struct config_item *i)
@@ -466,7 +471,8 @@ static void release_cluster(struct config_item *i)
466 kfree(cl); 471 kfree(cl);
467} 472}
468 473
469static struct config_group *make_space(struct config_group *g, const char *name) 474static int make_space(struct config_group *g, const char *name,
475 struct config_group **new_g)
470{ 476{
471 struct space *sp = NULL; 477 struct space *sp = NULL;
472 struct nodes *nds = NULL; 478 struct nodes *nds = NULL;
@@ -489,13 +495,14 @@ static struct config_group *make_space(struct config_group *g, const char *name)
489 INIT_LIST_HEAD(&sp->members); 495 INIT_LIST_HEAD(&sp->members);
490 mutex_init(&sp->members_lock); 496 mutex_init(&sp->members_lock);
491 sp->members_count = 0; 497 sp->members_count = 0;
492 return &sp->group; 498 *new_g = &sp->group;
499 return 0;
493 500
494 fail: 501 fail:
495 kfree(sp); 502 kfree(sp);
496 kfree(gps); 503 kfree(gps);
497 kfree(nds); 504 kfree(nds);
498 return NULL; 505 return -ENOMEM;
499} 506}
500 507
501static void drop_space(struct config_group *g, struct config_item *i) 508static void drop_space(struct config_group *g, struct config_item *i)
@@ -522,19 +529,21 @@ static void release_space(struct config_item *i)
522 kfree(sp); 529 kfree(sp);
523} 530}
524 531
525static struct config_item *make_comm(struct config_group *g, const char *name) 532static int make_comm(struct config_group *g, const char *name,
533 struct config_item **new_i)
526{ 534{
527 struct comm *cm; 535 struct comm *cm;
528 536
529 cm = kzalloc(sizeof(struct comm), GFP_KERNEL); 537 cm = kzalloc(sizeof(struct comm), GFP_KERNEL);
530 if (!cm) 538 if (!cm)
531 return NULL; 539 return -ENOMEM;
532 540
533 config_item_init_type_name(&cm->item, name, &comm_type); 541 config_item_init_type_name(&cm->item, name, &comm_type);
534 cm->nodeid = -1; 542 cm->nodeid = -1;
535 cm->local = 0; 543 cm->local = 0;
536 cm->addr_count = 0; 544 cm->addr_count = 0;
537 return &cm->item; 545 *new_i = &cm->item;
546 return 0;
538} 547}
539 548
540static void drop_comm(struct config_group *g, struct config_item *i) 549static void drop_comm(struct config_group *g, struct config_item *i)
@@ -554,14 +563,15 @@ static void release_comm(struct config_item *i)
554 kfree(cm); 563 kfree(cm);
555} 564}
556 565
557static struct config_item *make_node(struct config_group *g, const char *name) 566static int make_node(struct config_group *g, const char *name,
567 struct config_item **new_i)
558{ 568{
559 struct space *sp = to_space(g->cg_item.ci_parent); 569 struct space *sp = to_space(g->cg_item.ci_parent);
560 struct node *nd; 570 struct node *nd;
561 571
562 nd = kzalloc(sizeof(struct node), GFP_KERNEL); 572 nd = kzalloc(sizeof(struct node), GFP_KERNEL);
563 if (!nd) 573 if (!nd)
564 return NULL; 574 return -ENOMEM;
565 575
566 config_item_init_type_name(&nd->item, name, &node_type); 576 config_item_init_type_name(&nd->item, name, &node_type);
567 nd->nodeid = -1; 577 nd->nodeid = -1;
@@ -573,7 +583,8 @@ static struct config_item *make_node(struct config_group *g, const char *name)
573 sp->members_count++; 583 sp->members_count++;
574 mutex_unlock(&sp->members_lock); 584 mutex_unlock(&sp->members_lock);
575 585
576 return &nd->item; 586 *new_i = &nd->item;
587 return 0;
577} 588}
578 589
579static void drop_node(struct config_group *g, struct config_item *i) 590static void drop_node(struct config_group *g, struct config_item *i)