From patchwork Fri Oct 5 17:39:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhoujie Wu X-Patchwork-Id: 10628541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6E2613BB for ; Fri, 5 Oct 2018 17:37:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1BC22974F for ; Fri, 5 Oct 2018 17:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C57E229B2F; Fri, 5 Oct 2018 17:37:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 7247D2974F for ; Fri, 5 Oct 2018 17:37:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728661AbeJFAgt (ORCPT ); Fri, 5 Oct 2018 20:36:49 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:58042 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbeJFAgt (ORCPT ); Fri, 5 Oct 2018 20:36:49 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w95HUvuJ026276; Fri, 5 Oct 2018 10:37:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=NDKQ7dXtzsn7qZEyqSLNlUK3ztM6LZadg2G703N+nDk=; b=xwnV8Oelviphf1MydkhkyTIDC9PeC41fq0swkiccgo6w3JPiwa7SDjsBT8s6F6tHloLV Zl5cbK23G4XLoHw7SrJdOv4TtQ3lkbr462KsLpAt6+bOHzER0+mHNODdZt3DlKRWYksK /t2SDMZcPrKqdYKnVXnX5tW4fnIYUD+glPJ4vx8aLhD0MSJB8HD39Pj2i5U3E5x/74+A bGSIJKmC+ALwH9PUzPPbuHAJgPdYZSfxJ7W7fgp5NnUFz+kkYSNIOQQT6iQwEj5rrj/5 8CALpYbBpGab4FQvKtvJGIWbuuw+XO+rJNoWJxgkaW96paOqGYvgisajxzuJ8IzMcEEL FQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2mt8wh4udt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 05 Oct 2018 10:37:03 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 5 Oct 2018 10:37:01 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 5 Oct 2018 10:37:01 -0700 Received: from an-git01.marvell.com (unknown [10.80.127.149]) by maili.marvell.com (Postfix) with ESMTP id E0D353F7040; Fri, 5 Oct 2018 10:37:01 -0700 (PDT) From: Zhoujie Wu To: , CC: , Zhoujie Wu Subject: [PATCH v2] lightnvm: pblk: consider max hw sectors supported for max_write_pgs Date: Fri, 5 Oct 2018 10:39:21 -0700 Message-ID: <1538761161-6652-1-git-send-email-zjwu@marvell.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-05_09:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810050173 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 When do GC, the number of read/write sectors are determined by max_write_pgs(see gc_rq preparation in pblk_gc_line_prepare_ws). Due to max_write_pgs doesn't consider max hw sectors supported by nvme controller(128K), which leads to GC tries to read 64 * 4K in one command, and see below error caused by pblk_bio_map_addr in function pblk_submit_read_gc. [ 2923.005376] pblk: could not add page to bio [ 2923.005377] pblk: could not allocate GC bio (18446744073709551604) Signed-off-by: Zhoujie Wu --- v2: Changed according to Javier's comments. Remove unneccessary comment and move the definition of bqueue to maintain ordering. drivers/lightnvm/pblk-init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index e357388..0ef9ac5 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -391,6 +391,7 @@ static void pblk_put_global_caches(void) static int pblk_core_init(struct pblk *pblk) { struct nvm_tgt_dev *dev = pblk->dev; + struct request_queue *bqueue = dev->q; struct nvm_geo *geo = &dev->geo; int ret, max_write_ppas; @@ -407,6 +408,8 @@ static int pblk_core_init(struct pblk *pblk) pblk->min_write_pgs = geo->ws_opt; max_write_ppas = pblk->min_write_pgs * geo->all_luns; pblk->max_write_pgs = min_t(int, max_write_ppas, NVM_MAX_VLBA); + pblk->max_write_pgs = min_t(int, pblk->max_write_pgs, + queue_max_hw_sectors(bqueue) / (geo->csecs >> 9)); pblk_set_sec_per_write(pblk, pblk->min_write_pgs); pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t),