~bdrung/qemu-kvm/caps-lock-key-up-event

« back to all changes in this revision

Viewing changes to block/qcow2-snapshot.c

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2010-08-10 08:51:54 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810085154-ok0jzlkr75dplmc7
Tags: 0.12.5+noroms-0ubuntu1
* New upstream release
* Removed patch which is now upstream:
  0001-Fix-missing-symbols-in-.rel-.rela.plt-sections.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
        h.id_str_size = cpu_to_be16(id_str_size);
159
159
        h.name_size = cpu_to_be16(name_size);
160
160
        offset = align_offset(offset, 8);
161
 
        if (bdrv_pwrite(s->hd, offset, &h, sizeof(h)) != sizeof(h))
 
161
        if (bdrv_pwrite_sync(s->hd, offset, &h, sizeof(h)) < 0)
162
162
            goto fail;
163
163
        offset += sizeof(h);
164
 
        if (bdrv_pwrite(s->hd, offset, sn->id_str, id_str_size) != id_str_size)
 
164
        if (bdrv_pwrite_sync(s->hd, offset, sn->id_str, id_str_size) < 0)
165
165
            goto fail;
166
166
        offset += id_str_size;
167
 
        if (bdrv_pwrite(s->hd, offset, sn->name, name_size) != name_size)
 
167
        if (bdrv_pwrite_sync(s->hd, offset, sn->name, name_size) < 0)
168
168
            goto fail;
169
169
        offset += name_size;
170
170
    }
171
171
 
172
172
    /* update the various header fields */
173
173
    data64 = cpu_to_be64(snapshots_offset);
174
 
    if (bdrv_pwrite(s->hd, offsetof(QCowHeader, snapshots_offset),
175
 
                    &data64, sizeof(data64)) != sizeof(data64))
 
174
    if (bdrv_pwrite_sync(s->hd, offsetof(QCowHeader, snapshots_offset),
 
175
                    &data64, sizeof(data64)) < 0)
176
176
        goto fail;
177
177
    data32 = cpu_to_be32(s->nb_snapshots);
178
 
    if (bdrv_pwrite(s->hd, offsetof(QCowHeader, nb_snapshots),
179
 
                    &data32, sizeof(data32)) != sizeof(data32))
 
178
    if (bdrv_pwrite_sync(s->hd, offsetof(QCowHeader, nb_snapshots),
 
179
                    &data32, sizeof(data32)) < 0)
180
180
        goto fail;
181
181
 
182
182
    /* free the old snapshot table */
284
284
    for(i = 0; i < s->l1_size; i++) {
285
285
        l1_table[i] = cpu_to_be64(s->l1_table[i]);
286
286
    }
287
 
    if (bdrv_pwrite(s->hd, sn->l1_table_offset,
288
 
                    l1_table, s->l1_size * sizeof(uint64_t)) !=
289
 
        (s->l1_size * sizeof(uint64_t)))
 
287
    if (bdrv_pwrite_sync(s->hd, sn->l1_table_offset,
 
288
                    l1_table, s->l1_size * sizeof(uint64_t)) < 0)
290
289
        goto fail;
291
290
    qemu_free(l1_table);
292
291
    l1_table = NULL;
335
334
    if (bdrv_pread(s->hd, sn->l1_table_offset,
336
335
                   s->l1_table, l1_size2) != l1_size2)
337
336
        goto fail;
338
 
    if (bdrv_pwrite(s->hd, s->l1_table_offset,
339
 
                    s->l1_table, l1_size2) != l1_size2)
 
337
    if (bdrv_pwrite_sync(s->hd, s->l1_table_offset,
 
338
                    s->l1_table, l1_size2) < 0)
340
339
        goto fail;
341
340
    for(i = 0;i < s->l1_size; i++) {
342
341
        be64_to_cpus(&s->l1_table[i]);