summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-04-11 19:14:48 +0200
committerAndrew Morton <akpm@linux-foundation.org>2023-04-19 01:29:57 +0200
commit57de7bd830dae90301329748d60e196fab4c4125 (patch)
tree2b1ef67a6523891b52f62950dca74d3ee103a3b8 /drivers/block
parentzram: move discard handling to zram_submit_bio (diff)
downloadlinux-57de7bd830dae90301329748d60e196fab4c4125.tar.xz
linux-57de7bd830dae90301329748d60e196fab4c4125.zip
zram: return early on error in zram_bvec_rw
When the low-level access fails, don't clear the idle flag or clear the caches, and just return. Link: https://lkml.kernel.org/r/20230411171459.567614-7-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/zram/zram_drv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 00f13eb1c800..46dc7a274867 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1933,23 +1933,23 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
if (!op_is_write(op)) {
ret = zram_bvec_read(zram, bvec, index, offset, bio);
+ if (unlikely(ret < 0)) {
+ atomic64_inc(&zram->stats.failed_reads);
+ return ret;
+ }
flush_dcache_page(bvec->bv_page);
} else {
ret = zram_bvec_write(zram, bvec, index, offset, bio);
+ if (unlikely(ret < 0)) {
+ atomic64_inc(&zram->stats.failed_writes);
+ return ret;
+ }
}
zram_slot_lock(zram, index);
zram_accessed(zram, index);
zram_slot_unlock(zram, index);
-
- if (unlikely(ret < 0)) {
- if (!op_is_write(op))
- atomic64_inc(&zram->stats.failed_reads);
- else
- atomic64_inc(&zram->stats.failed_writes);
- }
-
- return ret;
+ return 0;
}
static void __zram_make_request(struct zram *zram, struct bio *bio)