lightnvm: reserved space calculation incorrect
authorJavier González <jg@lightnvm.io>
Fri, 6 May 2016 18:03:21 +0000 (20:03 +0200)
committerJens Axboe <axboe@fb.com>
Fri, 6 May 2016 18:51:10 +0000 (12:51 -0600)
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>
drivers/lightnvm/rrpc.c
include/linux/lightnvm.h

index 72aca96f467b7f0ae558165a20be9d557391c321..2103e97a974f6e3598f38bceea3852577a52f1b9 100644 (file)
@@ -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) {
index b2991c724640e7c5a6e88f28db8a3ae01d49bc81..ef2c7d2e76c4829c36ff1cc2a3bb974bf405cd5a 100644 (file)
@@ -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;