From patchwork Wed Jun 27 19:42:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10492545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70BC760375 for ; Wed, 27 Jun 2018 19:42:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D8B429EE5 for ; Wed, 27 Jun 2018 19:42:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7037329EF9; Wed, 27 Jun 2018 19:42:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989D029EE5 for ; Wed, 27 Jun 2018 19:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935102AbeF0Tmb (ORCPT ); Wed, 27 Jun 2018 15:42:31 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:42300 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934961AbeF0Tma (ORCPT ); Wed, 27 Jun 2018 15:42:30 -0400 Received: by mail-lf0-f68.google.com with SMTP id u202-v6so2410990lff.9 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=RhQ/4gIwpciHt/nM3ikS+ZXczb/yYA2NNq71OIYP2Wh2RIptJAOcUb89qA8vQhHpiW vg1COqgRm4/D6h64ID/cVEWMh6iO74+RGwuoE/zLLm/aVVkGiiUjGcJc4GqYneC23+g9 DmYbKGxN6aVQGDZKHU3xdJxkKUvdb+gZxNWs9ay0Hz1QUJNEQ6LSz8PH+bthnpYXqRYv YL6Pn6aA8DBwe2/AyWP3CenJzE+0+S2Q3ta+IYRGtRmkF0mjzKDITzn8lNHYtCOaA6Td fkse2MgvfpreXsXLD4C+UtV+g+ShTIeL3EwKjEyql1NRjDgvUs1CRrgpcU1b3QPMTKAx N3hw== X-Gm-Message-State: APt69E2n8SINCF4pdtaQnBEAvBFiufc6/pPwDphAUPzXdQOfWL6FtwA4 MCafmebSxv+05JYvsPnu/5929g== X-Google-Smtp-Source: AAOMgpeuCVVGoMNbrU8B43LFJBK3tVMWQo/qibPwnlvHkY91CCuOPlw7HVME+/MOIsKY+JI2uR6vuw== 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 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Igor Konopko Reviewed-by: Javier González --- 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);