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)