aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/rrpc.h
diff options
context:
space:
mode:
authorJavier González <jg@lightnvm.io>2016-01-12 07:49:33 +0100
committerJens Axboe <axboe@fb.com>2016-01-12 08:21:17 -0700
commitff0e498bfa185fad5e86c4c7a2db4f9648d2344f (patch)
tree52cf32454a651b0f90e81987353dc1ce0fbad5a7 /drivers/lightnvm/rrpc.h
parentlightnvm: fix missing grown bad block type (diff)
downloadlinux-dev-ff0e498bfa185fad5e86c4c7a2db4f9648d2344f.tar.xz
linux-dev-ff0e498bfa185fad5e86c4c7a2db4f9648d2344f.zip
lightnvm: manage open and closed blocks separately
LightNVM targets need to know the state of the flash block when doing flash optimizations. An example is implementing a write buffer to respect the flash page size. Currently, block state is not accounted for; the media manager only differentiates among free, bad and in-use blocks. This patch adds the logic in the generic media manager to enable targets manage blocks into open and close separately, and it implements such management in rrpc. It also adds a set of flags to describe the state of the block (open, closed, free, bad). In order to avoid taking two locks (nvm_lun and rrpc_lun) consecutively, we introduce lockless get_/put_block primitives so that the open and close list locks and future common logic is handled within the nvm_lun lock. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm/rrpc.h')
-rw-r--r--drivers/lightnvm/rrpc.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
index 7c5fa4dd9722..ef13ac7700c8 100644
--- a/drivers/lightnvm/rrpc.h
+++ b/drivers/lightnvm/rrpc.h
@@ -56,6 +56,7 @@ struct rrpc_block {
struct nvm_block *parent;
struct rrpc_lun *rlun;
struct list_head prio;
+ struct list_head list;
#define MAX_INVALID_PAGES_STORAGE 8
/* Bitmap for invalid page intries */
@@ -74,7 +75,16 @@ struct rrpc_lun {
struct nvm_lun *parent;
struct rrpc_block *cur, *gc_cur;
struct rrpc_block *blocks; /* Reference to block allocation */
- struct list_head prio_list; /* Blocks that may be GC'ed */
+
+ struct list_head prio_list; /* Blocks that may be GC'ed */
+ struct list_head open_list; /* In-use open blocks. These are blocks
+ * that can be both written to and read
+ * from
+ */
+ struct list_head closed_list; /* In-use closed blocks. These are
+ * blocks that can _only_ be read from
+ */
+
struct work_struct ws_gc;
spinlock_t lock;