primarily, problem happen with qemu with glusterfs backend. Since underlaying FS is ext4, when libglusterfs punches holes with FALLOC_FL_PUNCH_HOLE, it makes files heavy fragmented. Instead of this, FALLOC_FL_ZERO_RANG may be used. FALLOC_FL_ZERO_RANG must also pass discard requests to underlaying block device, so, feature used in qemu still be achieved. 1. Does FUSE allows to implement both fallocate cases ? 2. How does these cases handled in GlusterFS ? I mean usage through FUSE. 3. I suggest API change in order to able to handle both cases in libglusterfs. 4. QEMU glusterfs backend should be configurable how to pass discards from guest fs - using FALLOC_FL_ZERO_RANGE or FALLOC_FL_PUNCH_HOLE. Please comment all 4 points.
Additional info about this subject: http://blog.gluster.org/category/unmap
A related question came up on the mailinglist: http://www.gluster.org/pipermail/gluster-devel/2016-November/051610.html (In reply to Коренберг Марк from comment #0) > primarily, problem happen with qemu with glusterfs backend. Since > underlaying FS is ext4, when libglusterfs punches holes with > FALLOC_FL_PUNCH_HOLE, it makes files heavy fragmented. Instead of this, > FALLOC_FL_ZERO_RANG may be used. FALLOC_FL_ZERO_RANG must also pass discard > requests to underlaying block device, so, feature used in qemu still be > achieved. > > 1. Does FUSE allows to implement both fallocate cases ? Yes, it seems so. At least we account for both flags in fuse-bridge.c: https://github.com/gluster/glusterfs/commit/17f28717 > 2. How does these cases handled in GlusterFS ? I mean usage through FUSE. See https://github.com/gluster/glusterfs/commit/17f28717 > 3. I suggest API change in order to able to handle both cases in > libglusterfs. Can you be a bit more specific on the suggested change? Note that the protocol and functions in libgfapi should stay backwards compatible. > 4. QEMU glusterfs backend should be configurable how to pass discards from > guest fs - using FALLOC_FL_ZERO_RANGE or FALLOC_FL_PUNCH_HOLE. This is something that we could add to the Gluster block-driver in QEMU.
I have lost interest to GlusterFS, sorry guys.
OP's request is more open-ended than to be able to take action on it, and he lost interested in the problem. Moreover, it seems the problem spans QEMU & GlusterFS projects, so a mere GlusterFS bug is not the best way to capture it.