mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-28 20:37:27 +00:00
lightnvm: pblk: delete redundant buffer pointer
After refactoring the metadata path, the backpointer controlling synced I/Os in a line becomes unnecessary; metadata is scheduled on the write thread, thus we know when the end of the line is reached and act on it directly. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <matias@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
fd1b0158f5
commit
0880a9aa2d
@ -65,8 +65,8 @@ static void pblk_end_io_erase(struct nvm_rq *rqd)
|
||||
mempool_free(rqd, pblk->g_rq_pool);
|
||||
}
|
||||
|
||||
static void __pblk_map_invalidate(struct pblk *pblk, struct pblk_line *line,
|
||||
u64 paddr)
|
||||
void __pblk_map_invalidate(struct pblk *pblk, struct pblk_line *line,
|
||||
u64 paddr)
|
||||
{
|
||||
struct pblk_line_mgmt *l_mg = &pblk->l_mg;
|
||||
struct list_head *move_list = NULL;
|
||||
@ -129,18 +129,6 @@ void pblk_map_invalidate(struct pblk *pblk, struct ppa_addr ppa)
|
||||
__pblk_map_invalidate(pblk, line, paddr);
|
||||
}
|
||||
|
||||
void pblk_map_pad_invalidate(struct pblk *pblk, struct pblk_line *line,
|
||||
u64 paddr)
|
||||
{
|
||||
__pblk_map_invalidate(pblk, line, paddr);
|
||||
|
||||
pblk_rb_sync_init(&pblk->rwb, NULL);
|
||||
line->left_ssecs--;
|
||||
if (!line->left_ssecs)
|
||||
pblk_line_run_ws(pblk, line, NULL, pblk_line_close_ws);
|
||||
pblk_rb_sync_end(&pblk->rwb, NULL);
|
||||
}
|
||||
|
||||
static void pblk_invalidate_range(struct pblk *pblk, sector_t slba,
|
||||
unsigned int nr_secs)
|
||||
{
|
||||
@ -1057,7 +1045,7 @@ retry_smeta:
|
||||
line->sec_in_line -= lm->emeta_sec[0];
|
||||
line->emeta_ssec = off;
|
||||
line->nr_valid_lbas = 0;
|
||||
line->left_ssecs = line->left_msecs = line->sec_in_line;
|
||||
line->left_msecs = line->sec_in_line;
|
||||
*line->vsc = cpu_to_le32(line->sec_in_line);
|
||||
|
||||
if (lm->sec_per_line - line->sec_in_line !=
|
||||
|
@ -890,7 +890,6 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
|
||||
atomic_long_set(&pblk->req_writes, 0);
|
||||
atomic_long_set(&pblk->sub_writes, 0);
|
||||
atomic_long_set(&pblk->sync_writes, 0);
|
||||
atomic_long_set(&pblk->compl_writes, 0);
|
||||
atomic_long_set(&pblk->inflight_reads, 0);
|
||||
atomic_long_set(&pblk->cache_reads, 0);
|
||||
atomic_long_set(&pblk->sync_reads, 0);
|
||||
|
@ -56,7 +56,7 @@ static void pblk_map_page_data(struct pblk *pblk, unsigned int sentry,
|
||||
u64 addr_empty = cpu_to_le64(ADDR_EMPTY);
|
||||
|
||||
lba_list[paddr] = meta_list[i].lba = addr_empty;
|
||||
pblk_map_pad_invalidate(pblk, line, paddr);
|
||||
__pblk_map_invalidate(pblk, line, paddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,6 @@ next_rq:
|
||||
if (ret)
|
||||
pr_err("pblk: OOB read failed (err:%d)\n", ret);
|
||||
|
||||
line->left_ssecs = line->left_msecs;
|
||||
left_ppas = 0;
|
||||
}
|
||||
|
||||
@ -659,7 +658,6 @@ next_rq:
|
||||
/* Roll back failed sectors */
|
||||
line->cur_sec -= nr_error_bits;
|
||||
line->left_msecs += nr_error_bits;
|
||||
line->left_ssecs = line->left_msecs;
|
||||
bitmap_clear(line->map_bitmap, line->cur_sec, nr_error_bits);
|
||||
|
||||
left_ppas = 0;
|
||||
|
@ -154,7 +154,7 @@ static ssize_t pblk_sysfs_lines(struct pblk *pblk, char *page)
|
||||
int d_line_cnt = 0, l_line_cnt = 0;
|
||||
int gc_full = 0, gc_high = 0, gc_mid = 0, gc_low = 0, gc_empty = 0;
|
||||
int bad = 0, cor = 0;
|
||||
int msecs = 0, ssecs = 0, cur_sec = 0, vsc = 0, sec_in_line = 0;
|
||||
int msecs = 0, cur_sec = 0, vsc = 0, sec_in_line = 0;
|
||||
int map_weight = 0, meta_weight = 0;
|
||||
|
||||
spin_lock(&l_mg->free_lock);
|
||||
@ -227,7 +227,6 @@ static ssize_t pblk_sysfs_lines(struct pblk *pblk, char *page)
|
||||
if (l_mg->data_line) {
|
||||
cur_sec = l_mg->data_line->cur_sec;
|
||||
msecs = l_mg->data_line->left_msecs;
|
||||
ssecs = l_mg->data_line->left_ssecs;
|
||||
vsc = le32_to_cpu(*l_mg->data_line->vsc);
|
||||
sec_in_line = l_mg->data_line->sec_in_line;
|
||||
meta_weight = bitmap_weight(&l_mg->meta_bitmap,
|
||||
@ -259,8 +258,8 @@ static ssize_t pblk_sysfs_lines(struct pblk *pblk, char *page)
|
||||
atomic_read(&pblk->gc.inflight_gc));
|
||||
|
||||
sz += snprintf(page + sz, PAGE_SIZE - sz,
|
||||
"data (%d) cur:%d, left:%d/%d, vsc:%d, s:%d, map:%d/%d (%d)\n",
|
||||
cur_data, cur_sec, msecs, ssecs, vsc, sec_in_line,
|
||||
"data (%d) cur:%d, left:%d, vsc:%d, s:%d, map:%d/%d (%d)\n",
|
||||
cur_data, cur_sec, msecs, vsc, sec_in_line,
|
||||
map_weight, lm->sec_per_line, meta_weight);
|
||||
|
||||
return sz;
|
||||
@ -303,7 +302,7 @@ static ssize_t pblk_sysfs_get_sec_per_write(struct pblk *pblk, char *page)
|
||||
static ssize_t pblk_sysfs_stats_debug(struct pblk *pblk, char *page)
|
||||
{
|
||||
return snprintf(page, PAGE_SIZE,
|
||||
"%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\n",
|
||||
"%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\n",
|
||||
atomic_long_read(&pblk->inflight_writes),
|
||||
atomic_long_read(&pblk->inflight_reads),
|
||||
atomic_long_read(&pblk->req_writes),
|
||||
@ -312,7 +311,6 @@ static ssize_t pblk_sysfs_stats_debug(struct pblk *pblk, char *page)
|
||||
atomic_long_read(&pblk->padded_wb),
|
||||
atomic_long_read(&pblk->sub_writes),
|
||||
atomic_long_read(&pblk->sync_writes),
|
||||
atomic_long_read(&pblk->compl_writes),
|
||||
atomic_long_read(&pblk->recov_writes),
|
||||
atomic_long_read(&pblk->recov_gc_writes),
|
||||
atomic_long_read(&pblk->recov_gc_reads),
|
||||
|
@ -17,16 +17,6 @@
|
||||
|
||||
#include "pblk.h"
|
||||
|
||||
static void pblk_sync_line(struct pblk *pblk, struct pblk_line *line)
|
||||
{
|
||||
#ifdef CONFIG_NVM_DEBUG
|
||||
atomic_long_inc(&pblk->sync_writes);
|
||||
#endif
|
||||
|
||||
/* Counter protected by rb sync lock */
|
||||
line->left_ssecs--;
|
||||
}
|
||||
|
||||
static unsigned long pblk_end_w_bio(struct pblk *pblk, struct nvm_rq *rqd,
|
||||
struct pblk_c_ctx *c_ctx)
|
||||
{
|
||||
@ -44,14 +34,13 @@ static unsigned long pblk_end_w_bio(struct pblk *pblk, struct nvm_rq *rqd,
|
||||
|
||||
p = rqd->ppa_list[i];
|
||||
line = &pblk->lines[pblk_dev_ppa_to_line(p)];
|
||||
pblk_sync_line(pblk, line);
|
||||
|
||||
while ((original_bio = bio_list_pop(&w_ctx->bios)))
|
||||
bio_endio(original_bio);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVM_DEBUG
|
||||
atomic_long_add(c_ctx->nr_valid, &pblk->compl_writes);
|
||||
atomic_long_add(c_ctx->nr_valid, &pblk->sync_writes);
|
||||
#endif
|
||||
|
||||
ret = pblk_rb_sync_advance(&pblk->rwb, c_ctx->nr_valid);
|
||||
|
@ -395,7 +395,6 @@ struct pblk_line {
|
||||
atomic_t left_seblks; /* Blocks left for sync erasing */
|
||||
|
||||
int left_msecs; /* Sectors left for mapping */
|
||||
int left_ssecs; /* Sectors left to sync */
|
||||
unsigned int cur_sec; /* Sector map pointer */
|
||||
unsigned int nr_valid_lbas; /* Number of valid lbas in line */
|
||||
|
||||
@ -555,7 +554,6 @@ struct pblk {
|
||||
atomic_long_t req_writes; /* Sectors stored on write buffer */
|
||||
atomic_long_t sub_writes; /* Sectors submitted from buffer */
|
||||
atomic_long_t sync_writes; /* Sectors synced to media */
|
||||
atomic_long_t compl_writes; /* Sectors completed in write bio */
|
||||
atomic_long_t inflight_reads; /* Inflight sector read requests */
|
||||
atomic_long_t cache_reads; /* Read requests that hit the cache */
|
||||
atomic_long_t sync_reads; /* Completed sector read requests */
|
||||
@ -706,11 +704,11 @@ void pblk_end_bio_sync(struct bio *bio);
|
||||
void pblk_end_io_sync(struct nvm_rq *rqd);
|
||||
int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags,
|
||||
int nr_pages);
|
||||
void pblk_map_pad_invalidate(struct pblk *pblk, struct pblk_line *line,
|
||||
u64 paddr);
|
||||
void pblk_bio_free_pages(struct pblk *pblk, struct bio *bio, int off,
|
||||
int nr_pages);
|
||||
void pblk_map_invalidate(struct pblk *pblk, struct ppa_addr ppa);
|
||||
void __pblk_map_invalidate(struct pblk *pblk, struct pblk_line *line,
|
||||
u64 paddr);
|
||||
void pblk_update_map(struct pblk *pblk, sector_t lba, struct ppa_addr ppa);
|
||||
void pblk_update_map_cache(struct pblk *pblk, sector_t lba,
|
||||
struct ppa_addr ppa);
|
||||
|
Loading…
Reference in New Issue
Block a user