Home | History | Annotate | Download | only in block

Lines Matching refs:cluster_offset

79 static int decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset);
259 uint64_t l2_offset, *l2_table, cluster_offset, tmp;
318 cluster_offset = be64_to_cpu(l2_table[l2_index]);
319 if (!cluster_offset ||
320 ((cluster_offset & QCOW_OFLAG_COMPRESSED) && allocate == 1)) {
324 if ((cluster_offset & QCOW_OFLAG_COMPRESSED) &&
329 if (decompress_cluster(bs, cluster_offset) < 0)
331 cluster_offset = bdrv_getlength(bs->file);
332 cluster_offset = (cluster_offset + s->cluster_size - 1) &
335 if (bdrv_pwrite(bs->file, cluster_offset, s->cluster_cache, s->cluster_size) !=
339 cluster_offset = bdrv_getlength(bs->file);
342 cluster_offset = (cluster_offset + s->cluster_size - 1) &
344 bdrv_truncate(bs->file, cluster_offset + s->cluster_size);
358 if (bdrv_pwrite(bs->file, cluster_offset + i * 512,
365 cluster_offset |= QCOW_OFLAG_COMPRESSED |
370 tmp = cpu_to_be64(cluster_offset);
376 return cluster_offset;
384 uint64_t cluster_offset;
386 cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0);
392 return (cluster_offset != 0);
422 static int decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset)
428 coffset = cluster_offset & s->cluster_offset_mask;
430 csize = cluster_offset >> (63 - s->cluster_bits);
451 uint64_t cluster_offset;
454 cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0);
459 if (!cluster_offset) {
468 } else if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
469 if (decompress_cluster(bs, cluster_offset) < 0)
473 ret = bdrv_pread(bs->file, cluster_offset + index_in_cluster * 512, buf, n * 512);
497 uint64_t cluster_offset;
538 acb->cluster_offset = 0;
555 if (!acb->cluster_offset) {
557 } else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) {
578 acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9,
585 if (!acb->cluster_offset) {
600 } else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) {
602 if (decompress_cluster(bs, acb->cluster_offset) < 0)
608 if ((acb->cluster_offset & 511) != 0) {
616 (acb->cluster_offset >> 9) + index_in_cluster,
653 uint64_t cluster_offset;
675 cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, 1, 0,
678 if (!cluster_offset || (cluster_offset & 511) != 0) {
701 (cluster_offset >> 9) + index_in_cluster,
862 uint64_t cluster_offset;
900 cluster_offset = get_cluster_offset(bs, sector_num << 9, 2,
902 cluster_offset &= s->cluster_offset_mask;
903 if (bdrv_pwrite(bs->file, cluster_offset, out_buf, out_len) != out_len) {