aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lightnvm.h
diff options
context:
space:
mode:
authorMatias Bjørling <m@bjorling.me>2016-07-07 03:54:16 -0400
committerJens Axboe <axboe@fb.com>2016-07-07 10:51:52 -0400
commitb76eb20bb0c6f4f9c2e1ad493f73c52817b8aaff (patch)
treeb066ae87ea129c6b01bcab50e24efc8acb3e62b0 /include/linux/lightnvm.h
parent5e60edb7dcedd6bdcf946ba765f51e8d363d65a8 (diff)
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>
Diffstat (limited to 'include/linux/lightnvm.h')
-rw-r--r--include/linux/lightnvm.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 8b51d5767331..d619f6dde7df 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -1,7 +1,9 @@
1#ifndef NVM_H 1#ifndef NVM_H
2#define NVM_H 2#define NVM_H
3 3
4#include <linux/blkdev.h>
4#include <linux/types.h> 5#include <linux/types.h>
6#include <uapi/linux/lightnvm.h>
5 7
6enum { 8enum {
7 NVM_IO_OK = 0, 9 NVM_IO_OK = 0,
@@ -447,6 +449,8 @@ struct nvm_tgt_type {
447 struct list_head list; 449 struct list_head list;
448}; 450};
449 451
452extern struct nvm_tgt_type *nvm_find_target_type(const char *, int);
453
450extern int nvm_register_tgt_type(struct nvm_tgt_type *); 454extern int nvm_register_tgt_type(struct nvm_tgt_type *);
451extern void nvm_unregister_tgt_type(struct nvm_tgt_type *); 455extern void nvm_unregister_tgt_type(struct nvm_tgt_type *);
452 456
@@ -455,6 +459,9 @@ extern void nvm_dev_dma_free(struct nvm_dev *, void *, dma_addr_t);
455 459
456typedef int (nvmm_register_fn)(struct nvm_dev *); 460typedef int (nvmm_register_fn)(struct nvm_dev *);
457typedef void (nvmm_unregister_fn)(struct nvm_dev *); 461typedef void (nvmm_unregister_fn)(struct nvm_dev *);
462
463typedef int (nvmm_create_tgt_fn)(struct nvm_dev *, struct nvm_ioctl_create *);
464typedef int (nvmm_remove_tgt_fn)(struct nvm_dev *, struct nvm_ioctl_remove *);
458typedef struct nvm_block *(nvmm_get_blk_fn)(struct nvm_dev *, 465typedef struct nvm_block *(nvmm_get_blk_fn)(struct nvm_dev *,
459 struct nvm_lun *, unsigned long); 466 struct nvm_lun *, unsigned long);
460typedef void (nvmm_put_blk_fn)(struct nvm_dev *, struct nvm_block *); 467typedef void (nvmm_put_blk_fn)(struct nvm_dev *, struct nvm_block *);
@@ -480,6 +487,9 @@ struct nvmm_type {
480 nvmm_register_fn *register_mgr; 487 nvmm_register_fn *register_mgr;
481 nvmm_unregister_fn *unregister_mgr; 488 nvmm_unregister_fn *unregister_mgr;
482 489
490 nvmm_create_tgt_fn *create_tgt;
491 nvmm_remove_tgt_fn *remove_tgt;
492
483 /* Block administration callbacks */ 493 /* Block administration callbacks */
484 nvmm_get_blk_fn *get_blk_unlocked; 494 nvmm_get_blk_fn *get_blk_unlocked;
485 nvmm_put_blk_fn *put_blk_unlocked; 495 nvmm_put_blk_fn *put_blk_unlocked;