From patchwork Sat Apr 15 18:55:39 2017 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: 9682403 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 799AB60138 for ; Sat, 15 Apr 2017 18:59:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C1F925223 for ; Sat, 15 Apr 2017 18:59:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F72728305; Sat, 15 Apr 2017 18:59:59 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable 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 E807725223 for ; Sat, 15 Apr 2017 18:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755274AbdDOS4c (ORCPT ); Sat, 15 Apr 2017 14:56:32 -0400 Received: from mail-dm3nam03on0041.outbound.protection.outlook.com ([104.47.41.41]:38016 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754787AbdDOS4Y (ORCPT ); Sat, 15 Apr 2017 14:56:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pExLV/XuFAo36jLuokGppVYu/usct5xO2hp+TprSO24=; b=AgpXAzFumQUsr0ATkgnjexORp75N3Bkh1tVP0B+HgoH7zXMUaEl7z26iFBB88Ka/ACZa5h0N0RZYyKVR/8igMeqfUi4P9h5+Ja0yD6W7nYhAN/OoE6Yo2KoAX4iuXn8IU1MBfAADWFVxo6uVVFSg32w+a7CKIWBNoYKIfTFQT/Y= Authentication-Results: fb.com; dkim=none (message not signed) header.d=none; fb.com; dmarc=none action=none header.from=cnexlabs.com; Received: from skyninja.cnexlabs.com (193.106.164.211) by CY4PR06MB2774.namprd06.prod.outlook.com (10.175.117.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Sat, 15 Apr 2017 18:56:18 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: CC: , , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 05/19] lightnvm: free reverse device map Date: Sat, 15 Apr 2017 20:55:39 +0200 Message-ID: <20170415185553.16098-6-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170415185553.16098-1-matias@cnexlabs.com> References: <20170415185553.16098-1-matias@cnexlabs.com> MIME-Version: 1.0 X-Originating-IP: [193.106.164.211] X-ClientProxiedBy: AM5PR0701CA0069.eurprd07.prod.outlook.com (10.169.145.159) To CY4PR06MB2774.namprd06.prod.outlook.com (10.175.117.142) X-MS-Office365-Filtering-Correlation-Id: d9ee94b5-fb46-48d4-cb7f-08d484311a8a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:CY4PR06MB2774; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2774; 3:x/KPiHghzKnqtmRIVA3wL/HbMuk6Z/CwZWX6cKZ2ziLIAil5v/DDOwcisHYeXtnR2Hl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9XrjOYGrerxCilT/yDvJQL5GI4pxzU/F2ZABIABSUIWHj3h1J1b2CVK8lRkS8Rc+WJYai/1WQFprCu8aCTYGgmkQhjnchPtFPmj1fvGT53gs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201703061421075)(20161123555025)(6072148); SRVR:CY4PR06MB2774; BCL:0; PCL:0; RULEID:; SRVR:CY4PR06MB2774; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2774; 4:v8fx9TwPVeGeqfcGkpjhqzcG5kYOb3xgtTCAJ83Y8VXulxa3YKFUNlkgxsWhqjCyLp/VQkXQbNVvyTTocOCglGbllQSyy1J26ZgDQeMS/Trm6sn5XUTdV4jdacyym2l+cr+mTJq8E3C+SLt2lzOCb60m594QlJ6wmO9RHD5gSme35Hynk1xtRuX7LQ8P68u+9hdM9oFzBhAqjoekfeN8Pp8THy4Y8LW/gG+khdPZPhZknwMT4nkzYDOnHS3KBNyfiMg7/bvCjEjslixa47OFY4W2XHPfXSye52SaZ2sTOYE/WmWQCOKMnmmziG33DKubbSfRmY/FYcXiv3KORB3ygWakRJXAb6nFtHyIIB0YYH5p3lxcqX53XH0LJIytTbkILVa46TI2CzkL4n7EEFNbgcGVt5XMxrSLBOakUdNGbKLp0mVMBq21JtkQ+i37FwXgaXB35FY6tNEDzHEm0vo2rKc1tIDRSgS9Un0T8UYAxmd4L2nE9aGYA4s6etUgTqpxpq4Ca2NZNbV159BsbQCS/Hds+d1PCwoMxddOo0X5vhxDVyzDlHB2L47+Yn4l/lNyWfZa0fTtXSWTU3CatKTEvYHOf3c1yLP2ILNNpbLmv9vCpNbxF6pLJsu9/7O0MpL5rHHAkP22/Hl9YyCakR51ieDjDpw9NY8bNwb5tloYG80jDe6cghRn7LBpK5+U5ZXK X-Forefront-PRVS: 02788FF38E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39400400002)(39450400003)(86362001)(305945005)(1076002)(6916009)(6666003)(25786009)(2950100002)(6486002)(2906002)(3846002)(6116002)(2870700001)(54906002)(189998001)(53936002)(53416004)(107886003)(110136004)(5660300001)(38730400002)(50986999)(76176999)(2351001)(4326008)(66066001)(5820100001)(23676002)(81166006)(47776003)(42186005)(36756003)(33646002)(50226002)(8676002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR06MB2774; H:skyninja.cnexlabs.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjA2TUIyNzc0OzIzOnh6Uk1YYVBseG0xcVQ0c1dpclBGbldLSS9n?= =?utf-8?B?UDJwVGE2VU5tM0JwUjlDODVmb0llVmpiYzZGZXJGWU5kTExuWGFKOWFLRmEr?= =?utf-8?B?d1FhWXVmb2RpUlBpb21pSzZlbTVEY0Y4RkEzMnVTSFgyRUZlek5sZDNiVHJ5?= =?utf-8?B?dGxBTzczTmJ2TmRremVUN1g3NXN4Y1NlZzRySUxFaXZJSWFycHh5VEcvVllv?= =?utf-8?B?NkU4ZmVzcnk1MlhVRmRiNUM3UWJReURnVTEzaU80TTROcjZSUXZDbXRxUWlT?= =?utf-8?B?UVVYQzBOUHBlNnU0OTFhZ2Iwd3RHZ09kNytJbGRDZUJOTVh3WGt5SmZOcFBD?= =?utf-8?B?cGR0NFdiSC9Sc0laSk9KMm1xVG1GK1JzemZPeTNlK3RZRGVHd2VGbkU5SnFL?= =?utf-8?B?U1M3dUdxVmlSMUJJcjdMaFpJZ0dESGxPWmNKdlB4elF3V1B4RjdOSHh1ZGRq?= =?utf-8?B?MVI5OG5vQnkwNlNxMVZ2SmErVGh3OWRHWnYrOE1NYzJvblpLOXppWnMwWWdJ?= =?utf-8?B?NGFmOXdNdkIyaWF0YUpGK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/w== X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2017 18:56:18.7890 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR06MB2774 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 From: Javier González Free the reverse mapping table correctly on target tear down Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 95105c4..a14c52c 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -411,6 +411,18 @@ static int nvm_register_map(struct nvm_dev *dev) return -ENOMEM; } +static void nvm_unregister_map(struct nvm_dev *dev) +{ + struct nvm_dev_map *rmap = dev->rmap; + int i; + + for (i = 0; i < dev->geo.nr_chnls; i++) + kfree(rmap->chnls[i].lun_offs); + + kfree(rmap->chnls); + kfree(rmap); +} + static void nvm_map_to_dev(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p) { struct nvm_dev_map *dev_map = tgt_dev->map; @@ -992,7 +1004,7 @@ void nvm_free(struct nvm_dev *dev) if (dev->dma_pool) dev->ops->destroy_dma_pool(dev->dma_pool); - kfree(dev->rmap); + nvm_unregister_map(dev); kfree(dev->lptbl); kfree(dev->lun_map); kfree(dev);