Re: [PATCH 1/2] kvm tool: Use mmap for working with disk image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 9 Apr 2011, Sasha Levin wrote:

Attempt to use mmap first for working with a disk image, if the attempt is failed (for example, large image on a 32bit system) fallback to using read/write.

Performance (kB/s) test using bonnie++ showed the following improvement:

Sequential write: 14%
Sequential rewrite: 15%
Sequential read: 7%
Random seek latency: 82%

Can you also please share the before and after raw data?

-struct disk_image *disk_image__new(int fd, uint64_t size, struct disk_image_operations *ops)
+static int raw_image__read_sector_mmap(struct disk_image *self, uint64_t sector, void *dst, uint32_t dst_len)
{
-	struct disk_image *self;
+	uint64_t offset = sector << SECTOR_SHIFT;

-	self		= malloc(sizeof *self);
-	if (!self)
-		return NULL;
+	if (offset + dst_len > self->size)
+		return -1;

-	self->fd	= fd;
-	self->size	= size;
-	self->ops	= ops;
+	memmove(dst, self->mapping + offset, dst_len);

Why do you want to use memmove() here? The areas cannot overlap.

			Pekka
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux