Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2525587imj; Mon, 11 Feb 2019 04:26:01 -0800 (PST) X-Google-Smtp-Source: AHgI3IY3QjOPJ/Oqg76F+Uh7JlTYy9yB08C01/kxvLw+IGONwPaXb6utqYZA5wZmSbs3BYonQVTj X-Received: by 2002:a62:4bd5:: with SMTP id d82mr10442910pfj.85.1549887961213; Mon, 11 Feb 2019 04:26:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549887961; cv=none; d=google.com; s=arc-20160816; b=qe0IJr2Zpb/bcR8CajCIHGzPdur8Swa+6qiOJtb3WQ3QmFfiuLkBoBd9o+D0s0kE5f o6hwfrBBNt+ImF3Wg0iEgkZBzJNtCmS6WoRVshoPDDwQdXA/zlCLLkJbjPunVqkFZoQX vKe3WxatUiM331DnnZ2PmrmTLAdWTO2nafje+kKGZ4sJU7GKYzpY/ctylNt/FlHPgsyl bUsWcN4eI+2/aReuSoRyv+23B6SPSTwPvbZCbZnPBl3TYG2C1OBjeWNApyS/25Oqsfe5 s3gSmqkZkPrtVTwKKabklnJCU5FrjEaT2Y5WdiaAhLcQ3lluy09sc3FXdXxvhjKcVAv5 jk2Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u99sfZGMW+gKwnhlHoCgtcN3E+Mx1BLTxSFc1sUIIAQ=; b=LBfG60jMMSr2OFPwXAqpRpIQ0slkXQPXv3h+PKFqA4XFw7DtKMMnSRsyDD37MrNB9O wW6emPYYplcEDyQIBGoEWSJ1EIBxYiTG8QIHweFi9xF/f8HgAtd/C14F0yx80g5t2aWq ZzDUjTlR/uKuPvHXmqaIhvraXsfawOMVXX/tUGwEHf47CMMUtws+wehmqzYCa1YDrqFT UdvVzikjXWz0afFY5dy+Af9s8Td5F+Eir2yh3j9yHXnsFD9cwq3LXQY0UWweZq/B0Fv0 u2NafXkUbrZ7yDrwcRLBfsdKCxWkc1yeX30ZT2k9ni+Tlt0m36TgKhetsrxNvuRQ5X/x MICQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=OeTqf7vw; 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 a12si9291174pgk.291.2019.02.11.04.25.44; Mon, 11 Feb 2019 04:26:01 -0800 (PST) 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=OeTqf7vw; 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 S1727359AbfBKMZa (ORCPT + 99 others); Mon, 11 Feb 2019 07:25:30 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34039 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727331AbfBKMZ1 (ORCPT ); Mon, 11 Feb 2019 07:25:27 -0500 Received: by mail-lj1-f196.google.com with SMTP id v14-v6so8613503ljv.1 for ; Mon, 11 Feb 2019 04:25:25 -0800 (PST) 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=u99sfZGMW+gKwnhlHoCgtcN3E+Mx1BLTxSFc1sUIIAQ=; b=OeTqf7vwVFPb4XWTOINv2Nkr1BygqM1y3N6yQWHuu1MSTXIDLvWOsn7ZFiDSeuSar8 UrNO9siXy9X6UpnwJ9qANneuy9rASLM12VE58revt2WDNfM/ptdR3UM53Dw7+6OH6Sm+ Rr/zKg2Ah4S50Qg4rLHKbqGbjDnF8M9PO+dvLr1/4+wBG8lAKE1wdz6sVSSxC5BSXTBD Kao3MGDgRDBvt/Mekjn2joA5bzJJldp55rJvof4zFT/3NcKRW362UZX1PRVMD5sYB+3L hW9R836AL4EQJp7XeZY2CFeAUKjAT9BHyd1HansGVq4kNiGX8sykmr7UZ9r4Z6V2Qalb /Vrw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=u99sfZGMW+gKwnhlHoCgtcN3E+Mx1BLTxSFc1sUIIAQ=; b=BzOBgwW5Tnwe0QQjPzIgOtk8LRmzZ4rN56d+XStQt+oaugzMqo8kW0VaLi7rBW3MbH 5fvoxK3/L/2iE4dBFoCRzew1lsx4fyOh9EePmRgTlGrAJHkv62rejP06pG6dWp4yePpV mgDCkb0DunPKvv36cSPh1yRwFDdPjIxuxl012jztDzXze5RLf4SUnAqN1vdWw4o3uwR9 gKRE2TRs2dLNglIq1YxDmEEax82I0fRxnC8thG1t7IyC8yEpjw8sceP7gIjtkk46RpO4 nKIcMObqRF3CVe898mev4T1XLDdCaCw6wS8YDU7S3WS85/eiPC4csbAWewY8ZT+F6k3b G9Sw== X-Gm-Message-State: AHQUAuZXnC1LWJwldoTTolfB6ITn9cMfBbjI5UXY0yJutFmh0pskNUKI /vQ7NHkUzkS2HOy4WYrEC/055w== X-Received: by 2002:a2e:90ca:: with SMTP id o10-v6mr8403783ljg.134.1549887924179; Mon, 11 Feb 2019 04:25:24 -0800 (PST) Received: from skyninja.webspeed.dk (2-111-91-225-cable.dk.customer.tdc.net. [2.111.91.225]) by smtp.gmail.com with ESMTPSA id d70sm2278481lfe.14.2019.02.11.04.25.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 04:25:22 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 4/8] lightnvm: pblk: Switch to use new generic UUID API Date: Mon, 11 Feb 2019 13:25:05 +0100 Message-Id: <20190211122509.19910-5-mb@lightnvm.io> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190211122509.19910-1-mb@lightnvm.io> References: <20190211122509.19910-1-mb@lightnvm.io> 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 From: Andy Shevchenko There are new types and helpers that are supposed to be used in new code. As a preparation to get rid of legacy types and API functions do the conversion here. Signed-off-by: Andy Shevchenko Reviewed-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-core.c | 5 +++-- drivers/lightnvm/pblk-init.c | 2 +- drivers/lightnvm/pblk-recovery.c | 8 +++++--- drivers/lightnvm/pblk.h | 10 +--------- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 1b5ff51faa63..2a9e9facf44f 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -1065,7 +1065,7 @@ static int pblk_line_init_metadata(struct pblk *pblk, struct pblk_line *line, bitmap_set(line->lun_bitmap, 0, lm->lun_bitmap_len); smeta_buf->header.identifier = cpu_to_le32(PBLK_MAGIC); - memcpy(smeta_buf->header.uuid, pblk->instance_uuid, 16); + guid_copy((guid_t *)&smeta_buf->header.uuid, &pblk->instance_uuid); smeta_buf->header.id = cpu_to_le32(line->id); smeta_buf->header.type = cpu_to_le16(line->type); smeta_buf->header.version_major = SMETA_VERSION_MAJOR; @@ -1874,7 +1874,8 @@ void pblk_line_close_meta(struct pblk *pblk, struct pblk_line *line) if (le32_to_cpu(emeta_buf->header.identifier) != PBLK_MAGIC) { emeta_buf->header.identifier = cpu_to_le32(PBLK_MAGIC); - memcpy(emeta_buf->header.uuid, pblk->instance_uuid, 16); + guid_copy((guid_t *)&emeta_buf->header.uuid, + &pblk->instance_uuid); emeta_buf->header.id = cpu_to_le32(line->id); emeta_buf->header.type = cpu_to_le16(line->type); emeta_buf->header.version_major = EMETA_VERSION_MAJOR; diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index eb0135c77805..8b643d0bffae 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -130,7 +130,7 @@ static int pblk_l2p_recover(struct pblk *pblk, bool factory_init) struct pblk_line *line = NULL; if (factory_init) { - pblk_setup_uuid(pblk); + guid_gen(&pblk->instance_uuid); } else { line = pblk_recov_l2p(pblk); if (IS_ERR(line)) { diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 5ee20da7bdb3..6761d2afa4d0 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -703,11 +703,13 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk) /* The first valid instance uuid is used for initialization */ if (!valid_uuid) { - memcpy(pblk->instance_uuid, smeta_buf->header.uuid, 16); + guid_copy(&pblk->instance_uuid, + (guid_t *)&smeta_buf->header.uuid); valid_uuid = 1; } - if (memcmp(pblk->instance_uuid, smeta_buf->header.uuid, 16)) { + if (!guid_equal(&pblk->instance_uuid, + (guid_t *)&smeta_buf->header.uuid)) { pblk_debug(pblk, "ignore line %u due to uuid mismatch\n", i); continue; @@ -737,7 +739,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk) } if (!found_lines) { - pblk_setup_uuid(pblk); + guid_gen(&pblk->instance_uuid); spin_lock(&l_mg->free_lock); WARN_ON_ONCE(!test_and_clear_bit(meta_line, diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index 0dd697ea201e..72ae8755764e 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -646,7 +646,7 @@ struct pblk { int sec_per_write; - unsigned char instance_uuid[16]; + guid_t instance_uuid; /* Persistent write amplification counters, 4kb sector I/Os */ atomic64_t user_wa; /* Sectors written by user */ @@ -1360,14 +1360,6 @@ static inline unsigned int pblk_get_secs(struct bio *bio) return bio->bi_iter.bi_size / PBLK_EXPOSED_PAGE_SIZE; } -static inline void pblk_setup_uuid(struct pblk *pblk) -{ - uuid_le uuid; - - uuid_le_gen(&uuid); - memcpy(pblk->instance_uuid, uuid.b, 16); -} - static inline char *pblk_disk_name(struct pblk *pblk) { struct gendisk *disk = pblk->disk; -- 2.19.1