On 09/16/2011 12:17 PM, Alex Bligh wrote:
Scratch that, make that "need to > have error handling", period.If PUNCH_HOLE fails, can't you just translate it to a write of zeros over the area, and use the normal error handling for that? If we can't TRIM (which might be for reasons quite opaque to the client), I think we ought to do the right thing (ensure a read will read zeroes) and return success.
We do not set discard_write_zeroes in the module, so TRIM is purely an optimization and it's okay to fail it.
As to how to test it, you can create a non-sparse file and check st_blocks with stat, to confirm that it now contains a hole.
Paolo