hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/lightnvm/pblk-cache.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (C) 2016 CNEX Labs
34 * Initial release: Javier Gonzalez <javier@cnexlabs.com>
....@@ -17,18 +18,17 @@
1718
1819 #include "pblk.h"
1920
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)
2123 {
22
- struct request_queue *q = pblk->dev->q;
2324 struct pblk_w_ctx w_ctx;
2425 sector_t lba = pblk_get_lba(bio);
25
- unsigned long start_time = jiffies;
26
+ unsigned long start_time;
2627 unsigned int bpos, pos;
2728 int nr_entries = pblk_get_secs(bio);
2829 int i, ret;
2930
30
- generic_start_io_acct(q, REQ_OP_WRITE, bio_sectors(bio),
31
- &pblk->disk->part0);
31
+ start_time = bio_start_io_acct(bio);
3232
3333 /* Update the write buffer head (mem) with the entries that we can
3434 * write. The write in itself cannot fail, so there is no need to
....@@ -42,6 +42,7 @@
4242 goto retry;
4343 case NVM_IO_ERR:
4444 pblk_pipeline_stop(pblk);
45
+ bio_io_error(bio);
4546 goto out;
4647 }
4748
....@@ -76,9 +77,11 @@
7677 pblk_rl_inserted(&pblk->rl, nr_entries);
7778
7879 out:
79
- generic_end_io_acct(q, REQ_OP_WRITE, &pblk->disk->part0, start_time);
80
+ bio_end_io_acct(bio, start_time);
8081 pblk_write_should_kick(pblk);
81
- return ret;
82
+
83
+ if (ret == NVM_IO_DONE)
84
+ bio_endio(bio);
8285 }
8386
8487 /*