Commit 57de7bd8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Andrew Morton

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.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent d6eea009
...@@ -1933,23 +1933,23 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, ...@@ -1933,23 +1933,23 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
if (!op_is_write(op)) { if (!op_is_write(op)) {
ret = zram_bvec_read(zram, bvec, index, offset, bio); 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); flush_dcache_page(bvec->bv_page);
} else { } else {
ret = zram_bvec_write(zram, bvec, index, offset, bio); 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_slot_lock(zram, index);
zram_accessed(zram, index); zram_accessed(zram, index);
zram_slot_unlock(zram, index); zram_slot_unlock(zram, index);
return 0;
if (unlikely(ret < 0)) {
if (!op_is_write(op))
atomic64_inc(&zram->stats.failed_reads);
else
atomic64_inc(&zram->stats.failed_writes);
}
return ret;
} }
static void __zram_make_request(struct zram *zram, struct bio *bio) static void __zram_make_request(struct zram *zram, struct bio *bio)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment