mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
lightnvm: move target mgmt into media mgr
To enable persistent block management to easily control creation and removal of targets, we move target management into the media manager. The LightNVM core continues to maintain which target types are registered, while the media manager now keeps track of its initialized targets. Two new callbacks for the media manager are introduced. create_tgt and remove_tgt. Note that remove_tgt returns 0 on successfully removing a target, and returns 1 if the target was not found. Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
5e60edb7dc
commit
b76eb20bb0
4 changed files with 207 additions and 160 deletions
|
@ -1,7 +1,9 @@
|
|||
#ifndef NVM_H
|
||||
#define NVM_H
|
||||
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/types.h>
|
||||
#include <uapi/linux/lightnvm.h>
|
||||
|
||||
enum {
|
||||
NVM_IO_OK = 0,
|
||||
|
@ -447,6 +449,8 @@ struct nvm_tgt_type {
|
|||
struct list_head list;
|
||||
};
|
||||
|
||||
extern struct nvm_tgt_type *nvm_find_target_type(const char *, int);
|
||||
|
||||
extern int nvm_register_tgt_type(struct nvm_tgt_type *);
|
||||
extern void nvm_unregister_tgt_type(struct nvm_tgt_type *);
|
||||
|
||||
|
@ -455,6 +459,9 @@ extern void nvm_dev_dma_free(struct nvm_dev *, void *, dma_addr_t);
|
|||
|
||||
typedef int (nvmm_register_fn)(struct nvm_dev *);
|
||||
typedef void (nvmm_unregister_fn)(struct nvm_dev *);
|
||||
|
||||
typedef int (nvmm_create_tgt_fn)(struct nvm_dev *, struct nvm_ioctl_create *);
|
||||
typedef int (nvmm_remove_tgt_fn)(struct nvm_dev *, struct nvm_ioctl_remove *);
|
||||
typedef struct nvm_block *(nvmm_get_blk_fn)(struct nvm_dev *,
|
||||
struct nvm_lun *, unsigned long);
|
||||
typedef void (nvmm_put_blk_fn)(struct nvm_dev *, struct nvm_block *);
|
||||
|
@ -480,6 +487,9 @@ struct nvmm_type {
|
|||
nvmm_register_fn *register_mgr;
|
||||
nvmm_unregister_fn *unregister_mgr;
|
||||
|
||||
nvmm_create_tgt_fn *create_tgt;
|
||||
nvmm_remove_tgt_fn *remove_tgt;
|
||||
|
||||
/* Block administration callbacks */
|
||||
nvmm_get_blk_fn *get_blk_unlocked;
|
||||
nvmm_put_blk_fn *put_blk_unlocked;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue