| Disk fragmentation has long been an important issue for computer systems. The advent of virtualization makes the problem of disk fragmentation more severe and complicated. Existing solutions are unable to make full use of virtualized environment to solve the problem in virtualized environment. In addition, in virtualized environment, not only physical disks, but also virtual disks have fragments. However, for Windows virtual machines, experiments show that virtual disk fragments cause considerable impact to system performance. Analysis on virtual I/O procedure and tests by a profiling tool further show that virtual disk fragments cause more overhead for communication between a virtual machine and the virtual machine monitor and even overhead all the way through virtual I/O procedure, which degrades system performance. Therefore, it is essential to eliminate virtual disk fragments.In fact, the elimination of virtual disk fragments can be realized through a kind of virtual defragmentation, which can make file mapping (a mapping from data blocks of a virtual machine file to data blocks of a virtual file system) contiguous, by only modifying metadata of virtual file system, but not moving any data blocks. To guarantee the correctness of defragmentation, actual mapping (a mapping from data blocks of a virtual machine file to data blocks of a physical file system) needs to be kept unchanged, as no data blocks have been moved. Therefore, image mapping (a mapping from data blocks of a virtual machine disk image file to data blocks of a physical file system) should be updated according to new file mapping to make actual mapping unchanged. This is Zero-copy defragmentation: to eliminate virtual file system fragments, to reduce overhead for communication between a virtual machine and the virtual machine monitor and overhead all the way through virtual I/O procedure, and to improve I/O performance of the virtual machine, without copying any data blocks.Targeting at Xen virtual machine monitor and Windows virtual machines, Zero-copy defragmentation system can obtain the information of and defragment virtual disks. Evaluation through both micro and macro benchmark shows that Zero-copy defragmentation increases virtual machine I/O performance considerably, up to 20%, nearly the same with the situation where there is no fragments. More importantly, the process of defragmentation is very rapid, only taking about 5 seconds to defragment a virtual disk sized 1GB. |