On 05/13/2014 06:36 AM, Peter Lieven wrote: > this patch introduces a new flag to indicate that we are going to sequentially > read from a file and do not plan to reread/reuse the data after it has been read. > > The current use of this flag is to open the source(s) of a qemu-img convert > process. If a protocol from block/raw-posix.c is used posix_fadvise is utilized > to advise to the kernel that we are going to read sequentially from the > file and a POSIX_FADV_DONTNEED advise is issued after each write to indicate > that there is no advantage keeping the blocks in the buffers. > > Consider the following test case that was created to confirm the behaviour of > the new flag: > > A 10G logical volume was created and filled with random data. > Then the logical volume was exported via qemu-img convert to an iscsi target. > Before the export was started all caches of the linux kernel where dropped. > > Old behavior: > - The convert process took 3m45s and the buffer cache grew up to 9.67 GB close > to the end of the conversion. After qemu-img terminated all the buffers were > freed by the kernel. > > New behavior with the -N switch: > - The convert process took 3m43s and the buffer cache grew up to 15.48 MB close > to the end with some small peaks up to 30 MB during the conversion. > > Signed-off-by: Peter Lieven > --- > v2->v3: - rebased > - fixed typo in commit msg [Fam] > v1->v2: - added test example to commit msg > - added -N knob to qemu-img > > block/raw-posix.c | 14 ++++++++++++++ > include/block/block.h | 1 + > qemu-img-cmds.hx | 4 ++-- > qemu-img.c | 15 ++++++++++++--- > qemu-img.texi | 9 ++++++++- > 5 files changed, 37 insertions(+), 6 deletions(-) Reviewed-by: Eric Blake -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org