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