Re: [Nbd] fua, trim, etc
- To: Alex Bligh <alex@...872...>
- Cc: Nbd-general@lists.sourceforge.net, Wouter Verhelst <w@...112...>
- Subject: Re: [Nbd] fua, trim, etc
- From: Paolo Bonzini <pbonzini@...696...>
- Date: Tue, 13 Sep 2011 13:14:01 +0200
- Message-id: <4E6F3AF9.6030204@...696...>
- In-reply-to: <6244130873C2048DD2975307@...873...>
- References: <20110910204342.GC1012@...855...> <4E6E20F6.9080106@...696...> <CAFDOyVDxa-aD9puS5C8MUk8WjzzOh71ieZ_11zL_uvTy+hP_JQ@...18...> <4E6F07C6.4090007@...696...> <8CC8512B5F1ACB6177ADC6FD@...874...> <CAFDOyVCqBpvwhXkQ9suaOdkYYBUwf1T5Zk7-QsAgEUiM0Z+ELA@...18...> <20110913103607.GG4527@...3...> <6244130873C2048DD2975307@...873...>
On 09/13/2011 12:49 PM, Alex Bligh wrote:
For instance, Paul's suggestion on setting 'rotational' using /proc
instead is definitely better than the way nbd-client does it at the
moment.
That can go in later, right?
- Make NBD_CMD_TRIM cause nbd-server to call fallocate() with
FALLOC_FL_PUNCH_HOLE.
We need to be a bit careful on these. IIRC (someone please check!)
on Linux fallocate() is an extended call that supports various stuff,
whereas posix_fallocate() is the normal POSIX call, and that doesn't
support PUNCH_HOLE. On non-Linux systems, fallocate() is the normal
POSIX call.
No, it's really called posix_fallocate elsewhere. Non-Linux system
might alias fallocate and posix_fallocate, but the name in POSIX is
really posix_fallocate.
Of course, non-Linux systems will never have FALLOC_FL_PUNCH_HOLE, so we
can assume that defined(FALLOC_FL_PUNCH_HOLE)<=>fallocate has Linux
semantics.
I /think/ we can just see if FALLOC_FL_PUNCH_HOLE is defined,
and if so, make the call, and ignore the error condition. That
way if compiled on box X and run on box Y it will still be OK.
However, I think we ought to have a config option to turn it off.
Right now it is opt-in, via --trim.
However, flush/fua should likely _not_ be opt-in, because they are
required for safety.
Paolo
Reply to:
- References:
- [Nbd] fua, trim, etc
- From: folkert <folkert@...421...>
- Re: [Nbd] fua, trim, etc
- From: Paolo Bonzini <pbonzini@...696...>
- Re: [Nbd] fua, trim, etc
- From: Folkert van Heusden <folkert.van.heusden@...17...>
- Re: [Nbd] fua, trim, etc
- From: Paolo Bonzini <pbonzini@...696...>
- Re: [Nbd] fua, trim, etc
- From: Alex Bligh <alex@...872...>
- Re: [Nbd] fua, trim, etc
- From: Folkert van Heusden <folkert@...421...>
- Re: [Nbd] fua, trim, etc
- From: Wouter Verhelst <w@...112...>
- Re: [Nbd] fua, trim, etc
- From: Alex Bligh <alex@...872...>