metag: Fix __cmpxchg_u32 asm constraint for CMP
[linux-2.6/btrfs-unstable.git] / drivers / lightnvm / gennvm.h
blob04d7c23cfc61756ea3bdbd149be630c4b7cf8369
1 /*
2 * Copyright: Matias Bjorling <mb@bjorling.me>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License version
6 * 2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
15 #ifndef GENNVM_H_
16 #define GENNVM_H_
18 #include <linux/module.h>
19 #include <linux/vmalloc.h>
21 #include <linux/lightnvm.h>
23 struct gen_lun {
24 struct nvm_lun vlun;
26 int reserved_blocks;
27 /* lun block lists */
28 struct list_head used_list; /* In-use blocks */
29 struct list_head free_list; /* Not used blocks i.e. released
30 * and ready for use
32 struct list_head bb_list; /* Bad blocks. Mutually exclusive with
33 * free_list and used_list
37 struct gen_nvm {
38 struct nvm_dev *dev;
40 int nr_luns;
41 struct gen_lun *luns;
42 struct list_head area_list;
45 struct gennvm_area {
46 struct list_head list;
47 sector_t begin;
48 sector_t end; /* end is excluded */
50 #define gennvm_for_each_lun(bm, lun, i) \
51 for ((i) = 0, lun = &(bm)->luns[0]; \
52 (i) < (bm)->nr_luns; (i)++, lun = &(bm)->luns[(i)])
54 #endif /* GENNVM_H_ */