diff options
author | Javier González <jg@lightnvm.io> | 2016-11-28 22:39:09 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-11-29 20:12:51 +0100 |
commit | 2a02e627c245bfa987b97707123d7747d7b0e486 (patch) | |
tree | 321f42522eaf00fa29a0a05612c11e4b515e92d5 /drivers/lightnvm/rrpc.h | |
parent | lightnvm: remove debug lun statistics from gennvm (diff) | |
download | linux-2a02e627c245bfa987b97707123d7747d7b0e486.tar.xz linux-2a02e627c245bfa987b97707123d7747d7b0e486.zip |
lightnvm: eliminate nvm_block abstraction on mm
In order to naturally support multi-target instances on an Open-Channel
SSD, targets should own the LUNs they get blocks from and manage
provisioning internally. This is done in several steps.
A part of this transformation is that targets manage their blocks
internally. This patch eliminates the nvm_block abstraction and moves
block management to the target logic. The rrpc target is transformed.
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.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h index 242d4c109eb6..c55cec9a1a26 100644 --- a/drivers/lightnvm/rrpc.h +++ b/drivers/lightnvm/rrpc.h @@ -52,8 +52,7 @@ struct rrpc_rq { }; struct rrpc_block { - unsigned long id; - struct nvm_block *parent; + int id; /* id inside of LUN */ struct rrpc_lun *rlun; struct list_head prio; /* LUN CG list */ @@ -83,6 +82,16 @@ struct rrpc_lun { struct list_head prio_list; /* Blocks that may be GC'ed */ struct list_head wblk_list; /* Queued blocks to be written to */ + /* lun block lists */ + struct list_head used_list; /* In-use blocks */ + struct list_head free_list; /* Not used blocks i.e. released + * and ready for use + */ + struct list_head bb_list; /* Bad blocks. Mutually exclusive with + * free_list and used_list + */ + unsigned int nr_free_blocks; /* Number of unused blocks */ + struct work_struct ws_gc; int reserved_blocks; @@ -155,14 +164,14 @@ struct rrpc_rev_addr { u64 addr; }; -static inline struct rrpc_block *rrpc_get_rblk(struct rrpc_lun *rlun, - int blk_id) +static inline u64 rrpc_blk_to_ppa(struct rrpc *rrpc, struct rrpc_block *rblk) { - struct rrpc *rrpc = rlun->rrpc; struct nvm_tgt_dev *dev = rrpc->dev; - int lun_blk = blk_id % dev->geo.blks_per_lun; + struct nvm_geo *geo = &dev->geo; + struct rrpc_lun *rlun = rblk->rlun; + struct nvm_lun *lun = rlun->parent; - return &rlun->blocks[lun_blk]; + return (lun->id * geo->sec_per_lun) + (rblk->id * geo->sec_per_blk); } static inline sector_t rrpc_get_laddr(struct bio *bio) |