All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] callout to *file in bdrv_co_get_block_status
@ 2017-03-17 10:45 Peter Lieven
  2017-03-17 10:59 ` Paolo Bonzini
  0 siblings, 1 reply; 23+ messages in thread
From: Peter Lieven @ 2017-03-17 10:45 UTC (permalink / raw)
  To: qemu block, qemu-devel; +Cc: Fam Zheng, Paolo Bonzini

Hi,


I tried to debug why qemu-img convert with a VMDK source laying on a tmpfs is horrible slow.

For some reason a lseek on a tmpfs is slow. Strictly speaking the lseek in find_allocation in file-posix.c

is slow.


When qemu-img convert iterates over all sectors of a VMDK file to check their allocation status it ends

up checking allocation status of all allocated sectors due to the following condition in bdrv_co_get_block_status:


    if (*file && *file != bs &&
        (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) &&
        (ret & BDRV_BLOCK_OFFSET_VALID)) {
        BlockDriverState *file2;
        int file_pnum;
        ret2 = bdrv_co_get_block_status(*file, ret >> BDRV_SECTOR_BITS,
                                        *pnum, &file_pnum, &file2);
        if (ret2 >= 0) {
            /* Ignore errors.  This is just providing extra information, it
             * is useful but not necessary.
             */
            if (!file_pnum) {
                /* !file_pnum indicates an offset at or beyond the EOF; it is
                 * perfectly valid for the format block driver to point to such
                 * offsets, so catch it and mark everything as zero */
                ret |= BDRV_BLOCK_ZERO;
            } else {
                /* Limit request to the range reported by the protocol driver */
                *pnum = file_pnum;
                ret |= (ret2 & BDRV_BLOCK_ZERO);
            }
        }
    }


Does anybody remember for what circumstances this case this was added? In case of an container format

like VMDK or QCOW2 shouldn't we trust the information from the l2 tables in the VMDK or QCOW2?


Thanks,

Peter

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-03-31 10:20 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-17 10:45 [Qemu-devel] callout to *file in bdrv_co_get_block_status Peter Lieven
2017-03-17 10:59 ` Paolo Bonzini
2017-03-17 11:11   ` Peter Lieven
2017-03-17 11:16     ` Paolo Bonzini
2017-03-17 11:20       ` Peter Lieven
2017-03-20  2:46         ` Fam Zheng
2017-03-20 11:21           ` Paolo Bonzini
2017-03-20 11:49             ` Fam Zheng
2017-03-20 12:17               ` Peter Lieven
2017-03-20 12:47               ` Peter Lieven
2017-03-20 13:13                 ` Peter Lieven
2017-03-20 13:23                   ` Paolo Bonzini
2017-03-20 13:35                     ` Peter Lieven
2017-03-20 14:05                       ` Paolo Bonzini
2017-03-20 16:43                         ` Peter Lieven
2017-03-20 16:56                           ` Paolo Bonzini
2017-03-27 13:21                             ` Peter Lieven
2017-03-27 15:06                               ` Paolo Bonzini
2017-03-31  7:55                                 ` Peter Lieven
2017-03-31 10:20                                   ` Paolo Bonzini
2017-03-17 11:24       ` Fam Zheng
2017-03-17 14:51         ` Paolo Bonzini
2017-03-18 16:16           ` Peter Lieven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.