While this looks generally good to me, I have another nitpick to avoid code duplication. What about just renaming lo_discard to lo_fallocate and pass the mode (possibly minus the FALLOC_FL_KEEP_SIZE flag) to it? The in the do_req_filebacked we could further simplify it down to: case REQ_OP_WRITE_ZEROES: /* * If the caller doesn't want deallocation, call zeroout to * write zeroes the range. Otherwise, punch them out. */ return lo_fallocate(lo, rq, pos, (rq->cmd_flags & REQ_NOUNMAP) ? FALLOC_FL_ZERO_RANGE : FALLOC_FL_PUNCH_HOLE); break; case REQ_OP_DISCARD: return lo_fallocate(lo, rq, pos, FALLOC_FL_PUNCH_HOLE);