lightnvm: generalize rrpc ppa calculations
In rrpc, some calculations assume a certain configuration (e.g., 1 LUN, 1 sector per page). The reason behind this was that LightNVM used a simple configuration with QEMU to test core features in the beginning. This patch relaxes these assumptions and generalizes calculation, allowing multiple luns to be used. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:

committed by
Jens Axboe

parent
ed2a92a6b4
commit
afb18e0ed8
@@ -156,6 +156,15 @@ struct rrpc_rev_addr {
|
||||
u64 addr;
|
||||
};
|
||||
|
||||
static inline struct rrpc_block *rrpc_get_rblk(struct rrpc_lun *rlun,
|
||||
int blk_id)
|
||||
{
|
||||
struct rrpc *rrpc = rlun->rrpc;
|
||||
int lun_blk = blk_id % rrpc->dev->blks_per_lun;
|
||||
|
||||
return &rlun->blocks[lun_blk];
|
||||
}
|
||||
|
||||
static inline sector_t rrpc_get_laddr(struct bio *bio)
|
||||
{
|
||||
return bio->bi_iter.bi_sector / NR_PHY_IN_LOG;
|
||||
|
Reference in New Issue
Block a user