Bug 1327857

Summary: fallocate + punch_hole used instead of fallocate + zero_range in glfs_discard()
Product: [Community] GlusterFS Reporter: Коренберг Марк <socketpair>
Component: fuseAssignee: Csaba Henk <csaba>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: mainlineCC: bugs, nbalacha, ndevos, pkarampu, prasanna.kalever, rgowdapp, skoduri, socketpair, vbellur
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-06 12:46:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Коренберг Марк 2016-04-16 23:54:29 UTC
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.

Comment 1 Коренберг Марк 2016-04-16 23:56:48 UTC
Additional info about this subject: http://blog.gluster.org/category/unmap

Comment 2 Niels de Vos 2016-11-28 15:39:21 UTC
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.

Comment 3 Коренберг Марк 2016-11-28 16:27:21 UTC
I have lost interest to GlusterFS, sorry guys.

Comment 4 Csaba Henk 2017-09-06 12:46:34 UTC
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.