| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2016 CNEX Labs |
|---|
| 3 | 4 | * Initial release: Javier Gonzalez <javier@cnexlabs.com> |
|---|
| .. | .. |
|---|
| 17 | 18 | |
|---|
| 18 | 19 | #include "pblk.h" |
|---|
| 19 | 20 | |
|---|
| 20 | | -int pblk_write_to_cache(struct pblk *pblk, struct bio *bio, unsigned long flags) |
|---|
| 21 | +void pblk_write_to_cache(struct pblk *pblk, struct bio *bio, |
|---|
| 22 | + unsigned long flags) |
|---|
| 21 | 23 | { |
|---|
| 22 | | - struct request_queue *q = pblk->dev->q; |
|---|
| 23 | 24 | struct pblk_w_ctx w_ctx; |
|---|
| 24 | 25 | sector_t lba = pblk_get_lba(bio); |
|---|
| 25 | | - unsigned long start_time = jiffies; |
|---|
| 26 | + unsigned long start_time; |
|---|
| 26 | 27 | unsigned int bpos, pos; |
|---|
| 27 | 28 | int nr_entries = pblk_get_secs(bio); |
|---|
| 28 | 29 | int i, ret; |
|---|
| 29 | 30 | |
|---|
| 30 | | - generic_start_io_acct(q, REQ_OP_WRITE, bio_sectors(bio), |
|---|
| 31 | | - &pblk->disk->part0); |
|---|
| 31 | + start_time = bio_start_io_acct(bio); |
|---|
| 32 | 32 | |
|---|
| 33 | 33 | /* Update the write buffer head (mem) with the entries that we can |
|---|
| 34 | 34 | * write. The write in itself cannot fail, so there is no need to |
|---|
| .. | .. |
|---|
| 42 | 42 | goto retry; |
|---|
| 43 | 43 | case NVM_IO_ERR: |
|---|
| 44 | 44 | pblk_pipeline_stop(pblk); |
|---|
| 45 | + bio_io_error(bio); |
|---|
| 45 | 46 | goto out; |
|---|
| 46 | 47 | } |
|---|
| 47 | 48 | |
|---|
| .. | .. |
|---|
| 76 | 77 | pblk_rl_inserted(&pblk->rl, nr_entries); |
|---|
| 77 | 78 | |
|---|
| 78 | 79 | out: |
|---|
| 79 | | - generic_end_io_acct(q, REQ_OP_WRITE, &pblk->disk->part0, start_time); |
|---|
| 80 | + bio_end_io_acct(bio, start_time); |
|---|
| 80 | 81 | pblk_write_should_kick(pblk); |
|---|
| 81 | | - return ret; |
|---|
| 82 | + |
|---|
| 83 | + if (ret == NVM_IO_DONE) |
|---|
| 84 | + bio_endio(bio); |
|---|
| 82 | 85 | } |
|---|
| 83 | 86 | |
|---|
| 84 | 87 | /* |
|---|