Thread (8 messages) 8 messages, 2 authors, 2017-09-07
STALE3221d
Revisions (2)
  1. v2 current
  2. v3 [diff vs current]

[PATCH V2 3/3] block/loop: suppress discard IO error message

From: Shaohua Li <shli@kernel.org>
Date: 2017-09-07 00:13:26
Subsystem: block layer, the rest · Maintainers: Jens Axboe, Linus Torvalds

From: Shaohua Li <redacted>

We don't know if fallocate really supports FALLOC_FL_PUNCH_HOLE till
fallocate is called. If it doesn't support, loop will return -EOPNOTSUPP
and we see a lot of error message printed by blk_update_request. Failure
for discard IO isn't a big problem, so we just return 0 in loop which
will suppress the IO error message.

Signed-off-by: Shaohua Li <redacted>
---
 drivers/block/loop.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 8934e25..9d4545f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -437,6 +437,9 @@ static int lo_discard(struct loop_device *lo, struct request *rq, loff_t pos)
 	ret = file->f_op->fallocate(file, mode, pos, blk_rq_bytes(rq));
 	if (unlikely(ret && ret != -EINVAL && ret != -EOPNOTSUPP))
 		ret = -EIO;
+
+	if (req_op(rq) == REQ_OP_DISCARD && ret == -EOPNOTSUPP)
+		ret = 0;
  out:
 	return ret;
 }
-- 
2.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help