Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2072161imu; Thu, 24 Jan 2019 06:48:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN5PSdUC/qj33YIkO18NK6gnQQAFhiHM/NilxjvLF21Gg4zT44fDMQsnqy+sRlE6HZeJk9os X-Received: by 2002:a63:f94c:: with SMTP id q12mr6098007pgk.91.1548341335356; Thu, 24 Jan 2019 06:48:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548341335; cv=none; d=google.com; s=arc-20160816; b=S7rKtk/SM1ui6T4/6E+X/sexHHmJx8np0GtQXi6tW6QHiI6SyPhh7HpxuvoZAirWb3 SrKwuv1w6SDtKMwjfGBxSHdUi+W1GwXSpTy2QCtBryA90S6TUJVlhQQTaAOfgOR8tuEz qVQ5e4XbQ0476WWSrySLrIK5toMwUelVdeBfmpw6Gufz2Ifwc0Q2MPrkksPNLJJJSRag JtgTc0o5fVMK/dsgexpLDL8OyjqBvAs/P1wg+DgYvlYIhnl6WNmw9eicRPXqNJjIcN9c hNxPRrT4JniIPo34nCfoh2jItie0EgS/nk5pyGUz1FMDLoRYNk2C2Qp+xRFJ+hHrGKzl ZYvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature; bh=JkUya7J7mb6PwItb8j8g6qDTLWdjQ0EAK0iNiKy/kyQ=; b=DZLg2JCHikA8PFFI90nudICAtoTilLKpozADxrhmY+CEeTbU9Kx0Bh6Jp/EMbPGtGK OuGx8L3yUCYw5/lKop+4xiZbYhySj4AAB3XKomR0HFe6kYYiAAAK7ZWd+I78boLdeyjK iVbi+vW1EO2AYv4uHIQojfckIVCUrFqyqkqFJ3dgQn7ttDdkUvtrkcdl4XwNW19SfDvs QkJDZVrx3M58MvY3hZ2755XVv88JcJECFwG1Yrfi642x4DMSNS6U50Xb27ulwRq6//yV P9gqGQZiVPgP+UEeF2BJKHUFpa4sHN7zwhXaYFsv02oUqqx/IB0Y8x3XtCAIpBZkHrK8 2IMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b="aYI940D/"; 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 r7si18031543ple.281.2019.01.24.06.48.39; Thu, 24 Jan 2019 06:48:55 -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=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b="aYI940D/"; 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 S1728387AbfAXOsT (ORCPT + 99 others); Thu, 24 Jan 2019 09:48:19 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:46674 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728170AbfAXOsT (ORCPT ); Thu, 24 Jan 2019 09:48:19 -0500 Received: by mail-ed1-f65.google.com with SMTP id o10so4746704edt.13 for ; Thu, 24 Jan 2019 06:48:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=JkUya7J7mb6PwItb8j8g6qDTLWdjQ0EAK0iNiKy/kyQ=; b=aYI940D/9HzqEGH09GuNqZVCTTKwZiBiHJr6dOkgUiTZsM6+Yd1yvngzYoQnmBbXDE PcbJBlPgAxV3R0RnnaEM/8dnqwvkfDMK9TN8a+E55e9VlofNYL4TR/UZHlnHaQYaZPdW 1CBdj3DIKKMPXwCt5C0fn7owP73N1eSaV1H5TxFbBm6TLxDI3hKRfW/5hxXKNnknOxKo TgJse+q2eS7AVNNCCtCoZh4MBtSi9YsSusEkP4CBXSuCBhCL89i82CBWUFkjZijJF5Ho MBkNA0ixZ7yVqUNy3Xt0Vaxl5fhenbwhPy92FJQ9aDxpw7kiUeOv0BH+evBY00EDx7V0 J3zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=JkUya7J7mb6PwItb8j8g6qDTLWdjQ0EAK0iNiKy/kyQ=; b=oxGOcr6n5wgzsS8z6NwfMRoCKsi4CZZI3Na/3EuoLl5AZ5eZRag3MO2kNQuwsiHFg5 OmRzX88OU+qCbDmgZIJf7yajUw05B933fiI8x7fpr44muA7++Tt6fCpuZwspxD23olHR kMSuH1+LCikohfHqhHwnkwsVR9e5tIUBbSte7EpVYe+neT/iEL5Ke9rmFR6f9BwNbNFh 1/C+HKP+e7p+JflNfiLd8AAIi9b+t9Wdnch4wyRL/KvIcAAVUTwWib0xkCqYgulGdfHY kbMh4zvN6mu5WpE7IR7c89SEDli4sdP3KB3YYGy2byXY7iAK5hoXcvSsRssFsQ5tdM2y m0SA== X-Gm-Message-State: AJcUukfV+wxXrNbdshdj0gEDB3hHmGUZNt/hHXOeGLUIIMx6etnu8pZO axnb2s6WHX9VF9D3ZoDYx4bXUA== X-Received: by 2002:a17:906:1102:: with SMTP id h2-v6mr6159991eja.18.1548341296691; Thu, 24 Jan 2019 06:48:16 -0800 (PST) Received: from [192.168.1.85] (ip-5-186-122-168.cgn.fibianet.dk. [5.186.122.168]) by smtp.gmail.com with ESMTPSA id cf6sm239113ejb.45.2019.01.24.06.48.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 06:48:16 -0800 (PST) From: =?utf-8?Q?Javier_Gonz=C3=A1lez?= Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_ED2BE341-6551-4FDC-94E2-596DE8A640C3"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: [PATCH v2] lightnvm: pblk: Switch to use new generic UUID API Date: Thu, 24 Jan 2019 15:48:15 +0100 In-Reply-To: <20190124143137.13880-1-andriy.shevchenko@linux.intel.com> Cc: =?utf-8?Q?Matias_Bj=C3=B8rling?= , Jens Axboe , linux-block@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org To: Andy Shevchenko References: <20190124143137.13880-1-andriy.shevchenko@linux.intel.com> X-Mailer: Apple Mail (2.3445.102.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_ED2BE341-6551-4FDC-94E2-596DE8A640C3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 24 Jan 2019, at 15.31, Andy Shevchenko = wrote: >=20 > There are new types and helpers that are supposed to be used in new = code. >=20 > As a preparation to get rid of legacy types and API functions do > the conversion here. >=20 > Signed-off-by: Andy Shevchenko > --- >=20 > v2: > - convert instance_uuid to guid_t and get rid of pblk_setup_uuid() > - fix subject line to show subsystem >=20 > drivers/lightnvm/pblk-core.c | 4 ++-- > drivers/lightnvm/pblk-init.c | 2 +- > drivers/lightnvm/pblk-recovery.c | 8 +++++--- > drivers/lightnvm/pblk.h | 10 +--------- > 4 files changed, 9 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/lightnvm/pblk-core.c = b/drivers/lightnvm/pblk-core.c > index 1ff165351180..189339965957 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); >=20 > smeta_buf->header.identifier =3D 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 =3D cpu_to_le32(line->id); > smeta_buf->header.type =3D cpu_to_le16(line->type); > smeta_buf->header.version_major =3D SMETA_VERSION_MAJOR; > @@ -1874,7 +1874,7 @@ void pblk_line_close_meta(struct pblk *pblk, = struct pblk_line *line) >=20 > if (le32_to_cpu(emeta_buf->header.identifier) !=3D PBLK_MAGIC) { > emeta_buf->header.identifier =3D = 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 =3D cpu_to_le32(line->id); > emeta_buf->header.type =3D cpu_to_le16(line->type); > emeta_buf->header.version_major =3D EMETA_VERSION_MAJOR; > diff --git a/drivers/lightnvm/pblk-init.c = b/drivers/lightnvm/pblk-init.c > index f9a3e47b6a93..5768333d103f 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 =3D NULL; >=20 > if (factory_init) { > - pblk_setup_uuid(pblk); > + guid_gen(&pblk->instance_uuid); > } else { > line =3D 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) >=20 > /* 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 =3D 1; > } >=20 > - 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) > } >=20 > if (!found_lines) { > - pblk_setup_uuid(pblk); > + guid_gen(&pblk->instance_uuid); >=20 > 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 85e38ed62f85..12bf02df4204 100644 > --- a/drivers/lightnvm/pblk.h > +++ b/drivers/lightnvm/pblk.h > @@ -646,7 +646,7 @@ struct pblk { >=20 > int sec_per_write; >=20 > - unsigned char instance_uuid[16]; > + guid_t instance_uuid; >=20 > /* 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; > } >=20 > -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 =3D pblk->disk; > -- > 2.20.1 Looks good to me. Thanks Andy. Reviewed-by: Javier Gonz=C3=A1lez --Apple-Mail=_ED2BE341-6551-4FDC-94E2-596DE8A640C3 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEU1dMZpvMIkj0jATvPEYBfS0leOAFAlxJ0C8ACgkQPEYBfS0l eOA/rw//dJAadFjxb/daXk5sHgXRe82U2KrYnVvpDKvS3axFm5EXYrDRybxqhLrd Ibpa4lZSvYVTs4TsZclHT2QeKaFxgPZ/f3rSAj4EK/wcM1HA5QOS9wy2fTOXBHdJ DCKlbzduFYo9MGdGsjLhkc24tlU8DqqFUG1HpdPvhJSOMVmtdioszjb1gNOMub4K M6+DHvO3xlHFGbaon6BKsCTjPNMi8Cme1Dmbb0iPOw7d7eOBbSxWwZ2baNL1jazm J1lhfsLn3oYTrCp07lUAjLrUM5ga3r5N8tMOAiUVRKnEqo0QEvOFpdYMy/X6bA0x RqoPii5Je7MiomyKo//sRecJwiGsHgw1jTauHOhvxaPaGjFmSNKnRzZlFsoNfciq bz28Ut/L1dLVEuaZupBirOV06ftmqCiQO3figBDhpOV/R1yzB5ICCqxXHsJVdRjM 7ahAR2T/gvPLs5cA+dVSEieM/loe2mAPcxT9VMlfjZd2y5BIO4x8nIbFOK6SjWAN UmJyjFkj02FmTxxCOW/6kVqE91JoRdVjPg8xJrWTYljfRQLUjnwxuEF2wDgPTSRq IveuP07x0uH4yRYQPvcknOXVuIt0/BZHUe5T6abpZsovoWLG2bJb/3+Si86uuBuv jQcRdBXuQLYDud7cnPq2lqHNpw2UqH8zcWREYa9p/mFhO8vAbmo= =ZIxO -----END PGP SIGNATURE----- --Apple-Mail=_ED2BE341-6551-4FDC-94E2-596DE8A640C3--