Lines Matching full:ldb
341 * @ldb: Cache of the database structures
352 unsigned long base, struct ldmdb *ldb) in ldm_validate_tocblocks() argument
362 BUG_ON(!state || !ldb); in ldm_validate_tocblocks()
363 ph = &ldb->ph; in ldm_validate_tocblocks()
364 tb[0] = &ldb->toc; in ldm_validate_tocblocks()
417 * @ldb: Cache of the database structures
420 * information in @ldb.
422 * Return: 'true' @ldb contains validated VBDB info
423 * 'false' @ldb contents are undefined
426 unsigned long base, struct ldmdb *ldb) in ldm_validate_vmdb() argument
434 BUG_ON (!state || !ldb); in ldm_validate_vmdb()
436 vm = &ldb->vm; in ldm_validate_vmdb()
437 toc = &ldb->toc; in ldm_validate_vmdb()
526 * @ldb: Cache of the database structures
536 static struct vblk * ldm_get_disk_objid (const struct ldmdb *ldb) in ldm_get_disk_objid() argument
540 BUG_ON (!ldb); in ldm_get_disk_objid()
542 list_for_each (item, &ldb->v_disk) { in ldm_get_disk_objid()
544 if (uuid_equal(&v->vblk.disk.disk_id, &ldb->ph.disk_id)) in ldm_get_disk_objid()
554 * @ldb: Cache of the database structures
569 const struct ldmdb *ldb) in ldm_create_data_partitions() argument
577 BUG_ON (!pp || !ldb); in ldm_create_data_partitions()
579 disk = ldm_get_disk_objid (ldb); in ldm_create_data_partitions()
588 list_for_each (item, &ldb->v_part) { in ldm_create_data_partitions()
595 put_partition (pp, part_num, ldb->ph.logical_disk_start + in ldm_create_data_partitions()
1145 * @ldb: Cache of the database structures
1154 static bool ldm_ldmdb_add (u8 *data, int len, struct ldmdb *ldb) in ldm_ldmdb_add() argument
1159 BUG_ON (!data || !ldb); in ldm_ldmdb_add()
1176 list_add (&vb->list, &ldb->v_dgrp); in ldm_ldmdb_add()
1180 list_add (&vb->list, &ldb->v_disk); in ldm_ldmdb_add()
1183 list_add (&vb->list, &ldb->v_volu); in ldm_ldmdb_add()
1186 list_add (&vb->list, &ldb->v_comp); in ldm_ldmdb_add()
1190 list_for_each (item, &ldb->v_part) { in ldm_ldmdb_add()
1198 list_add_tail (&vb->list, &ldb->v_part); in ldm_ldmdb_add()
1299 * @ldb: Cache of the database structures
1307 static bool ldm_frag_commit (struct list_head *frags, struct ldmdb *ldb) in ldm_frag_commit() argument
1312 BUG_ON (!frags || !ldb); in ldm_frag_commit()
1323 if (!ldm_ldmdb_add (f->data, f->num*ldb->vm.vblk_size, ldb)) in ldm_frag_commit()
1333 * @ldb: Cache of the database structures
1336 * unpacked and validated. We cache them in @ldb according to their type.
1342 struct ldmdb *ldb) in ldm_get_vblks() argument
1350 BUG_ON(!state || !ldb); in ldm_get_vblks()
1352 size = ldb->vm.vblk_size; in ldm_get_vblks()
1354 skip = ldb->vm.vblk_offset >> 9; /* Bytes to sectors */ in ldm_get_vblks()
1355 finish = (size * ldb->vm.last_vblk_seq) >> 9; in ldm_get_vblks()
1372 if (!ldm_ldmdb_add (data, size, ldb)) in ldm_get_vblks()
1384 result = ldm_frag_commit (&frags, ldb); /* Failures, already logged */ in ldm_get_vblks()
1431 struct ldmdb *ldb; in ldm_partition() local
1441 ldb = kmalloc (sizeof (*ldb), GFP_KERNEL); in ldm_partition()
1442 if (!ldb) { in ldm_partition()
1448 if (!ldm_validate_privheads(state, &ldb->ph)) in ldm_partition()
1452 base = ldb->ph.config_start; in ldm_partition()
1455 if (!ldm_validate_tocblocks(state, base, ldb) || in ldm_partition()
1456 !ldm_validate_vmdb(state, base, ldb)) in ldm_partition()
1460 INIT_LIST_HEAD (&ldb->v_dgrp); in ldm_partition()
1461 INIT_LIST_HEAD (&ldb->v_disk); in ldm_partition()
1462 INIT_LIST_HEAD (&ldb->v_volu); in ldm_partition()
1463 INIT_LIST_HEAD (&ldb->v_comp); in ldm_partition()
1464 INIT_LIST_HEAD (&ldb->v_part); in ldm_partition()
1466 if (!ldm_get_vblks(state, base, ldb)) { in ldm_partition()
1472 if (ldm_create_data_partitions(state, ldb)) { in ldm_partition()
1479 ldm_free_vblks (&ldb->v_dgrp); in ldm_partition()
1480 ldm_free_vblks (&ldb->v_disk); in ldm_partition()
1481 ldm_free_vblks (&ldb->v_volu); in ldm_partition()
1482 ldm_free_vblks (&ldb->v_comp); in ldm_partition()
1483 ldm_free_vblks (&ldb->v_part); in ldm_partition()
1485 kfree (ldb); in ldm_partition()