]> git.proxmox.com Git - qemu.git/commit
block/ssh: Set bdrv_has_zero_init according to the file type.
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 25 Jun 2013 17:15:18 +0000 (18:15 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 12 Aug 2013 20:25:26 +0000 (15:25 -0500)
commit90ce84993a1590074ce9b866ca389bb40b4f13b7
tree680a90c26fd41292139c5fbc59d42475f5a7342b
parent89ca606d49d15c1e582600588b5ec0145ca3b078
block/ssh: Set bdrv_has_zero_init according to the file type.

If the remote is a regular file, set it to true (ie. reads of
uninitialized areas in a newly created file will return zeroes).
If we can't prove that, return false (a safe default).

Tested by adding a debugging print statement [not part of this commit]
and creating a remote file and a remote block device:

  $ ./qemu-img create ssh://localhost/tmp/new 100M
  Formatting 'ssh://localhost/tmp/new', fmt=raw size=104857600
  filename ssh://localhost/tmp/new: has_zero_init = 1
  $ sudo lvcreate -L 1G -n tmp /dev/fedora
    Logical volume "tmp" created
  $ ./qemu-img create ssh://localhost/dev/fedora/tmp 1G
  Formatting 'ssh://localhost/dev/fedora/tmp', fmt=raw size=1073741824
  filename ssh://localhost/dev/fedora/tmp: has_zero_init = 0

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 0b3f21e6a99c025c829d342ee417f317fe2e03b2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/ssh.c