Skip to content

Commit

Permalink
lightnvm: reserved space calculation incorrect
Browse files Browse the repository at this point in the history
The nvm_dev->max_pages_per_blk variable was removed in favor of the new
nvm->sec_per_blk variable. The ->max_pages_per_blk variable was still
used in rrpc_capacity, reporting the reserved capacity to zero. Replace
with ->sec_per_blk to calculate the reserved area again.

Signed-off-by: Javier González <javier@cnexlabs.com>
Updated patch description. Was "lightnvm: eliminate redundant variable"
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Javier González authored and Jens Axboe committed May 6, 2016
1 parent 6d5be95 commit 116f7d4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/lightnvm/rrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ static sector_t rrpc_capacity(void *private)
sector_t reserved, provisioned;

/* cur, gc, and two emergency blocks for each lun */
reserved = rrpc->nr_luns * dev->max_pages_per_blk * 4;
reserved = rrpc->nr_luns * dev->sec_per_blk * 4;
provisioned = rrpc->nr_sects - reserved;

if (reserved > rrpc->nr_sects) {
Expand Down
1 change: 0 additions & 1 deletion include/linux/lightnvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ struct nvm_dev {
unsigned long total_blocks;
unsigned long total_secs;
int nr_luns;
unsigned max_pages_per_blk;

unsigned long *lun_map;
void *dma_pool;
Expand Down

0 comments on commit 116f7d4

Please sign in to comment.