lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
PATCH 1/1 lightnvm: pblk: Replace guid_copy() with export_guid()/import_guid()
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.
--- drivers/lightnvm/pblk-core.c | 5 ++--- drivers/lightnvm/pblk-recovery.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/lightnvm/pblk-core.c +2 -3
@@ -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 ;
drivers/lightnvm/pblk-recovery.c +1 -2
@@ -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 ; }
Signature · 1 line
2.26.1
Quoted 2 lines · Andy Shevchenko
There is a specific API to treat raw data as GUID, i.e.
export_guid()andimport_guid(). Use them instead ofguid_copy()with explicit casting.
Any comment on this?
Quoted 46 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/lightnvm/pblk-core.c | 5 ++--- drivers/lightnvm/pblk-recovery.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-)drivers/lightnvm/pblk-core.c +2
-3@@ -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 ;drivers/lightnvm/pblk-recovery.c +1
-2@@ -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 ; }Signature · 1 line
2.26.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 48 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
There is a specific API to treat raw data as GUID, i.e.
export_guid()andimport_guid(). Use them instead ofguid_copy()with explicit casting.Any comment on this?
Quoted 43 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/lightnvm/pblk-core.c | 5 ++--- drivers/lightnvm/pblk-recovery.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-)drivers/lightnvm/pblk-core.c +2
-3@@ -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 ;drivers/lightnvm/pblk-recovery.c +1
-2@@ -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 ; }
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
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
Javier González
Reviewed-byQuoted 5 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
There is a specific API to treat raw data as GUID, i.e.
export_guid()andimport_guid(). Use them instead ofguid_copy()with explicit casting.Any comment on this?
Looks good to me Andy. Thanks!
Jens Axboe
maintainerQuoted 49 lines · Matias Bjørling
Quoted 48 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
There is a specific API to treat raw data as GUID, i.e.
export_guid()andimport_guid(). Use them instead ofguid_copy()with explicit casting.Any comment on this?
Quoted 43 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/lightnvm/pblk-core.c | 5 ++--- drivers/lightnvm/pblk-recovery.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-)drivers/lightnvm/pblk-core.c +2
-3@@ -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 ;drivers/lightnvm/pblk-recovery.c +1
-2@@ -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 ; }
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.26.1Andy, 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.
Signature · 1 line
Jens Axboe