* [PATCH 1/2] Staging: lustre: Removal of Unnecessary white spaces
@ 2014-01-11 11:41 Monam Agarwal
2014-01-11 17:23 ` Joe Perches
2014-01-11 19:32 ` [PATCH v2] Staging: lustre: Use of fls to find last set bit Monam Agarwal
0 siblings, 2 replies; 6+ messages in thread
From: Monam Agarwal @ 2014-01-11 11:41 UTC (permalink / raw)
To: gregkh, monamagarwal123, andreas.dilger, peter.p.waskiewicz.jr,
tao.peng, devel, linux-kernel
This fixes the following checkpatch.pl warning in
lustre/ldlm/ldlm_extent.c
WARNING: unnecessary whitespace before a quoted newline
Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
---
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index ac5d66a..374d6e4 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -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;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Staging: lustre: Removal of Unnecessary white spaces
2014-01-11 11:41 [PATCH 1/2] Staging: lustre: Removal of Unnecessary white spaces Monam Agarwal
@ 2014-01-11 17:23 ` Joe Perches
2014-01-11 19:32 ` [PATCH v2] Staging: lustre: Use of fls to find last set bit Monam Agarwal
1 sibling, 0 replies; 6+ messages in thread
From: Joe Perches @ 2014-01-11 17:23 UTC (permalink / raw)
To: Monam Agarwal
Cc: gregkh, andreas.dilger, peter.p.waskiewicz.jr, tao.peng, devel,
linux-kernel
On Sat, 2014-01-11 at 17:11 +0530, Monam Agarwal wrote:
> 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.
[]
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
[]
> @@ -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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] Staging: lustre: Use of fls to find last set bit
2014-01-11 11:41 [PATCH 1/2] Staging: lustre: Removal of Unnecessary white spaces Monam Agarwal
2014-01-11 17:23 ` Joe Perches
@ 2014-01-11 19:32 ` Monam Agarwal
2014-01-11 20:02 ` Joe Perches
2014-01-11 20:15 ` [PATCH v3] " Monam Agarwal
1 sibling, 2 replies; 6+ messages in thread
From: Monam Agarwal @ 2014-01-11 19:32 UTC (permalink / raw)
To: gregkh, monamagarwal123, andreas.dilger, peter.p.waskiewicz.jr,
tao.peng, devel, linux-kernel
This 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
Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
---
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(-)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index ac5d66a..e6fe2cb 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -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;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Staging: lustre: Use of fls to find last set bit
2014-01-11 19:32 ` [PATCH v2] Staging: lustre: Use of fls to find last set bit Monam Agarwal
@ 2014-01-11 20:02 ` Joe Perches
2014-01-11 20:15 ` [PATCH v3] " Monam Agarwal
1 sibling, 0 replies; 6+ messages in thread
From: Joe Perches @ 2014-01-11 20:02 UTC (permalink / raw)
To: Monam Agarwal
Cc: gregkh, andreas.dilger, peter.p.waskiewicz.jr, tao.peng, devel,
linux-kernel
On Sun, 2014-01-12 at 01:02 +0530, Monam Agarwal wrote:
> This introduces fls in lustre/ldlm/ldlm_extent.c
> to find the last set bit.
[]
> Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
> ---
> Changes since v1:
> *Incorrect commit message
> *Use of fls function
[]
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
[]
> @@ -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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3] Staging: lustre: Use of fls to find last set bit
2014-01-11 19:32 ` [PATCH v2] Staging: lustre: Use of fls to find last set bit Monam Agarwal
2014-01-11 20:02 ` Joe Perches
@ 2014-01-11 20:15 ` Monam Agarwal
2014-01-13 8:21 ` Dan Carpenter
1 sibling, 1 reply; 6+ messages in thread
From: Monam Agarwal @ 2014-01-11 20:15 UTC (permalink / raw)
To: gregkh, monamagarwal123, andreas.dilger, peter.p.waskiewicz.jr,
tao.peng, devel, linux-kernel
This introduces fls in lustre/ldlm/ldlm_extent.c
to find the last set bit.
Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
---
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(-)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index ac5d66a..a4f382d 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -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;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3] Staging: lustre: Use of fls to find last set bit
2014-01-11 20:15 ` [PATCH v3] " Monam Agarwal
@ 2014-01-13 8:21 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2014-01-13 8:21 UTC (permalink / raw)
To: Monam Agarwal
Cc: gregkh, andreas.dilger, peter.p.waskiewicz.jr, tao.peng, devel,
linux-kernel
On Sun, Jan 12, 2014 at 01:45:51AM +0530, Monam Agarwal wrote:
> This introduces fls in lustre/ldlm/ldlm_extent.c
> to find the last set bit.
>
> Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
> index ac5d66a..a4f382d 100644
> --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
> +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
> @@ -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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-13 8:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-11 11:41 [PATCH 1/2] Staging: lustre: Removal of Unnecessary white spaces Monam Agarwal
2014-01-11 17:23 ` Joe Perches
2014-01-11 19:32 ` [PATCH v2] Staging: lustre: Use of fls to find last set bit Monam Agarwal
2014-01-11 20:02 ` Joe Perches
2014-01-11 20:15 ` [PATCH v3] " Monam Agarwal
2014-01-13 8:21 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox