public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [XFS] indent an if statement
@ 2014-05-21 12:27 Dan Carpenter
  2014-05-21 12:44 ` Eric Sandeen
  2014-05-21 14:29 ` Christoph Hellwig
  0 siblings, 2 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-05-21 12:27 UTC (permalink / raw)
  To: Dave Chinner; +Cc: kernel-janitors, xfs

The "n += 32;" goes with the if statement on the line before so it
should be indented.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
index f1e3c90..f685942 100644
--- a/fs/xfs/xfs_bit.h
+++ b/fs/xfs/xfs_bit.h
@@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
 		if (w && (n = ffs(w)))
-		n += 32;
+			n += 32;
 	}
 	return n - 1;
 }

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [patch] [XFS] indent an if statement
  2014-05-21 12:27 [patch] [XFS] indent an if statement Dan Carpenter
@ 2014-05-21 12:44 ` Eric Sandeen
  2014-05-21 14:29 ` Christoph Hellwig
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2014-05-21 12:44 UTC (permalink / raw)
  To: Dan Carpenter, Dave Chinner; +Cc: kernel-janitors, xfs

On 5/21/14, 7:27 AM, Dan Carpenter wrote:
> The "n += 32;" goes with the if statement on the line before so it
> should be indented.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Easy one ;)

Wow, it's been this way ever since 79071eb0 in 2008.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
> index f1e3c90..f685942 100644
> --- a/fs/xfs/xfs_bit.h
> +++ b/fs/xfs/xfs_bit.h
> @@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
>  	} else {	/* upper bits */
>  		w = (__uint32_t)(v >> 32);
>  		if (w && (n = ffs(w)))
> -		n += 32;
> +			n += 32;
>  	}
>  	return n - 1;
>  }
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] [XFS] indent an if statement
  2014-05-21 12:27 [patch] [XFS] indent an if statement Dan Carpenter
  2014-05-21 12:44 ` Eric Sandeen
@ 2014-05-21 14:29 ` Christoph Hellwig
  2014-05-21 14:35   ` Dan Carpenter
  2014-05-22 14:04   ` [patch v2] [XFS] small cleanup in xfs_lowbit64() Dan Carpenter
  1 sibling, 2 replies; 8+ messages in thread
From: Christoph Hellwig @ 2014-05-21 14:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, xfs

On Wed, May 21, 2014 at 03:27:46PM +0300, Dan Carpenter wrote:
> The "n += 32;" goes with the if statement on the line before so it
> should be indented.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
> index f1e3c90..f685942 100644
> --- a/fs/xfs/xfs_bit.h
> +++ b/fs/xfs/xfs_bit.h
> @@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
>  	} else {	/* upper bits */
>  		w = (__uint32_t)(v >> 32);
>  		if (w && (n = ffs(w)))
> -		n += 32;
> +			n += 32;

If we want to clean up this stuff let's do it properly:

		if (w) {
			n = ffs(w);
			if (n)
				n += 32;
		}

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] [XFS] indent an if statement
  2014-05-21 14:29 ` Christoph Hellwig
@ 2014-05-21 14:35   ` Dan Carpenter
  2014-05-21 16:50     ` walter harms
  2014-05-22 14:04   ` [patch v2] [XFS] small cleanup in xfs_lowbit64() Dan Carpenter
  1 sibling, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2014-05-21 14:35 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kernel-janitors, xfs

On Wed, May 21, 2014 at 07:29:09AM -0700, Christoph Hellwig wrote:
> On Wed, May 21, 2014 at 03:27:46PM +0300, Dan Carpenter wrote:
> > The "n += 32;" goes with the if statement on the line before so it
> > should be indented.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
> > index f1e3c90..f685942 100644
> > --- a/fs/xfs/xfs_bit.h
> > +++ b/fs/xfs/xfs_bit.h
> > @@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
> >  	} else {	/* upper bits */
> >  		w = (__uint32_t)(v >> 32);
> >  		if (w && (n = ffs(w)))
> > -		n += 32;
> > +			n += 32;
> 
> If we want to clean up this stuff let's do it properly:
> 
> 		if (w) {
> 			n = ffs(w);
> 			if (n)
> 				n += 32;
> 		}
>

Sure.  I will resend.

regards,
dan carpenter


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] [XFS] indent an if statement
  2014-05-21 14:35   ` Dan Carpenter
@ 2014-05-21 16:50     ` walter harms
  2014-05-22 10:01       ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: walter harms @ 2014-05-21 16:50 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Christoph Hellwig, kernel-janitors, xfs



Am 21.05.2014 16:35, schrieb Dan Carpenter:
> On Wed, May 21, 2014 at 07:29:09AM -0700, Christoph Hellwig wrote:
>> On Wed, May 21, 2014 at 03:27:46PM +0300, Dan Carpenter wrote:
>>> The "n += 32;" goes with the if statement on the line before so it
>>> should be indented.
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>
>>> diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
>>> index f1e3c90..f685942 100644
>>> --- a/fs/xfs/xfs_bit.h
>>> +++ b/fs/xfs/xfs_bit.h
>>> @@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
>>>  	} else {	/* upper bits */
>>>  		w = (__uint32_t)(v >> 32);
>>>  		if (w && (n = ffs(w)))
>>> -		n += 32;
>>> +			n += 32;
>>
>> If we want to clean up this stuff let's do it properly:
>>
>> 		if (w) {
>> 			n = ffs(w);
>> 			if (n)
>> 				n += 32;
>> 		}
>>
> 


This looks like a ffsll() maybe there are other implemantions and we can
make a generic version (acualy i found only a ffsll() in nouvou, NTL).

just my 2 cents,

re,
 wh


> Sure.  I will resend.
> 
> regards,
> dan carpenter
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] [XFS] indent an if statement
  2014-05-21 16:50     ` walter harms
@ 2014-05-22 10:01       ` Christoph Hellwig
  2014-05-22 13:31         ` Mark Tinguely
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2014-05-22 10:01 UTC (permalink / raw)
  To: walter harms; +Cc: Christoph Hellwig, kernel-janitors, Dan Carpenter, xfs

On Wed, May 21, 2014 at 06:50:53PM +0200, walter harms wrote:
> This looks like a ffsll() maybe there are other implemantions and we can
> make a generic version (acualy i found only a ffsll() in nouvou, NTL).

All the helper in xfs_bit.[ch] are probably candidates for generic
library functions.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] [XFS] indent an if statement
  2014-05-22 10:01       ` Christoph Hellwig
@ 2014-05-22 13:31         ` Mark Tinguely
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Tinguely @ 2014-05-22 13:31 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs, kernel-janitors, Dan Carpenter, walter harms

On 05/22/14 05:01, Christoph Hellwig wrote:
> On Wed, May 21, 2014 at 06:50:53PM +0200, walter harms wrote:
>> This looks like a ffsll() maybe there are other implemantions and we can
>> make a generic version (acualy i found only a ffsll() in nouvou, NTL).
>
> All the helper in xfs_bit.[ch] are probably candidates for generic
> library functions.


Discussed in the thread:

  http://oss.sgi.com/archives/xfs/2014-01/msg00542.html

--Mark.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch v2] [XFS] small cleanup in xfs_lowbit64()
  2014-05-21 14:29 ` Christoph Hellwig
  2014-05-21 14:35   ` Dan Carpenter
@ 2014-05-22 14:04   ` Dan Carpenter
  1 sibling, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-05-22 14:04 UTC (permalink / raw)
  To: Dave Chinner; +Cc: kernel-janitors, xfs

There are two checkpatch.pl complaints here because of the bad indenting
and because of the assignment inside the condition.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: more cleanups

diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
index f1e3c90..e1649c0 100644
--- a/fs/xfs/xfs_bit.h
+++ b/fs/xfs/xfs_bit.h
@@ -66,8 +66,11 @@ static inline int xfs_lowbit64(__uint64_t v)
 		n = ffs(w);
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
-		if (w && (n = ffs(w)))
-		n += 32;
+		if (w) {
+			n = ffs(w);
+			if (n)
+				n += 32;
+		}
 	}
 	return n - 1;
 }

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-05-22 14:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-21 12:27 [patch] [XFS] indent an if statement Dan Carpenter
2014-05-21 12:44 ` Eric Sandeen
2014-05-21 14:29 ` Christoph Hellwig
2014-05-21 14:35   ` Dan Carpenter
2014-05-21 16:50     ` walter harms
2014-05-22 10:01       ` Christoph Hellwig
2014-05-22 13:31         ` Mark Tinguely
2014-05-22 14:04   ` [patch v2] [XFS] small cleanup in xfs_lowbit64() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox