aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorMatias Bjørling <mb@lightnvm.io>2018-07-13 04:48:40 -0400
committerJens Axboe <axboe@kernel.dk>2018-07-13 10:14:39 -0400
commit921aebfac0871e8212913039d5241c0b3527eddb (patch)
treec513e0b6b4196b84e56a1374f252cc5fa63fc91d /drivers/lightnvm
parent242e461fb628bb63763e0bb2788d52ea054f8721 (diff)
lightnvm: pblk: fix read_bitmap for 32bit archs
If using pblk on a 32bit architecture, and there is a need to perform a partial read, the partial read bitmap will only have allocated 32 entries, where as 64 are needed. Make sure that the read_bitmap is initialized to 64bits on 32bit architectures as well. Signed-off-by: Matias Bjørling <mb@lightnvm.io> Reviewed-by: Igor Konopko <igor.j.konopko@intel.com> Reviewed-by: Javier González <javier@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/pblk-read.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 6e93c489ce57..bcfc6ea86e9d 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -401,7 +401,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)
401 struct pblk_g_ctx *r_ctx; 401 struct pblk_g_ctx *r_ctx;
402 struct nvm_rq *rqd; 402 struct nvm_rq *rqd;
403 unsigned int bio_init_idx; 403 unsigned int bio_init_idx;
404 unsigned long read_bitmap; /* Max 64 ppas per request */ 404 DECLARE_BITMAP(read_bitmap, NVM_MAX_VLBA);
405 int ret = NVM_IO_ERR; 405 int ret = NVM_IO_ERR;
406 406
407 /* logic error: lba out-of-bounds. Ignore read request */ 407 /* logic error: lba out-of-bounds. Ignore read request */
@@ -413,7 +413,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)
413 413
414 generic_start_io_acct(q, READ, bio_sectors(bio), &pblk->disk->part0); 414 generic_start_io_acct(q, READ, bio_sectors(bio), &pblk->disk->part0);
415 415
416 bitmap_zero(&read_bitmap, nr_secs); 416 bitmap_zero(read_bitmap, nr_secs);
417 417
418 rqd = pblk_alloc_rqd(pblk, PBLK_READ); 418 rqd = pblk_alloc_rqd(pblk, PBLK_READ);
419 419
@@ -444,19 +444,19 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)
444 rqd->ppa_list = rqd->meta_list + pblk_dma_meta_size; 444 rqd->ppa_list = rqd->meta_list + pblk_dma_meta_size;
445 rqd->dma_ppa_list = rqd->dma_meta_list + pblk_dma_meta_size; 445 rqd->dma_ppa_list = rqd->dma_meta_list + pblk_dma_meta_size;
446 446
447 pblk_read_ppalist_rq(pblk, rqd, bio, blba, &read_bitmap); 447 pblk_read_ppalist_rq(pblk, rqd, bio, blba, read_bitmap);
448 } else { 448 } else {
449 pblk_read_rq(pblk, rqd, bio, blba, &read_bitmap); 449 pblk_read_rq(pblk, rqd, bio, blba, read_bitmap);
450 } 450 }
451 451
452 if (bitmap_full(&read_bitmap, nr_secs)) { 452 if (bitmap_full(read_bitmap, nr_secs)) {
453 atomic_inc(&pblk->inflight_io); 453 atomic_inc(&pblk->inflight_io);
454 __pblk_end_io_read(pblk, rqd, false); 454 __pblk_end_io_read(pblk, rqd, false);
455 return NVM_IO_DONE; 455 return NVM_IO_DONE;
456 } 456 }
457 457
458 /* All sectors are to be read from the device */ 458 /* All sectors are to be read from the device */
459 if (bitmap_empty(&read_bitmap, rqd->nr_ppas)) { 459 if (bitmap_empty(read_bitmap, rqd->nr_ppas)) {
460 struct bio *int_bio = NULL; 460 struct bio *int_bio = NULL;
461 461
462 /* Clone read bio to deal with read errors internally */ 462 /* Clone read bio to deal with read errors internally */
@@ -480,7 +480,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)
480 /* The read bio request could be partially filled by the write buffer, 480 /* The read bio request could be partially filled by the write buffer,
481 * but there are some holes that need to be read from the drive. 481 * but there are some holes that need to be read from the drive.
482 */ 482 */
483 return pblk_partial_read(pblk, rqd, bio, bio_init_idx, &read_bitmap); 483 return pblk_partial_read(pblk, rqd, bio, bio_init_idx, read_bitmap);
484 484
485fail_rqd_free: 485fail_rqd_free:
486 pblk_free_rqd(pblk, rqd, PBLK_READ); 486 pblk_free_rqd(pblk, rqd, PBLK_READ);