Lines Matching refs:vol
128 struct ubi_volume *vol = re->desc->vol;
129 struct ubi_vtbl_record *vtbl_rec = &ubi->vtbl[vol->vol_id];
526 struct ubi_volume *vol;
534 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL);
535 if (!vol)
538 vol->reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
539 vol->alignment = be32_to_cpu(vtbl[i].alignment);
540 vol->data_pad = be32_to_cpu(vtbl[i].data_pad);
541 vol->upd_marker = vtbl[i].upd_marker;
542 vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
544 vol->name_len = be16_to_cpu(vtbl[i].name_len);
545 vol->usable_leb_size = ubi->leb_size - vol->data_pad;
546 memcpy(vol->name, vtbl[i].name, vol->name_len);
547 vol->name[vol->name_len] = '\0';
548 vol->vol_id = i;
551 vol->skip_check = 1;
558 kfree(vol);
566 ubi->volumes[i] = vol;
568 vol->ubi = ubi;
569 reserved_pebs += vol->reserved_pebs;
572 * We use ubi->peb_count and not vol->reserved_pebs because
577 err = ubi_fastmap_init_checkmap(vol, ubi->peb_count);
585 if (vol->vol_type == UBI_DYNAMIC_VOLUME) {
586 vol->used_ebs = vol->reserved_pebs;
587 vol->last_eb_bytes = vol->usable_leb_size;
588 vol->used_bytes =
589 (long long)vol->used_ebs * vol->usable_leb_size;
614 vol->corrupted = 1;
618 vol->used_ebs = av->used_ebs;
619 vol->used_bytes =
620 (long long)(vol->used_ebs - 1) * vol->usable_leb_size;
621 vol->used_bytes += av->last_data_size;
622 vol->last_eb_bytes = av->last_data_size;
626 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL);
627 if (!vol)
630 vol->reserved_pebs = UBI_LAYOUT_VOLUME_EBS;
631 vol->alignment = UBI_LAYOUT_VOLUME_ALIGN;
632 vol->vol_type = UBI_DYNAMIC_VOLUME;
633 vol->name_len = sizeof(UBI_LAYOUT_VOLUME_NAME) - 1;
634 memcpy(vol->name, UBI_LAYOUT_VOLUME_NAME, vol->name_len + 1);
635 vol->usable_leb_size = ubi->leb_size;
636 vol->used_ebs = vol->reserved_pebs;
637 vol->last_eb_bytes = vol->reserved_pebs;
638 vol->used_bytes =
639 (long long)vol->used_ebs * (ubi->leb_size - vol->data_pad);
640 vol->vol_id = UBI_LAYOUT_VOLUME_ID;
641 vol->ref_count = 1;
644 ubi->volumes[vol_id2idx(ubi, vol->vol_id)] = vol;
645 reserved_pebs += vol->reserved_pebs;
647 vol->ubi = ubi;
648 err = ubi_fastmap_init_checkmap(vol, UBI_LAYOUT_VOLUME_EBS);
668 * @vol: UBI volume description object
674 static int check_av(const struct ubi_volume *vol,
679 if (av->highest_lnum >= vol->reserved_pebs) {
683 if (av->leb_count > vol->reserved_pebs) {
687 if (av->vol_type != vol->vol_type) {
691 if (av->used_ebs > vol->reserved_pebs) {
695 if (av->data_pad != vol->data_pad) {
702 ubi_err(vol->ubi, "bad attaching information, error %d", err);
704 ubi_dump_vol_info(vol);
723 struct ubi_volume *vol;
742 vol = ubi->volumes[i];
743 if (!vol) {
749 if (vol->reserved_pebs == 0) {
765 err = check_av(vol, av);