: Switch to use new generic UUID API
PATCH 1/1 : Switch to use new generic UUID API
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.
--- drivers/lightnvm/pblk.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/lightnvm/pblk.h +1 -4
@@ -1362,10 +1362,7 @@ static inline unsigned int pblk_get_secs(struct bio *bio)static inline void pblk_setup_uuid (struct pblk *pblk) { -uuid_le uuid; - -uuid_le_gen (&uuid); -memcpy (pblk->instance_uuid, uuid.b,16 ); +guid_gen ((guid_t *)&pblk->instance_uuid); }static inline char *pblk_disk_name (struct pblk *pblk)
Signature · 1 line
2.20.1
Quoted 4 lines · 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.
This seems to miss a "lightnvm" in the subject line.
drivers/lightnvm/pblk.h static inline unsigned int pblk_get_secs(struct bio *bio) · line 1366
Quoted 4 lines
static inline void
pblk_setup_uuid(struct pblk *pblk){drivers/lightnvm/pblk.h +1
-0+guid_gen ((guid_t *)&pblk->instance_uuid); }
I think we can just kill this wrapper.
But more importantly the instance_uuid fied, and the header.uuid one it is copied from should be turned into an actual guid_t, the memcpys and memcmps should also be replaced with the proper UUID API.
Quoted 15 lines · Christoph Hellwig
Quoted 4 lines · 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.
This seems to miss a "lightnvm" in the subject line.
drivers/lightnvm/pblk.h static inline unsigned int pblk_get_secs(struct bio *bio) · line 1366
Quoted 4 lines
static inline void
pblk_setup_uuid(struct pblk *pblk){drivers/lightnvm/pblk.h +1
-0+guid_gen ((guid_t *)&pblk->instance_uuid); }I think we can just kill this wrapper.
Quoted 3 lines
But more importantly the
instance_uuidfied, and the header.uuid one it is copied from should be turned into an actualguid_t, the memcpys and memcmps should also be replaced with the proper UUID API.
header.uuid is defined using __u8 type, I'm not sure we can use guid_t there.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 19 lines · Andy Shevchenko
Quoted 15 lines · Christoph Hellwig
Quoted 4 lines · 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.
This seems to miss a "lightnvm" in the subject line.
Quoted 4 lines
static inline void
pblk_setup_uuid(struct pblk *pblk){drivers/lightnvm/pblk.h +1
-0+guid_gen ((guid_t *)&pblk->instance_uuid);}
I think we can just kill this wrapper.
Quoted 6 lines
Quoted 3 lines
But more importantly the
instance_uuidfied, and the header.uuid one it is copied from should be turned into an actualguid_t, the memcpys and memcmps should also be replaced with the proper UUID API.header.uuid is defined using
__u8type, I'm not sure we can useguid_tthere.
We can turn it into a guid_t and bump the minor version.
Javier
Quoted 17 lines · Javier González
Quoted 17 lines · Andy Shevchenko
Quoted 15 lines · Christoph Hellwig
Quoted 4 lines · 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.
This seems to miss a "lightnvm" in the subject line.
Quoted 4 lines
static inline void
pblk_setup_uuid(struct pblk *pblk){
+guid_gen((guid_t *)&pblk->instance_uuid);
}I think we can just kill this wrapper.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
But more importantly the
instance_uuidfied, and the header.uuid one it is copied from should be turned into an actualguid_t, the memcpys and memcmps should also be replaced with the proper UUID API.header.uuid is defined using
__u8type, I'm not sure we can useguid_tthere.We can turn it into a
guid_tand bump the minor version.
It's not so easy. __uXX types are dedicated for external APIs. guid_t is kernel internal type disregard of (still) presence some uapi bits. So, the question is those __uXX types in the driver definition is a simple mistake, (weird) style decision, or what?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 25 lines · Andy Shevchenko
Quoted 21 lines · Javier González
Quoted 21 lines · Andy Shevchenko
Quoted 18 lines · Christoph Hellwig
Quoted 4 lines · 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.
This seems to miss a "lightnvm" in the subject line.
Quoted 4 lines
static inline void
pblk_setup_uuid(struct pblk *pblk){
+guid_gen((guid_t *)&pblk->instance_uuid);
}I think we can just kill this wrapper.
But more importantly the
instance_uuidfied, and the header.uuid one it is copied from should be turned into an actualguid_t, the memcpys and memcmps should also be replaced with the proper UUID API.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
header.uuid is defined using
__u8type, I'm not sure we can useguid_tthere.We can turn it into a
guid_tand bump the minor version.It's not so easy.
__uXXtypes are dedicated for external APIs.guid_tis kernel internal type disregard of (still) presence some uapi bits. So, the question is those__uXXtypes in the driver definition is a simple mistake, (weird) style decision, or what?
I would define it as a mistake and I think it is worth fixing it. At the moment we are only using this uuid for recovery purposes, to discard data from a different pblk instance, so there should not be a big impact outside of pblk itself. Am I missing something?
Javier
Quoted 14 lines · Javier González
Quoted 13 lines · Andy Shevchenko
Quoted 5 lines · Javier González
Quoted 3 lines · Andy Shevchenko
header.uuid is defined using
__u8type, I'm not sure we can useguid_tthere.We can turn it into a
guid_tand bump the minor version.It's not so easy.
__uXXtypes are dedicated for external APIs.guid_tis kernel internal type disregard of (still) presence some uapi bits. So, the question is those__uXXtypes in the driver definition is a simple mistake, (weird) style decision, or what?
Quoted 3 lines
I would define it as a mistake and I think it is worth fixing it. At the moment we are only using this uuid for recovery purposes, to discard data from a different pblk instance,
Does this come from outside of the kernel in any mean (user space, data from device, etc)?
It sounds to me like it does. In this case there is no mistake and we may not use guid_t there.
Quoted 2 lines
so there should not be a big impact
outside of pblk itself. Am I missing something?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 17 lines · Andy Shevchenko
Quoted 13 lines · Javier González
Quoted 12 lines · Andy Shevchenko
Quoted 5 lines · Javier González
Quoted 3 lines · Andy Shevchenko
header.uuid is defined using
__u8type, I'm not sure we can useguid_tthere.We can turn it into a
guid_tand bump the minor version.It's not so easy.
__uXXtypes are dedicated for external APIs.guid_tis kernel internal type disregard of (still) presence some uapi bits. So, the question is those__uXXtypes in the driver definition is a simple mistake, (weird) style decision, or what?
Quoted 8 lines
Quoted 3 lines
I would define it as a mistake and I think it is worth fixing it. At the moment we are only using this uuid for recovery purposes, to discard data from a different pblk instance,
Does this come from outside of the kernel in any mean (user space, data from device, etc)?
It sounds to me like it does. In this case there is no mistake and we may not useguid_tthere.
pblk manages the metadata layout without involvement of the device or user space, so no, no dependency at this moment.
It is not pushed anywhere yet, but I have been working on a tool to make a pblk recovery tool to enable FTL repairs if something fails in the kernel recovery path. Here, I use this uuid to identify the instance - is there a way to reconcile guid_t with user space, which currently uses the __u8?
Javier
Quoted 5 lines · Javier González
It is not pushed anywhere yet, but I have been working on a tool to make a pblk recovery tool to enable FTL repairs if something fails in the kernel recovery path. Here, I use this uuid to identify the instance - is there a way to reconcile
guid_twith user space, which currently uses the__u8?
For Linux there is util-linux which contains libuuid. There is uuid_t type. Unfortunately there is no so called LE (little endian) variant. Perhaps someone would need to extend the support for that.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
Quoted 5 lines · Javier González
It is not pushed anywhere yet, but I have been working on a tool to make a pblk recovery tool to enable FTL repairs if something fails in the kernel recovery path. Here, I use this uuid to identify the instance - is there a way to reconcile
guid_twith user space, which currently uses the__u8?
Quoted 3 lines
For Linux there is util-linux which contains libuuid. There is
uuid_ttype. Unfortunately there is no so called LE (little endian) variant. Perhaps someone would need to extend the support for that.
Ok. I can look into that when releasing pblk-tools. But for now, I am OK with applying with the changes Christoph suggested and aligning with guid_t if you also think helps maintaining common helpers.
Javier