Lines Matching full:bat
134 uint32_t bat_idx; /* BAT entry index */
872 * Calculate the number of BAT entries, including sector
906 if ((s->bat[i] & VHDX_BAT_STATE_BIT_MASK) == in vhdx_check_bat_entries()
908 uint64_t offset = s->bat[i] & VHDX_BAT_FILE_OFF_MASK; in vhdx_check_bat_entries()
917 * Check for BAT entry overflow. in vhdx_check_bat_entries()
920 error_report("VHDX BAT entry %" PRIu64 " offset overflow.", i); in vhdx_check_bat_entries()
928 * Check if fully allocated BAT entries do not reside after in vhdx_check_bat_entries()
932 error_report("VHDX BAT entry %" PRIu64 " start offset %" PRIu64 in vhdx_check_bat_entries()
942 error_report("VHDX BAT entry %" PRIu64 " end offset %" PRIu64 in vhdx_check_bat_entries()
954 * verify populated BAT field file offsets against in vhdx_check_bat_entries()
958 /* payload bat entries */ in vhdx_check_bat_entries()
988 qemu_vfree(s->bat); in vhdx_close()
989 s->bat = NULL; in vhdx_close()
1016 s->bat = NULL; in vhdx_open()
1070 /* BAT allocation is not large enough for all entries */ in vhdx_open()
1075 /* s->bat is freed in vhdx_close() */ in vhdx_open()
1076 s->bat = qemu_try_blockalign(bs->file->bs, s->bat_rt.length); in vhdx_open()
1077 if (s->bat == NULL) { in vhdx_open()
1082 ret = bdrv_pread(bs->file, s->bat_offset, s->bat_rt.length, s->bat, 0); in vhdx_open()
1087 /* endian convert populated BAT field entries */ in vhdx_open()
1089 s->bat[i] = le64_to_cpu(s->bat[i]); in vhdx_open()
1152 sinfo->file_offset = s->bat[sinfo->bat_idx] & VHDX_BAT_FILE_OFF_MASK; in vhdx_block_translate()
1209 switch (s->bat[sinfo.bat_idx] & VHDX_BAT_STATE_BIT_MASK) { in vhdx_co_readv()
1294 * Update the BAT table entry with the new file offset, and the new entry
1301 /* The BAT entry is a uint64, with 44 bits for the file offset in units of in vhdx_update_bat_table_entry()
1307 s->bat[sinfo->bat_idx] = 0; /* For PAYLOAD_BLOCK_ZERO, the in vhdx_update_bat_table_entry()
1313 s->bat[sinfo->bat_idx] = sinfo->file_offset; in vhdx_update_bat_table_entry()
1316 s->bat[sinfo->bat_idx] |= state & VHDX_BAT_STATE_BIT_MASK; in vhdx_update_bat_table_entry()
1318 *bat_entry_le = cpu_to_le64(s->bat[sinfo->bat_idx]); in vhdx_update_bat_table_entry()
1375 bat_state = s->bat[sinfo.bat_idx] & VHDX_BAT_STATE_BIT_MASK; in vhdx_co_writev()
1473 /* this will update the BAT entry into the log journal, and in vhdx_co_writev()
1494 /* keep metadata in sync, and restore the bat entry state in vhdx_co_writev()
1694 /* This create the actual BAT itself. We currently only support
1697 * Dynamic images: default state of the BAT is all zeroes.
1699 * Fixed images: default state of the BAT is fully populated, with
1717 assert(s->bat == NULL); in vhdx_create_bat()
1719 /* this gives a data start after BAT/bitmap entries, and well in vhdx_create_bat()
1726 /* All zeroes, so we can just extend the file - the end of the BAT in vhdx_create_bat()
1752 /* for a fixed file, the default BAT entry is not zero */ in vhdx_create_bat()
1753 s->bat = g_try_malloc0(length); in vhdx_create_bat()
1754 if (length && s->bat == NULL) { in vhdx_create_bat()
1755 error_setg(errp, "Failed to allocate memory for the BAT"); in vhdx_create_bat()
1762 /* fill the BAT by emulating sector writes of sectors_per_block size */ in vhdx_create_bat()
1770 s->bat[sinfo.bat_idx] = cpu_to_le64(s->bat[sinfo.bat_idx]); in vhdx_create_bat()
1773 ret = blk_co_pwrite(blk, file_offset, length, s->bat, 0); in vhdx_create_bat()
1775 error_setg_errno(errp, -ret, "Failed to write the BAT"); in vhdx_create_bat()
1783 g_free(s->bat); in vhdx_create_bat()
1788 * There are 2 supported region table entries: BAT, and Metadata/
1790 * As the calculations for the BAT region table are also needed
1791 * to create the BAT itself, we will also cause the BAT to be
1814 * pre-existing BAT calculation, translation, and update functions */ in vhdx_create_new_region_table()
1841 region_table->entry_count = 2; /* BAT and Metadata */ in vhdx_create_new_region_table()
1865 /* The region table gives us the data we need to create the BAT, in vhdx_create_new_region_table()
1906 * | Journal Log | BAT / Bitmap | Metadata | .... data ...... |
1975 /* These are pretty arbitrary, and mainly designed to keep the BAT in vhdx_co_create()
2191 * Check the subformat: Fixed images have all BAT entries present, in vhdx_has_zero_init()
2193 * therefore enough to check the first BAT entry. in vhdx_has_zero_init()
2199 state = s->bat[0] & VHDX_BAT_STATE_BIT_MASK; in vhdx_has_zero_init()