linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] loop: Better discard for block devices
@ 2019-02-07 20:57 Evan Green
  2019-02-07 20:57 ` [PATCH v2 1/2] loop: Report EOPNOTSUPP properly Evan Green
  2019-02-07 20:57 ` [PATCH v2 2/2] loop: Better discard support for block devices Evan Green
  0 siblings, 2 replies; 9+ messages in thread
From: Evan Green @ 2019-02-07 20:57 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Bart Van Assche, Gwendal Grignou, Martin K Petersen,
	Alexis Savery, Ming Lei, Evan Green, linux-block, linux-kernel

This series addresses some errors seen when using the loop
device directly backed by a block device. The first change plumbs
out the correct error message, and the second change prevents the
error from occurring in many cases.

The errors look like this:
[   90.880875] print_req_error: I/O error, dev loop5, sector 0

The errors occur when trying to do a discard or write zeroes operation
on a loop device backed by a block device that does not support discard.
Firstly, the error itself is incorrectly reported as I/O error, but is
actually EOPNOTSUPP. The first patch plumbs out EOPNOTSUPP to properly
report the error.

The second patch prevents these errors from occurring by mirroring the
discard capabilities of the underlying block device into the loop device.
Before this change, discard was always reported as being supported, and
the loop device simply turns around and does a discard operation on the
backing device. After this change, backing block devices that do support
discard will continue to work as before, and continue to get all the
benefits of doing that. Backing devices that do not support discard will
fail earlier, avoiding hitting the loop device at all and ultimately
avoiding this error in the logs.

I can also confirm that this fixes test block/003 in the blktests, when
running blktests on a loop device backed by a block device.


Changes in v2:
- Unnested error if statement (Bart)

Evan Green (2):
  loop: Report EOPNOTSUPP properly
  loop: Better discard support for block devices

 drivers/block/loop.c | 70 ++++++++++++++++++++++++++++++--------------
 1 file changed, 48 insertions(+), 22 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-02-26 19:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 20:57 [PATCH v2 0/2] loop: Better discard for block devices Evan Green
2019-02-07 20:57 ` [PATCH v2 1/2] loop: Report EOPNOTSUPP properly Evan Green
2019-02-07 22:11   ` Bart Van Assche
2019-02-14  2:31   ` Martin K. Petersen
2019-02-26 19:27     ` Evan Green
2019-02-07 20:57 ` [PATCH v2 2/2] loop: Better discard support for block devices Evan Green
2019-02-14  2:39   ` Martin K. Petersen
2019-02-14 18:00     ` Evan Green
2019-02-26 17:23       ` Evan Green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).