Blame view

drivers/lightnvm/gennvm.h 1.34 KB
48add0f5a   Matias Bjørling   gennvm: Generic N...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  /*
   * 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
  					 */
  };
5e60edb7d   Matias Bjørling   lightnvm: rename ...
36
  struct gen_dev {
114504698   Matias Bjørling   lightnvm: update ...
37
  	struct nvm_dev *dev;
48add0f5a   Matias Bjørling   gennvm: Generic N...
38
39
  	int nr_luns;
  	struct gen_lun *luns;
4c9dacb82   Wenwei Tao   lightnvm: specify...
40
  	struct list_head area_list;
b76eb20bb   Matias Bjørling   lightnvm: move ta...
41
42
43
  
  	struct mutex lock;
  	struct list_head targets;
48add0f5a   Matias Bjørling   gennvm: Generic N...
44
  };
5e60edb7d   Matias Bjørling   lightnvm: rename ...
45
  struct gen_area {
4c9dacb82   Wenwei Tao   lightnvm: specify...
46
47
48
49
  	struct list_head list;
  	sector_t begin;
  	sector_t end;	/* end is excluded */
  };
5e60edb7d   Matias Bjørling   lightnvm: rename ...
50
51
  
  #define gen_for_each_lun(bm, lun, i) \
48add0f5a   Matias Bjørling   gennvm: Generic N...
52
53
54
55
  		for ((i) = 0, lun = &(bm)->luns[0]; \
  			(i) < (bm)->nr_luns; (i)++, lun = &(bm)->luns[(i)])
  
  #endif /* GENNVM_H_ */