All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
@ 2021-02-09 16:42 Andy Shevchenko
  2021-02-14 10:32 ` Matias Bjørling
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-02-09 16:42 UTC (permalink / raw)
  To: Matias Bjorling, linux-block, Jens Axboe; +Cc: Andy Shevchenko

There is a specific API to treat raw data as GUID, i.e. export_guid()
and import_guid(). Use them instead of guid_copy() with explicit casting.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/lightnvm/pblk-core.c     | 5 ++---
 drivers/lightnvm/pblk-recovery.c | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 1dddba11e721..33d39d3dd343 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -988,7 +988,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);
-	guid_copy((guid_t *)&smeta_buf->header.uuid, &pblk->instance_uuid);
+	export_guid(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;
@@ -1803,8 +1803,7 @@ 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);
-		guid_copy((guid_t *)&emeta_buf->header.uuid,
-							&pblk->instance_uuid);
+		export_guid(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-recovery.c b/drivers/lightnvm/pblk-recovery.c
index 299ef47a17b2..0e6f0c76e930 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -706,8 +706,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
 
 		/* The first valid instance uuid is used for initialization */
 		if (!valid_uuid) {
-			guid_copy(&pblk->instance_uuid,
-				  (guid_t *)&smeta_buf->header.uuid);
+			import_guid(&pblk->instance_uuid, smeta_buf->header.uuid);
 			valid_uuid = 1;
 		}
 
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
  2021-02-09 16:42 [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid() Andy Shevchenko
@ 2021-02-14 10:32 ` Matias Bjørling
  0 siblings, 0 replies; 6+ messages in thread
From: Matias Bjørling @ 2021-02-14 10:32 UTC (permalink / raw)
  To: Andy Shevchenko, linux-block, Jens Axboe

