mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-19 20:34:20 +08:00
lightnvm: calculate rrpc total blocks and sectors up front
Calculate rrpc total blocks and sectors up front, make sense to use them. For example, we use rrpc->nr_sects to calculate rrpc area size, but it makes no sense if we don't initialize it up front, since it would be zero until we finish rrpc luns init. Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
7f7c5d03c0
commit
66e3d07f75
@ -1207,10 +1207,6 @@ static int rrpc_luns_init(struct rrpc *rrpc, int lun_begin, int lun_end)
|
||||
|
||||
INIT_WORK(&rlun->ws_gc, rrpc_lun_gc);
|
||||
spin_lock_init(&rlun->lock);
|
||||
|
||||
rrpc->total_blocks += dev->blks_per_lun;
|
||||
rrpc->nr_sects += dev->sec_per_lun;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1388,6 +1384,8 @@ static void *rrpc_init(struct nvm_dev *dev, struct gendisk *tdisk,
|
||||
INIT_WORK(&rrpc->ws_requeue, rrpc_requeue);
|
||||
|
||||
rrpc->nr_luns = lun_end - lun_begin + 1;
|
||||
rrpc->total_blocks = (unsigned long)dev->blks_per_lun * rrpc->nr_luns;
|
||||
rrpc->nr_sects = (unsigned long long)dev->sec_per_lun * rrpc->nr_luns;
|
||||
|
||||
/* simple round-robin strategy */
|
||||
atomic_set(&rrpc->next_lun, -1);
|
||||
|
Loading…
Reference in New Issue
Block a user