Skip to content

Commit

Permalink
lightnvm: pblk: reduce arguments in __pblk_rb_update_l2p
Browse files Browse the repository at this point in the history
We already pass the structure pointer so no need to pass the member.

Signed-off-by: Rakesh Pandit <[email protected]>
Signed-off-by: Matias Bjørling <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
rakeshpandit authored and axboe committed Oct 13, 2017
1 parent eb6f168 commit 05ed344
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/lightnvm/pblk-rb.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ unsigned int pblk_rb_read_commit(struct pblk_rb *rb, unsigned int nr_entries)
return subm;
}

static int __pblk_rb_update_l2p(struct pblk_rb *rb, unsigned int *l2p_upd,
unsigned int to_update)
static int __pblk_rb_update_l2p(struct pblk_rb *rb, unsigned int to_update)
{
struct pblk *pblk = container_of(rb, struct pblk, rwb);
struct pblk_line *line;
Expand All @@ -213,7 +212,7 @@ static int __pblk_rb_update_l2p(struct pblk_rb *rb, unsigned int *l2p_upd,
int flags;

for (i = 0; i < to_update; i++) {
entry = &rb->entries[*l2p_upd];
entry = &rb->entries[rb->l2p_update];
w_ctx = &entry->w_ctx;

flags = READ_ONCE(entry->w_ctx.flags);
Expand All @@ -230,7 +229,7 @@ static int __pblk_rb_update_l2p(struct pblk_rb *rb, unsigned int *l2p_upd,
line = &pblk->lines[pblk_tgt_ppa_to_line(w_ctx->ppa)];
kref_put(&line->ref, pblk_line_put);
clean_wctx(w_ctx);
*l2p_upd = (*l2p_upd + 1) & (rb->nr_entries - 1);
rb->l2p_update = (rb->l2p_update + 1) & (rb->nr_entries - 1);
}

pblk_rl_out(&pblk->rl, user_io, gc_io);
Expand Down Expand Up @@ -258,7 +257,7 @@ static int pblk_rb_update_l2p(struct pblk_rb *rb, unsigned int nr_entries,

count = nr_entries - space;
/* l2p_update used exclusively under rb->w_lock */
ret = __pblk_rb_update_l2p(rb, &rb->l2p_update, count);
ret = __pblk_rb_update_l2p(rb, count);

out:
return ret;
Expand All @@ -280,7 +279,7 @@ void pblk_rb_sync_l2p(struct pblk_rb *rb)
sync = smp_load_acquire(&rb->sync);

to_update = pblk_rb_ring_count(sync, rb->l2p_update, rb->nr_entries);
__pblk_rb_update_l2p(rb, &rb->l2p_update, to_update);
__pblk_rb_update_l2p(rb, to_update);

spin_unlock(&rb->w_lock);
}
Expand Down

0 comments on commit 05ed344

Please sign in to comment.