On 09/02/2021 17.42, Andy Shevchenko wrote:
> There is a specific API to treat raw data as GUID, i.e. export_guid()
> and import_guid(). Use them instead of guid_copy() with explicit casting.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/lightnvm/pblk-core.c     | 5 ++---
>   drivers/lightnvm/pblk-recovery.c | 3 +--
>   2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
> index 1dddba11e721..33d39d3dd343 100644
> --- a/drivers/lightnvm/pblk-core.c
> +++ b/drivers/lightnvm/pblk-core.c
> @@ -988,7 +988,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);
> -	guid_copy((guid_t *)&smeta_buf->header.uuid, &pblk->instance_uuid);
> +	export_guid(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;
> @@ -1803,8 +1803,7 @@ 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);
> -		guid_copy((guid_t *)&emeta_buf->header.uuid,
> -							&pblk->instance_uuid);
> +		export_guid(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-recovery.c b/drivers/lightnvm/pblk-recovery.c
> index 299ef47a17b2..0e6f0c76e930 100644
> --- a/drivers/lightnvm/pblk-recovery.c
> +++ b/drivers/lightnvm/pblk-recovery.c
> @@ -706,8 +706,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
>   
>   		/* The first valid instance uuid is used for initialization */
>   		if (!valid_uuid) {
> -			guid_copy(&pblk->instance_uuid,
> -				  (guid_t *)&smeta_buf->header.uuid);
> +			import_guid(&pblk->instance_uuid, smeta_buf->header.uuid);
>   			valid_uuid = 1;
>   		}
>   

Thanks, Andy. I've pulled it.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
  2020-06-18 11:14   ` Matias Bjørling
@ 2020-06-18 15:17     ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2020-06-18 15:17 UTC (permalink / raw)
  To: Matias Bjørling, Andy Shevchenko, linux-block

On 6/18/20 5:14 AM, Matias Bjørling wrote:
> On 18/06/2020 12.57, Andy Shevchenko wrote:
>> On Wed, Apr 22, 2020 at 04:06:11PM +0300, Andy Shevchenko wrote:
>>> There is a specific API to treat raw data as GUID, i.e. export_guid()
>>> and import_guid(). Use them instead of guid_copy() with explicit casting.
>> Any comment on this?
>>
>>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>> ---
>>>   drivers/lightnvm/pblk-core.c     | 5 ++---
>>>   drivers/lightnvm/pblk-recovery.c | 3 +--
>>>   2 files changed, 3 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>>> index b413bafe93fdd..6d4523dbf2dbb 100644
>>> --- a/drivers/lightnvm/pblk-core.c
>>> +++ b/drivers/lightnvm/pblk-core.c
>>> @@ -988,7 +988,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);
>>> -	guid_copy((guid_t *)&smeta_buf->header.uuid, &pblk->instance_uuid);
>>> +	export_guid(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;
>>> @@ -1803,8 +1803,7 @@ 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);
>>> -		guid_copy((guid_t *)&emeta_buf->header.uuid,
>>> -							&pblk->instance_uuid);
>>> +		export_guid(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-recovery.c b/drivers/lightnvm/pblk-recovery.c
>>> index 299ef47a17b22..0e6f0c76e9302 100644
>>> --- a/drivers/lightnvm/pblk-recovery.c
>>> +++ b/drivers/lightnvm/pblk-recovery.c
>>> @@ -706,8 +706,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
>>>   
>>>   		/* The first valid instance uuid is used for initialization */
>>>   		if (!valid_uuid) {
>>> -			guid_copy(&pblk->instance_uuid,
>>> -				  (guid_t *)&smeta_buf->header.uuid);
>>> +			import_guid(&pblk->instance_uuid, smeta_buf->header.uuid);
>>>   			valid_uuid = 1;
>>>   		}
>>>   
>>> -- 
>>> 2.26.1
>>>
> Andy, it looks good to me.
> 
> Jens, there is three outstanding patches for LightNVM in this round. 
> Would you like me to round them up and submit a pull request, or would 
> you like to pick them up separately?

Please just send a pull request, makes it easier for me.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
  2020-06-18 10:57 ` Andy Shevchenko
@ 2020-06-18 11:14   ` Matias Bjørling
  2020-06-18 15:17     ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Matias Bjørling @ 2020-06-18 11:14 UTC (permalink / raw)
  To: Andy Shevchenko, linux-block, Jens Axboe

On 18/06/2020 12.57, Andy Shevchenko wrote:
> On Wed, Apr 22, 2020 at 04:06:11PM +0300, Andy Shevchenko wrote:
>> There is a specific API to treat raw data as GUID, i.e. export_guid()
>> and import_guid(). Use them instead of guid_copy() with explicit casting.
> Any comment on this?
>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> ---
>>   drivers/lightnvm/pblk-core.c     | 5 ++---
>>   drivers/lightnvm/pblk-recovery.c | 3 +--
>>   2 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>> index b413bafe93fdd..6d4523dbf2dbb 100644
>> --- a/drivers/lightnvm/pblk-core.c
>> +++ b/drivers/lightnvm/pblk-core.c
>> @@ -988,7 +988,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);
>> -	guid_copy((guid_t *)&smeta_buf->header.uuid, &pblk->instance_uuid);
>> +	export_guid(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;
>> @@ -1803,8 +1803,7 @@ 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);
>> -		guid_copy((guid_t *)&emeta_buf->header.uuid,
>> -							&pblk->instance_uuid);
>> +		export_guid(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-recovery.c b/drivers/lightnvm/pblk-recovery.c
>> index 299ef47a17b22..0e6f0c76e9302 100644
>> --- a/drivers/lightnvm/pblk-recovery.c
>> +++ b/drivers/lightnvm/pblk-recovery.c
>> @@ -706,8 +706,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
>>   
>>   		/* The first valid instance uuid is used for initialization */
>>   		if (!valid_uuid) {
>> -			guid_copy(&pblk->instance_uuid,
>> -				  (guid_t *)&smeta_buf->header.uuid);
>> +			import_guid(&pblk->instance_uuid, smeta_buf->header.uuid);
>>   			valid_uuid = 1;
>>   		}
>>   
>> -- 
>> 2.26.1
>>
Andy, it looks good to me.

Jens, there is three outstanding patches for LightNVM in this round. 
Would you like me to round them up and submit a pull request, or would 
you like to pick them up separately?

Thank you, Matias


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
  2020-04-22 13:06 Andy Shevchenko
@ 2020-06-18 10:57 ` Andy Shevchenko
  2020-06-18 11:14   ` Matias Bjørling
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-06-18 10:57 UTC (permalink / raw)
  To: Matias Bjorling, linux-block, Jens Axboe

On Wed, Apr 22, 2020 at 04:06:11PM +0300, Andy Shevchenko wrote:
> There is a specific API to treat raw data as GUID, i.e. export_guid()
> and import_guid(). Use them instead of guid_copy() with explicit casting.

Any comment on this?

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/lightnvm/pblk-core.c     | 5 ++---
>  drivers/lightnvm/pblk-recovery.c | 3 +--
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
> index b413bafe93fdd..6d4523dbf2dbb 100644
> --- a/drivers/lightnvm/pblk-core.c
> +++ b/drivers/lightnvm/pblk-core.c
> @@ -988,7 +988,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);
> -	guid_copy((guid_t *)&smeta_buf->header.uuid, &pblk->instance_uuid);
> +	export_guid(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;
> @@ -1803,8 +1803,7 @@ 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);
> -		guid_copy((guid_t *)&emeta_buf->header.uuid,
> -							&pblk->instance_uuid);
> +		export_guid(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-recovery.c b/drivers/lightnvm/pblk-recovery.c
> index 299ef47a17b22..0e6f0c76e9302 100644
> --- a/drivers/lightnvm/pblk-recovery.c
> +++ b/drivers/lightnvm/pblk-recovery.c
> @@ -706,8 +706,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
>  
>  		/* The first valid instance uuid is used for initialization */
>  		if (!valid_uuid) {
> -			guid_copy(&pblk->instance_uuid,
> -				  (guid_t *)&smeta_buf->header.uuid);
> +			import_guid(&pblk->instance_uuid, smeta_buf->header.uuid);
>  			valid_uuid = 1;
>  		}
>  
> -- 
> 2.26.1
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
@ 2020-04-22 13:06 Andy Shevchenko
  2020-06-18 10:57 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-04-22 13:06 UTC (permalink / raw)
  To: Matias Bjorling, linux-block, Jens Axboe; +Cc: Andy Shevchenko

There is a specific API to treat raw data as GUID, i.e. export_guid()
and import_guid(). Use them instead of guid_copy() with explicit casting.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/lightnvm/pblk-core.c     | 5 ++---
 drivers/lightnvm/pblk-recovery.c | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index b413bafe93fdd..6d4523dbf2dbb 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -988,7 +988,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);
-	guid_copy((guid_t *)&smeta_buf->header.uuid, &pblk->instance_uuid);
+	export_guid(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;
@@ -1803,8 +1803,7 @@ 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);
-		guid_copy((guid_t *)&emeta_buf->header.uuid,
-							&pblk->instance_uuid);
+		export_guid(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-recovery.c b/drivers/lightnvm/pblk-recovery.c
index 299ef47a17b22..0e6f0c76e9302 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -706,8 +706,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
 
 		/* The first valid instance uuid is used for initialization */
 		if (!valid_uuid) {
-			guid_copy(&pblk->instance_uuid,
-				  (guid_t *)&smeta_buf->header.uuid);
+			import_guid(&pblk->instance_uuid, smeta_buf->header.uuid);
 			valid_uuid = 1;
 		}
 
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-14 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 16:42 [PATCH v1] lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid() Andy Shevchenko
2021-02-14 10:32 ` Matias Bjørling
  -- strict thread matches above, loose matches on Subject: below --
2020-04-22 13:06 Andy Shevchenko
2020-06-18 10:57 ` Andy Shevchenko
2020-06-18 11:14   ` Matias Bjørling
2020-06-18 15:17     ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.