Message ID | b2a8123d49958e882ea0fb0be6573adbf40be5f7.1507072136.git.shli@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 6aa739f..7269341 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -426,6 +426,9 @@ static int lo_discard(struct loop_device *lo, struct request *rq, loff_t pos) int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; int ret; + if (req_op(rq) == REQ_OP_WRITE_ZEROES) + mode = FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE; + if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { ret = -EOPNOTSUPP; goto out;