Staging: lustre: Removal of Unnecessary white spaces
PATCH 1/2 Staging: lustre: Removal of Unnecessary white spaces
This fixes the following checkpatch.pl warning in lustre/ldlm/ldlm_extent.c
WARNING: unnecessary whitespace before a quoted newline
--- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +1 -1
@@ -153,7 +153,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)LASSERT (mode !=0 );LASSERT (IS_PO2 (mode)); -for (index =-1 ; mode; index++, mode >>=1 ) ; +for (index =-1 ; mode; index++, mode >>=1 );LASSERT (index <LCK_MODE_NUM );return index; }
Signature · 1 line
1.7.9.5
Quoted 3 lines · Monam Agarwal
This fixes the following checkpatch.pl warning in
lustre/ldlm/ldlm_extent.c
WARNING: unnecessary whitespace before a quoted newline
I rather doubt this was the checkpatch message here. Please make sure your commit message and subject match.
[]
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
Quoted 1 line
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +0
-0
[]
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c static inline int lock_mode_to_index(ldlm_mode_t mode) · line 156
Quoted 6 lines
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +1
-1@@ -153,7 +153,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)LASSERT (mode !=0 );LASSERT (IS_PO2 (mode)); -for (index =-1 ; mode; index++, mode >>=1 ) ; +for (index =-1 ; mode; index++, mode >>=1 );
Try using fls instead of this.
PATCH v2 1/1 Staging: lustre: Use of fls to find last set bit
In reply to Monam AgarwalThis introduces fls in lustre/ldlm/ldlm_extent.c
to find the last set bit.
It also fixes the following checkpatch.pl warning in lustre/ldlm/ldlm_extent.c
WARNING: space prohibited before semicolon.
The patch also fixes the following checkpatch.pl error in lustre/ldlm/ldlm_extent.c
ERROR: trailing statements should be on next line
---
Changes since v1:
*Incorrect commit message
*Use of fls function
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +3 -1
@@ -150,10 +150,12 @@ struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l)static inline int lock_mode_to_index (ldlm_mode_t mode) {int index; +int len;LASSERT (mode !=0 );LASSERT (IS_PO2 (mode)); -for (index =-1 ; mode; index++, mode >>=1 ) ; + len =fls (mode); + index = len-1 ;LASSERT (index <LCK_MODE_NUM );return index; }
Signature · 1 line
1.7.9.5
Re: [PATCH v2] Staging: lustre: Use of fls to find last set bit
Quoted 2 lines · Monam Agarwal
This introduces fls in
lustre/ldlm/ldlm_extent.c
to find the last set bit.
[]
Quoted 5 lines
Signed-off-by Monam Agarwal <[email protected]>---
Changes since v1:
*Incorrect commit message
*Use of fls function
[]
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
Quoted 1 line
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +0
-0
[]
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l) · line 158
Quoted 11 lines
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +3
-1@@ -150,10 +150,12 @@ struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l)static inline int lock_mode_to_index (ldlm_mode_t mode) {int index; +int len;LASSERT (mode !=0 );LASSERT (IS_PO2 (mode)); -for (index =-1 ; mode; index++, mode >>=1 ) ; + len =fls (mode); + index = len-1 ;
There's no need for len at all.
index = fls(mode) - 1;
would be fine.
PATCH v3 1/1 Staging: lustre: Use of fls to find last set bit
In reply to Monam AgarwalThis introduces fls in lustre/ldlm/ldlm_extent.c
to find the last set bit.
---
Changes since v1:
* Incorrect commit message
* Use of fls function
Changes since v2:
* Removal of extra variable
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +1 -1
@@ -153,7 +153,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)LASSERT (mode !=0 );LASSERT (IS_PO2 (mode)); -for (index =-1 ; mode; index++, mode >>=1 ) ; + index =fls (mode)-1 ;LASSERT (index <LCK_MODE_NUM );return index; }
Signature · 1 line
1.7.9.5
Re: [PATCH v3] Staging: lustre: Use of fls to find last set bit
Quoted 19 lines · Monam Agarwal
This introduces fls in
lustre/ldlm/ldlm_extent.c
to find the last set bit.Signed-off-by Monam Agarwal <[email protected]>---
Changes since v1:
* Incorrect commit message
* Use of fls function
Changes since v2:
* Removal of extra variabledrivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +0
-0
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c static inline int lock_mode_to_index(ldlm_mode_t mode) · line 156
Quoted 5 lines
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +1
-1@@ -153,7 +153,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)LASSERT (mode !=0 );LASSERT (IS_PO2 (mode)); -for (index =-1 ; mode; index++, mode >>=1 ) ; + index =fls (mode)-1 ;
Put spaces around math operations. Just cut and paste what Joe wrote.
regards,
dan carpenter