summaryrefslogtreecommitdiff
path: root/drivers/lightnvm/rrpc.h
diff options
context:
space:
mode:
authorJavier González <javier@cnexlabs.com>2016-03-04 00:47:53 +0300
committerJens Axboe <axboe@fb.com>2016-03-04 00:47:53 +0300
commitafb18e0ed862fae05aa41be278c1ddb87473c7b1 (patch)
tree2c95318aed1cb4532cf078bdfe0fded9affdd4cb /drivers/lightnvm/rrpc.h
parented2a92a6b4b8453a0c3a20da641ec79e4b3d7ca4 (diff)
downloadlinux-afb18e0ed862fae05aa41be278c1ddb87473c7b1.tar.xz
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>
Diffstat (limited to 'drivers/lightnvm/rrpc.h')
-rw-r--r--drivers/lightnvm/rrpc.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
index dfca5c4d26bb..0577c4dae05f 100644
--- a/drivers/lightnvm/rrpc.h
+++ b/drivers/lightnvm/rrpc.h
@@ -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;