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

Re: [Nbd] fua, trim, etc



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: