Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6799130imm; Wed, 27 Jun 2018 13:39:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIOaopH688FOiBNCB+VpckEOaVSBp56vZ2RmxBCa8Dg86lOTQbMobW9GoBBEKXgHSftNTuW X-Received: by 2002:a63:6849:: with SMTP id d70-v6mr6275887pgc.7.1530131998893; Wed, 27 Jun 2018 13:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530131998; cv=none; d=google.com; s=arc-20160816; b=LgmpWp6G7sAB+ng3YQllWku1RQPQihLc87h3EaWfwmb5rEDtCQSRKzoOWVPWnvr+r6 u4Eo7U0zbxkzArAVArWmpfEBJaun92/gpxr7A94ltf3L3VMgCixeuaTjmf5PivYj74li ybhhykHlFivlnUq7KORXB5ifFsOUHq1IGdZqiddDAIURAHgkBDCaIOP3JiU39SIum7T/ wCwQ9qfUGD8s5KL+PSJTj2TooFoBu1fXgIPEVS6DcqQ/VZ7cMSgVJT3OLpNu+8ALE3hE MbzLcOF1vbx1373AfVn19I1wQiaQYIg6EFJIIVyVaNUk+D8LaJEmN/i2sRTYV0bZDRfM PSZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=/omtUHlsPvPWOdxTaiyL1MA4SRecFGeK5/NxG1cOQFU=; b=s9/KjR95tJ4bKfzW9cdCSU51hWkeiFKaNCvDV8ojYzMf23okLRg0jJxQihnr2uyulb ymHg1mB6iuWQR7asDbKXV63+3o3BvORV2vFcZcBbef6+0qCkkEVZfa47GGgBQqRvGIfo y5yPp5Wp87c+jiMTtYsdkHvuaG0VfQF0GeZunytDn6KjuM6PZHYOrjE6tm/TFsqx3y3B s6dYMme+/cttL1Ucpv1TfBVJ5uooPE00Bnnj/F+/998loSielvGihlZNZcE/2X85jogS SeXfIG36FR/1nLCDZhgF7De49UykMShGIJeFLhMKzb6/3i3wS3AMHW+h4rikcI61nVm/ i2Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=igYbhEhX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12-v6si4862143pfa.113.2018.06.27.13.39.44; Wed, 27 Jun 2018 13:39:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=igYbhEhX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935120AbeF0Tmc (ORCPT + 99 others); Wed, 27 Jun 2018 15:42:32 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35357 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935101AbeF0Tma (ORCPT ); Wed, 27 Jun 2018 15:42:30 -0400 Received: by mail-lf0-f66.google.com with SMTP id i15-v6so2423453lfc.2 for ; Wed, 27 Jun 2018 12:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/omtUHlsPvPWOdxTaiyL1MA4SRecFGeK5/NxG1cOQFU=; b=igYbhEhXTY5T8ElOyWfXmm5x49IM9bRd7yzdFb8RcJlN7TBQbOCX6bDKqfUPFRPiWw LsXDzEdrCZsQO7yhtocxNTK4RTaSYh4cvK6ypI1zT9efxTMZ3VkaIGD16hET2IdYxxJN bppvKLifwANGtsAzSBnp2DcWvIHp84JrTPfGHxitj8ZgJCIVbbvuTa4kDnm3VUE2V7tz 6PKXVCEr+Y6aXWJUBIhEAYZqDSdg84Nsug3GRSXLmted31tp7haToJLKQrja+z/VyP2Y //tTnZwCpC4t6tqAwIfRsR4veVXiBpGaPa0LV/eq3jeUkbfyRWXWmmKltyOLi08YZ3Ed DX9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/omtUHlsPvPWOdxTaiyL1MA4SRecFGeK5/NxG1cOQFU=; b=uL+vLK17saDyU1ch3BRHUSuIkK0zdAKPohHOF0hFXID8tw3e2c3OD2K70sFC7OWMuE zdYSoKXWzNrntU6ZgvU0o3RioDhqDIyuUxKGc8S8dTgePl09P3RQpnwWcgYq2pbDZG4j gHe2l1m2c0Ndx5zV/cNhX5ot5p2EtUg2YcbHCRu3V7lJXxS7Z+BRPPcqVudzCeyQn7ZA pydJp6sT9I1gQYNhyWoPnj/r/DxenV6YKR0bC2VyHMQ/A4B0vS/uco1rpTiiMzsRTlKJ 0l2rXTXxW0Lfc5V8OSBP1qao7PtaMQQMZLmD++A2p4rFg/NEhb2KxlIeq8KE+qN3sizQ yXyA== X-Gm-Message-State: APt69E3zTerkQ6RtfhaB6o0KS6Ao9PztQLTM/ygNBM6s1iJ+aHMyJTvB 44CLjvE/r59LIGkRqZYuLnSXzA== X-Received: by 2002:a19:d3c3:: with SMTP id k186-v6mr5272569lfg.62.1530128549370; Wed, 27 Jun 2018 12:42:29 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id k10-v6sm812915ljh.5.2018.06.27.12.42.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 12:42:28 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, javier@cnexlabs.com, hans.holmberg@cnexlabs.com, hlitz@ucsc.edu, youngtack.jin@circuitblvd.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH] lightnvm: pblk: fix read_bitmap for 32bit archs Date: Wed, 27 Jun 2018 21:42:06 +0200 Message-Id: <20180627194206.30384-1-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/lightnvm/pblk-read.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index 6e93c489ce57..671635275d56 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) struct pblk_g_ctx *r_ctx; struct nvm_rq *rqd; unsigned int bio_init_idx; - unsigned long read_bitmap; /* Max 64 ppas per request */ + DECLARE_BITMAP(read_bitmap, 64); /* Max 64 ppas per request */ int ret = NVM_IO_ERR; /* logic error: lba out-of-bounds. Ignore read request */ @@ -413,7 +413,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio) generic_start_io_acct(q, READ, bio_sectors(bio), &pblk->disk->part0); - bitmap_zero(&read_bitmap, nr_secs); + bitmap_zero(read_bitmap, nr_secs); rqd = pblk_alloc_rqd(pblk, PBLK_READ); @@ -444,19 +444,19 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio) rqd->ppa_list = rqd->meta_list + pblk_dma_meta_size; rqd->dma_ppa_list = rqd->dma_meta_list + pblk_dma_meta_size; - pblk_read_ppalist_rq(pblk, rqd, bio, blba, &read_bitmap); + pblk_read_ppalist_rq(pblk, rqd, bio, blba, read_bitmap); } else { - pblk_read_rq(pblk, rqd, bio, blba, &read_bitmap); + pblk_read_rq(pblk, rqd, bio, blba, read_bitmap); } - if (bitmap_full(&read_bitmap, nr_secs)) { + if (bitmap_full(read_bitmap, nr_secs)) { atomic_inc(&pblk->inflight_io); __pblk_end_io_read(pblk, rqd, false); return NVM_IO_DONE; } /* All sectors are to be read from the device */ - if (bitmap_empty(&read_bitmap, rqd->nr_ppas)) { + if (bitmap_empty(read_bitmap, rqd->nr_ppas)) { struct bio *int_bio = NULL; /* Clone read bio to deal with read errors internally */ @@ -480,7 +480,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio) /* The read bio request could be partially filled by the write buffer, * but there are some holes that need to be read from the drive. */ - return pblk_partial_read(pblk, rqd, bio, bio_init_idx, &read_bitmap); + return pblk_partial_read(pblk, rqd, bio, bio_init_idx, read_bitmap); fail_rqd_free: pblk_free_rqd(pblk, rqd, PBLK_READ); -- 2.11.0