Lines Matching refs:ldb
354 unsigned long base, struct ldmdb *ldb) in ldm_validate_tocblocks() argument
364 BUG_ON(!state || !ldb); in ldm_validate_tocblocks()
365 ph = &ldb->ph; in ldm_validate_tocblocks()
366 tb[0] = &ldb->toc; in ldm_validate_tocblocks()
428 unsigned long base, struct ldmdb *ldb) in ldm_validate_vmdb() argument
436 BUG_ON (!state || !ldb); in ldm_validate_vmdb()
438 vm = &ldb->vm; in ldm_validate_vmdb()
439 toc = &ldb->toc; in ldm_validate_vmdb()
538 static struct vblk * ldm_get_disk_objid (const struct ldmdb *ldb) in ldm_get_disk_objid() argument
542 BUG_ON (!ldb); in ldm_get_disk_objid()
544 list_for_each (item, &ldb->v_disk) { in ldm_get_disk_objid()
546 if (uuid_equal(&v->vblk.disk.disk_id, &ldb->ph.disk_id)) in ldm_get_disk_objid()
571 const struct ldmdb *ldb) in ldm_create_data_partitions() argument
579 BUG_ON (!pp || !ldb); in ldm_create_data_partitions()
581 disk = ldm_get_disk_objid (ldb); in ldm_create_data_partitions()
590 list_for_each (item, &ldb->v_part) { in ldm_create_data_partitions()
597 put_partition (pp, part_num, ldb->ph.logical_disk_start + in ldm_create_data_partitions()
1156 static bool ldm_ldmdb_add (u8 *data, int len, struct ldmdb *ldb) in ldm_ldmdb_add() argument
1161 BUG_ON (!data || !ldb); in ldm_ldmdb_add()
1178 list_add (&vb->list, &ldb->v_dgrp); in ldm_ldmdb_add()
1182 list_add (&vb->list, &ldb->v_disk); in ldm_ldmdb_add()
1185 list_add (&vb->list, &ldb->v_volu); in ldm_ldmdb_add()
1188 list_add (&vb->list, &ldb->v_comp); in ldm_ldmdb_add()
1192 list_for_each (item, &ldb->v_part) { in ldm_ldmdb_add()
1200 list_add_tail (&vb->list, &ldb->v_part); in ldm_ldmdb_add()
1309 static bool ldm_frag_commit (struct list_head *frags, struct ldmdb *ldb) in ldm_frag_commit() argument
1314 BUG_ON (!frags || !ldb); in ldm_frag_commit()
1325 if (!ldm_ldmdb_add (f->data, f->num*ldb->vm.vblk_size, ldb)) in ldm_frag_commit()
1344 struct ldmdb *ldb) in ldm_get_vblks() argument
1352 BUG_ON(!state || !ldb); in ldm_get_vblks()
1354 size = ldb->vm.vblk_size; in ldm_get_vblks()
1356 skip = ldb->vm.vblk_offset >> 9; /* Bytes to sectors */ in ldm_get_vblks()
1357 finish = (size * ldb->vm.last_vblk_seq) >> 9; in ldm_get_vblks()
1374 if (!ldm_ldmdb_add (data, size, ldb)) in ldm_get_vblks()
1386 result = ldm_frag_commit (&frags, ldb); /* Failures, already logged */ in ldm_get_vblks()
1433 struct ldmdb *ldb; in ldm_partition() local
1443 ldb = kmalloc (sizeof (*ldb), GFP_KERNEL); in ldm_partition()
1444 if (!ldb) { in ldm_partition()
1450 if (!ldm_validate_privheads(state, &ldb->ph)) in ldm_partition()
1454 base = ldb->ph.config_start; in ldm_partition()
1457 if (!ldm_validate_tocblocks(state, base, ldb) || in ldm_partition()
1458 !ldm_validate_vmdb(state, base, ldb)) in ldm_partition()
1462 INIT_LIST_HEAD (&ldb->v_dgrp); in ldm_partition()
1463 INIT_LIST_HEAD (&ldb->v_disk); in ldm_partition()
1464 INIT_LIST_HEAD (&ldb->v_volu); in ldm_partition()
1465 INIT_LIST_HEAD (&ldb->v_comp); in ldm_partition()
1466 INIT_LIST_HEAD (&ldb->v_part); in ldm_partition()
1468 if (!ldm_get_vblks(state, base, ldb)) { in ldm_partition()
1474 if (ldm_create_data_partitions(state, ldb)) { in ldm_partition()
1481 ldm_free_vblks (&ldb->v_dgrp); in ldm_partition()
1482 ldm_free_vblks (&ldb->v_disk); in ldm_partition()
1483 ldm_free_vblks (&ldb->v_volu); in ldm_partition()
1484 ldm_free_vblks (&ldb->v_comp); in ldm_partition()
1485 ldm_free_vblks (&ldb->v_part); in ldm_partition()
1487 kfree (ldb); in ldm_partition()