From patchwork Tue Jan 12 06:49:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 8014231 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3AA159F6FA for ; Tue, 12 Jan 2016 06:57:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42D1F201F4 for ; Tue, 12 Jan 2016 06:57:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46A8020386 for ; Tue, 12 Jan 2016 06:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760688AbcALGvO (ORCPT ); Tue, 12 Jan 2016 01:51:14 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38550 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760952AbcALGuH (ORCPT ); Tue, 12 Jan 2016 01:50:07 -0500 Received: by mail-wm0-f50.google.com with SMTP id b14so303593735wmb.1 for ; Mon, 11 Jan 2016 22:50:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=CHeQO9tqg5BEXg4wCUHqvLVTeY6Botn8T4Yc+863TjI=; b=L/ULK4BfFlMImhnEwfadf+PGMJx9n142vqIJtpBZs3mRajGS1YK/+S1xqs5plSdpB8 Qo/tp4hNzDxrhARHtYq+r9DpWFj69I0RCwUaX5SX7Pbi3aKybXdQEuicFuU+Jaz2m96G UCBcuQqWNpBVw3a6z/Z7k91xDlxQINtmFNXtc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=CHeQO9tqg5BEXg4wCUHqvLVTeY6Botn8T4Yc+863TjI=; b=kczxJ1EitRazlCzs8JeEtOpavJIFep/tI0qFPMTRZ6pDgWs+wzrJCnjRQEP/1Vk1M9 +B6NWkNySlRT5Wx/OTwd9dKHsrxu+R0qdEWf/bO9VhDPKGUYT3zeO2GsDS4ojvDiGhMU z9Yp5lZivWZDgjV9yArAGC9i8tNWiuczDrR+T4x3nw7dU168hrqS25omzUw8eVODC2fp hZYm0LVJ/+WT9QgjJZHUen4GlIDkWIGWo8KnDi/q4qXjcnq2Oj8wqPJb4h4aKKjC/qrK 5pqb55K4T4zVvq0QfgErGVMrQovIqnB+d/u9Lq9VKAfHwf9WDsQCB5CfPspazfbeofX2 xe4g== X-Gm-Message-State: ALoCoQlL5QmbeiEbny4OkdLrETzhSy4aWBIPrSrEmmiunKH1OVCvDEb6XsKsqLImJN+wHQQQ89NjaScPU1s8iG/t8VK17T/bCA== X-Received: by 10.194.7.100 with SMTP id i4mr130161563wja.76.1452581406195; Mon, 11 Jan 2016 22:50:06 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id yz5sm70776886wjc.36.2016.01.11.22.50.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 22:50:05 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com Cc: Wenwei Tao , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 10/25] lightnvm: put block back to gc list on its reclaim fail Date: Tue, 12 Jan 2016 07:49:24 +0100 Message-Id: <1452581379-18162-11-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452581379-18162-1-git-send-email-m@bjorling.me> References: <1452581379-18162-1-git-send-email-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wenwei Tao We delete a block from the gc list before reclaim it, so put it back to the list on its reclaim fail, otherwise this block will not get reclaimed and be programmable in the future. Signed-off-by: Wenwei Tao Signed-off-by: Matias Bjørling --- drivers/lightnvm/rrpc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index 5df4a69..bee2352 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -381,16 +381,26 @@ static void rrpc_block_gc(struct work_struct *work) struct rrpc *rrpc = gcb->rrpc; struct rrpc_block *rblk = gcb->rblk; struct nvm_dev *dev = rrpc->dev; + struct nvm_lun *lun = rblk->parent->lun; + struct rrpc_lun *rlun = &rrpc->luns[lun->id - rrpc->lun_offset]; + mempool_free(gcb, rrpc->gcb_pool); pr_debug("nvm: block '%lu' being reclaimed\n", rblk->parent->id); if (rrpc_move_valid_pages(rrpc, rblk)) - goto done; + goto put_back; + + if (nvm_erase_blk(dev, rblk->parent)) + goto put_back; - nvm_erase_blk(dev, rblk->parent); rrpc_put_blk(rrpc, rblk); -done: - mempool_free(gcb, rrpc->gcb_pool); + + return; + +put_back: + spin_lock(&rlun->lock); + list_add_tail(&rblk->prio, &rlun->prio_list); + spin_unlock(&rlun->lock); } /* the block with highest number of invalid pages, will be in the beginning