summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk.h
diff options
context:
space:
mode:
authorJavier González <jg@lightnvm.io>2017-04-22 01:32:49 +0200
committerJens Axboe <axboe@fb.com>2017-04-23 16:57:52 -0600
commita44f53faf4674d84cba79f7ee574584e18ab8744 (patch)
tree92183bdbb213a0b9604bbb387bc4749c091919cc /drivers/lightnvm/pblk.h
parentbe388d9fbd4e09582e31c3ee82a022e368208ae3 (diff)
downloadlinux-a44f53faf4674d84cba79f7ee574584e18ab8744.tar.bz2
lightnvm: pblk: fix erase counters on error fail
When block erases fail, these blocks are marked bad. The number of valid blocks in the line was not updated, which could cause an infinite loop on the erase path. Fix this atomic counter and, in order to avoid taking an irq lock on the interrupt context, make the erase counters atomic too. Also, in the case that a significant number of blocks become bad in a line, the result is the double shared metadata buffer (emeta) to stop the pipeline until all metadata is flushed to the media. Increase the number of metadata lines from 2 to 4 to avoid this case. Fixes: a4bd217b4326 "lightnvm: physical block device (pblk) target" Signed-off-by: Javier González <javier@cnexlabs.com> Reviewed-by: Matias Bjørling <matias@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm/pblk.h')
-rw-r--r--drivers/lightnvm/pblk.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 11ed7d83f572..99f3186b5288 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -363,14 +363,14 @@ struct pblk_line {
unsigned int sec_in_line; /* Number of usable secs in line */
- unsigned int blk_in_line; /* Number of good blocks in line */
+ atomic_t blk_in_line; /* Number of good blocks in line */
unsigned long *blk_bitmap; /* Bitmap for valid/invalid blocks */
unsigned long *erase_bitmap; /* Bitmap for erased blocks */
unsigned long *map_bitmap; /* Bitmap for mapped sectors in line */
unsigned long *invalid_bitmap; /* Bitmap for invalid sectors in line */
- int left_eblks; /* Blocks left for erasing */
+ atomic_t left_eblks; /* Blocks left for erasing */
atomic_t left_seblks; /* Blocks left for sync erasing */
int left_msecs; /* Sectors left for mapping */
@@ -383,7 +383,7 @@ struct pblk_line {
spinlock_t lock; /* Necessary for invalid_bitmap only */
};
-#define PBLK_DATA_LINES 2
+#define PBLK_DATA_LINES 4
enum{
PBLK_KMALLOC_META = 1,