qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] hostmem-file: add a property 'notrunc' to avoid


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH] hostmem-file: add a property 'notrunc' to avoid data corruption
Date: Fri, 21 Oct 2016 09:56:20 -0200
User-agent: Mutt/1.7.0 (2016-08-17)

On Fri, Oct 21, 2016 at 01:07:00PM +0200, Igor Mammedov wrote:
[...]
> How about following behavior:
> 
>  1) memory-backend-file,mem-path=/some_dir,size=2G
>     - uses truncate to extend temporary file created in "mem-path" to 'size'
>     for this case to work 'size' is mandatory
> 
>  2) memory-backend-file,mem-path=/existing_file,size=2G
>     - uses truncate to extend/shrink file "mem-path" to 'size'
>     for this case 'size' could be made optional,
>     if we take in account that backend could be used as persistent
>     storage then shrinking or extending "mem-path" would be corruption
>     as backend has no idea about internal layout if mapped file.
>     We can do something like this here:
> 
>     if (is_size_opt_provided and size_of(mem-path) != 0) {
>        error_out with "mem-path=foo size XXX doesn't match 'size=xxx' option"
>     } else if (is_size_opt_provided and size_of(mem-path) == 0) {
>        // may be we don't need this case and
>        // just fold this in above error case
>        truncate(mem-path) // extend/shrink
>     } else {
>       set_size_opt(size_of(mem-path))
>     }

Agreed.

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]