Remove sparse warnings in mdc_request.c
A message that is not in the archive (sent off-list or not yet received): [email protected]
Dilger
PATCH 1/1 Remove sparse warnings in mdc_request.c
Quoted 4 lines · Skanda Guruanand
I have tried to fix the endian issues in the
mdc_request.cin the lustre file system drivers in the staging area. Your feedback is welcome.
Sorry, but this patch is totally wrong. This would break the handling of this structure on big-endian systems.
The right fix would be to change the declaration of ldp_hash_start and ldp_hash_end from __u64 to __le64, along with ldp_flags and ldp_pad0 (though it should be unused).
Cheers, Andreas
Quoted 48 lines
CHECK
drivers/staging/lustre/lustre/mdc/mdc_request.cdrivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted__le32drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted__le64---
drivers/staging/lustre/lustre/mdc/mdc_request.c| 20 ++++++++++----------1 file changed, 10 insertions(+), 10 deletions(-)drivers/staging/lustre/lustre/mdc/mdc_request.c +4
-4@@ -955,12 +955,12 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash,if (PageUptodate (page)) { dp =kmap (page);if (BITS_PER_LONG ==32 && hash64) { - *start =le64_to_cpu (dp->ldp_hash_start) >>32 ; - *end =le64_to_cpu (dp->ldp_hash_end) >>32 ; + *start = dp->ldp_hash_start >>32 ; + *end = dp->ldp_hash_end >>32 ; *hash = *hash >>32 ; }else { - *start =le64_to_cpu (dp->ldp_hash_start); - *end =le64_to_cpu (dp->ldp_hash_end); + *start = dp->ldp_hash_start; + *end = dp->ldp_hash_end; }if (unlikely (*start ==1 && *hash ==0 )) *hash = *start;
drivers/staging/lustre/lustre/mdc/mdc_request.c static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash, · line 985
Quoted 5 lines
drivers/staging/lustre/lustre/mdc/mdc_request.c +1
-1@@ -982,7 +982,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash,*/ kunmap (page);mdc_release_page (page, -le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); + dp->ldp_flags &LDF_COLLIDE );
Note that it would also be acceptable to use "cpu_to_le32(LDF_COLLIDE)" here, since swabbing a constant is a compile-time operation, while swabbing a variable adds runtime overhead on big-endian systems.
Quoted 26 lines
drivers/staging/lustre/lustre/mdc/mdc_request.c +1
-1page =NULL ; } }else {@@ -1190,7 +1190,7 @@ static int mdc_read_page_remote(void *data, struct page *page0)SetPageUptodate (page); dp =kmap (page); - hash =le64_to_cpu (dp->ldp_hash_start); + hash = dp->ldp_hash_start;kunmap (page); offset =hash_x_index (hash, rp->rp_hash64);@@ -1325,12 +1325,12 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data,
hash_collision:dp = page_address(page); if (BITS_PER_LONG == 32 && rp_param.rp_hash64) {drivers/staging/lustre/lustre/mdc/mdc_request.c +2
-2- start =le64_to_cpu (dp->ldp_hash_start) >>32 ; - end =le64_to_cpu (dp->ldp_hash_end) >>32 ; + start = dp->ldp_hash_start >>32 ; + end = dp->ldp_hash_end >>32 ;rp_param.rp_off = hash_offset >> 32; } else {drivers/staging/lustre/lustre/mdc/mdc_request.c +2
-2- start =le64_to_cpu (dp->ldp_hash_start); - end =le64_to_cpu (dp->ldp_hash_end); + start = dp->ldp_hash_start; + end = dp->ldp_hash_end;
Quoted 6 lines
rp_param.rp_off = hash_offset; } if (end == start) {Signature · 1 line
1.9.1
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Remove sparse warnings in mdc_request.c
Quoted 5 lines · skanda.kashyap at gmail.com
From: Skanda Guruanand <[email protected]>
--- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- Your patch does not have a Signed-off-by: line. Please read the kernel file, Documentation/SubmittingPatches and resend it after adding that line. Note, the line needs to be in the body of the email, before the patch, not at the bottom of the patch or in the email signature.
- Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause.
- You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change.
- You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 Remove sparse warnings in mdc_request.c
Quoted 28 lines · skanda.kashyap at gmail.com
From: Skanda Guruanand <[email protected]>
Signed-off-by Skanda Guruanand <[email protected]>I have modified struct
lu_dirpageas suggested inlustre_idl.hfileCHECK
drivers/staging/lustre/lustre/mdc/mdc_request.cdrivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted__le32drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted__le64
Quoted 3 lines
--- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
What changed from v1?
Always put that here below the --- line.
v3?
thanks,
greg k-h
PATCH v2 1/1 Remove sparse warnings in mdc_request.c
In reply to a message not in the archiveQuoted 3 lines · skanda.kashyap at gmail.com
From: Skanda Guruanand <[email protected]>
Signed-off-by Skanda Guruanand <[email protected]>
Changelog text goes between those two lines, right?
Quoted 2 lines
I have modified struct
lu_dirpageas suggested inlustre_idl.hfile
Why the extra ' '?
Quoted 4 lines
CHECK
drivers/staging/lustre/lustre/mdc/mdc_request.cdrivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted__le64
Why is this all wrapped?
Quoted 29 lines
drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted__le32drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted__le64--- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +0
-0@@ -846,10 +846,10 @@ struct luda_type {#endif
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h struct luda_type { · line 852
Quoted 10 lines
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +4
-4struct lu_dirpage { -__u64 ldp_hash_start; -__u64 ldp_hash_end; -__u32 ldp_flags; -__u32 ldp_pad0; +__le64 ldp_hash_start; +__le64 ldp_hash_end; +__le32 ldp_flags; +__le32 ldp_pad0;
Are you sure this is correct? How was it tested?
Also, please fix your subject to properly match those already made for this driver...
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 Fix endianness issues in mdc_request.c
Quoted 3 lines · skanda.kashyap at gmail.com
From: Skanda Guruanand <[email protected]>
Signed-off-by Skanda Guruanand <[email protected]>
I can't take patches with no changelog text at all, sorry.
Please fix up and resend.
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 Fix endianness issues in mdc_request.c
Quoted 1 line · skanda.kashyap at gmail.com
From: Skanda Guruanand <[email protected]>
Your subject is odd, please match other commits made for this driver when you resend it.
Quoted 2 lines
Sparse generates warnings where cast to restricted types are made. This commit changes types of struct fields to match endianness.
Why do you have info below --- that should be up here?
Quoted 32 lines
Signed-off-by Skanda Guruanand <[email protected]>---
I have modified structlu_dirpageinlustre_idl.hfile to remove the sparse warnings where cast to restricted types are made.Following warnings were removed by this fix.
drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted__le32drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted__le64I have not got a chance to test it as I don't have a big endian system. I feel the change is reasonably correct as the elements of the structure
lu_dirpageare always converted from little-endian format to processor's native format.drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +0
-0@@ -846,10 +846,10 @@ struct luda_type {#endif
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h struct luda_type { · line 852
Quoted 10 lines
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +4
-4struct lu_dirpage { -__u64 ldp_hash_start; -__u64 ldp_hash_end; -__u32 ldp_flags; -__u32 ldp_pad0; +__le64 ldp_hash_start; +__le64 ldp_hash_end; +__le32 ldp_flags; +__le32 ldp_pad0;
I need a bit more confidence that this is the correct change before I can take it. What can you do to provide that?
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 staging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32
Quoted 18 lines · skanda.kashyap at gmail.com
From: Skanda Guruanand <[email protected]>
Modified struct
lu_dirpageinlustre_idl.hfile to remove the sparse warnings where cast to restricted types are made.Following warnings are removed by this fix.
drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted__le32drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted__le64
Quoted 5 lines
Signed-off-by Skanda Guruanand <[email protected]>---
Isn't the below reason good enough?
Since the structure elements are always converted from little endian to processor native format inmdc_request.c, structlu_dirpageelement types is modified.
Why isn't this above in the changelog text?
And I need an ack from a lustre maintainer before I can take this...
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
Dilger
PATCH v2 1/1 staging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32
Quoted 20 lines · skanda.kashyap at gmail.com
From: Skanda Guruanand <[email protected]>
The struct
lu_dirpageelements inlustre_idl.hfile are modified to__le64and__le32types since the elements are always converted from litte endian to processor native format inmdc_request.cfile.Following warnings are removed by this fix.
drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted__le32drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted__le64drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted__le64
Quoted 1 line
Signed-off-by Skanda Guruanand <[email protected]>
Thanks for the patch.
The resend of this patch should really have been marked "[PATCH v3]", but hopefully Greg will still notice this one.
Quoted 26 lines
---
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +4
-4@@ -846,10 +846,10 @@ struct luda_type {#endif struct lu_dirpage { -__u64 ldp_hash_start; -__u64 ldp_hash_end; -__u32 ldp_flags; -__u32 ldp_pad0; +__le64 ldp_hash_start; +__le64 ldp_hash_end; +__le32 ldp_flags; +__le32 ldp_pad0;struct lu_dirent ldp_entries[0 ]; };Signature · 1 line
1.9.1
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation