diff options
author | Javier González <jg@lightnvm.io> | 2016-11-28 22:39:06 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-11-29 20:12:51 +0100 |
commit | 8e79b5cb1d3b8eceaf6862995952dd4de431dd99 (patch) | |
tree | 85f4647731c3678e9fec4e3cac412aff66a86a86 /drivers/lightnvm/rrpc.h | |
parent | lightnvm: manage lun partitions internally in mm (diff) | |
download | linux-8e79b5cb1d3b8eceaf6862995952dd4de431dd99.tar.xz linux-8e79b5cb1d3b8eceaf6862995952dd4de431dd99.zip |
lightnvm: move block provisioning to targets
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.
This patch moves the block provisioning inside of the target and removes
the get/put block interface from the media manager.
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 | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h index bed49baa7841..242d4c109eb6 100644 --- a/drivers/lightnvm/rrpc.h +++ b/drivers/lightnvm/rrpc.h @@ -52,9 +52,12 @@ struct rrpc_rq { }; struct rrpc_block { + unsigned long id; struct nvm_block *parent; struct rrpc_lun *rlun; - struct list_head prio; + + struct list_head prio; /* LUN CG list */ + struct list_head list; /* LUN free, used, bb list */ #define MAX_INVALID_PAGES_STORAGE 8 /* Bitmap for invalid page intries */ @@ -64,6 +67,8 @@ struct rrpc_block { /* number of pages that are invalid, wrt host page size */ unsigned int nr_invalid_pages; + int state; + spinlock_t lock; atomic_t data_cmnt_size; /* data pages committed to stable storage */ }; @@ -71,6 +76,7 @@ struct rrpc_block { struct rrpc_lun { struct rrpc *rrpc; struct nvm_lun *parent; + struct rrpc_block *cur, *gc_cur; struct rrpc_block *blocks; /* Reference to block allocation */ @@ -79,6 +85,8 @@ struct rrpc_lun { struct work_struct ws_gc; + int reserved_blocks; + spinlock_t lock; }; @@ -86,7 +94,7 @@ struct rrpc { /* instance must be kept in top to resolve rrpc in unprep */ struct nvm_tgt_instance instance; - struct nvm_dev *dev; + struct nvm_tgt_dev *dev; struct gendisk *disk; sector_t soffset; /* logical sector offset */ @@ -151,7 +159,8 @@ 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; + struct nvm_tgt_dev *dev = rrpc->dev; + int lun_blk = blk_id % dev->geo.blks_per_lun; return &rlun->blocks[lun_blk]; } |