From: Eduardo Habkost <ehabkost@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: Haozhong Zhang <haozhong.zhang@intel.com>,
kwolf@redhat.com, Xiao Guangrong <guangrong.xiao@linux.intel.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
qemu-devel@nongnu.org, mreitz@redhat.com,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] hostmem-file: add a property 'notrunc' to avoid data corruption
Date: Fri, 21 Oct 2016 09:56:20 -0200 [thread overview]
Message-ID: <20161021115620.GN5057@thinpad.lan.raisama.net> (raw)
In-Reply-To: <20161021130700.7beff8d3@nial.brq.redhat.com>
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
next prev parent reply other threads:[~2016-10-21 11:56 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-20 6:13 [Qemu-devel] [PATCH] hostmem-file: add a property 'notrunc' to avoid data corruption Haozhong Zhang
2016-10-20 6:35 ` no-reply
2016-10-20 12:34 ` Igor Mammedov
2016-10-20 13:11 ` Haozhong Zhang
2016-10-20 13:34 ` Eduardo Habkost
2016-10-20 13:47 ` Haozhong Zhang
2016-10-20 13:42 ` Igor Mammedov
2016-10-20 13:56 ` Eduardo Habkost
2016-10-20 14:15 ` Igor Mammedov
2016-10-20 14:47 ` Eduardo Habkost
2016-10-20 15:35 ` Igor Mammedov
2016-10-20 16:56 ` Eduardo Habkost
2016-10-21 9:31 ` Igor Mammedov
2016-10-21 11:53 ` Eduardo Habkost
2016-10-21 13:26 ` Igor Mammedov
2016-10-21 7:22 ` Haozhong Zhang
2016-10-21 11:07 ` Igor Mammedov
2016-10-21 11:25 ` Haozhong Zhang
2016-10-21 11:56 ` Eduardo Habkost [this message]
2016-10-20 14:22 ` Haozhong Zhang
2016-10-20 15:14 ` Eduardo Habkost
2016-10-20 13:56 ` Haozhong Zhang
2016-10-20 13:21 ` Eduardo Habkost
2016-10-20 13:33 ` Haozhong Zhang
2016-10-20 13:47 ` Eduardo Habkost
2016-10-20 14:17 ` Igor Mammedov
2016-10-20 15:15 ` Eduardo Habkost
2016-10-20 15:41 ` Igor Mammedov
2016-10-20 16:59 ` Eduardo Habkost
2016-10-21 10:28 ` Igor Mammedov
2016-10-21 11:44 ` Eduardo Habkost
2016-10-20 13:47 ` Igor Mammedov
2016-10-20 13:57 ` Eduardo Habkost
2016-10-20 14:18 ` Igor Mammedov
2016-10-20 15:00 ` Eduardo Habkost
2016-10-20 15:14 ` Igor Mammedov
2016-10-20 13:27 ` Daniel P. Berrange
2016-10-20 13:40 ` Eduardo Habkost
2016-10-20 13:54 ` Igor Mammedov
2016-10-20 13:55 ` Kevin Wolf
2016-10-24 13:10 ` Eduardo Habkost
2016-10-25 6:42 ` Haozhong Zhang
2016-10-25 10:01 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161021115620.GN5057@thinpad.lan.raisama.net \
--to=ehabkost@redhat.com \
--cc=crosthwaite.peter@gmail.com \
--cc=guangrong.xiao@linux.intel.com \
--cc=haozhong.zhang@intel.com \
--cc=imammedo@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).