mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
b76eb20bb0
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>
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/*
|
|
* Copyright: Matias Bjorling <mb@bjorling.me>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version
|
|
* 2 as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#ifndef GENNVM_H_
|
|
#define GENNVM_H_
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/vmalloc.h>
|
|
|
|
#include <linux/lightnvm.h>
|
|
|
|
struct gen_lun {
|
|
struct nvm_lun vlun;
|
|
|
|
int reserved_blocks;
|
|
/* 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
|
|
*/
|
|
};
|
|
|
|
struct gen_dev {
|
|
struct nvm_dev *dev;
|
|
|
|
int nr_luns;
|
|
struct gen_lun *luns;
|
|
struct list_head area_list;
|
|
|
|
struct mutex lock;
|
|
struct list_head targets;
|
|
};
|
|
|
|
struct gen_area {
|
|
struct list_head list;
|
|
sector_t begin;
|
|
sector_t end; /* end is excluded */
|
|
};
|
|
|
|
#define gen_for_each_lun(bm, lun, i) \
|
|
for ((i) = 0, lun = &(bm)->luns[0]; \
|
|
(i) < (bm)->nr_luns; (i)++, lun = &(bm)->luns[(i)])
|
|
|
|
#endif /* GENNVM_H_ */
|