All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] fs/omfs/inode.c: use ULLONG_MAX instead of ~0ULL
@ 2014-06-15  6:39 Fabian Frederick
  2014-06-15 16:11 ` Bob Copeland
  0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2014-06-15  6:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Bob Copeland, Andrew Morton

Use more explicit kernel.h definition

Cc: Bob Copeland <me@bobcopeland.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
V2:
   Fix Cc list

 fs/omfs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index ec58c76..40c0707 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -317,7 +317,7 @@ static int omfs_get_imap(struct super_block *sb)
 	bitmap_size = DIV_ROUND_UP(sbi->s_num_blocks, 8);
 	array_size = DIV_ROUND_UP(bitmap_size, sb->s_blocksize);
 
-	if (sbi->s_bitmap_ino == ~0ULL)
+	if (sbi->s_bitmap_ino == ULLONG_MAX)
 		goto out;
 
 	sbi->s_imap_size = array_size;
@@ -516,7 +516,7 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
 		goto out_brelse_bh2;
 	}
 
-	if (sbi->s_bitmap_ino != ~0ULL &&
+	if (sbi->s_bitmap_ino != ULLONG_MAX &&
 	    sbi->s_bitmap_ino > sbi->s_num_blocks) {
 		printk(KERN_ERR "omfs: free space bitmap location is corrupt "
 			"(%llx, total blocks %llx)\n",
-- 
1.8.4.5


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

* Re: [PATCH V2] fs/omfs/inode.c: use ULLONG_MAX instead of ~0ULL
  2014-06-15  6:39 [PATCH V2] fs/omfs/inode.c: use ULLONG_MAX instead of ~0ULL Fabian Frederick
@ 2014-06-15 16:11 ` Bob Copeland
  2014-06-16 18:59   ` Fabian Frederick
  0 siblings, 1 reply; 3+ messages in thread
From: Bob Copeland @ 2014-06-15 16:11 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, Andrew Morton

On Sun, Jun 15, 2014 at 08:39:20AM +0200, Fabian Frederick wrote:
> Use more explicit kernel.h definition
>  	array_size = DIV_ROUND_UP(bitmap_size, sb->s_blocksize);
>  
> -	if (sbi->s_bitmap_ino == ~0ULL)
> +	if (sbi->s_bitmap_ino == ULLONG_MAX)
>  		goto out;

So I agree they are the same, but is there a good reason for the
change?

Semantically, I think of ~0ULL as "all ones" whereas ULLONG_MAX
as a maximum of a magnitude comparison, which this is not really.

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH V2] fs/omfs/inode.c: use ULLONG_MAX instead of ~0ULL
  2014-06-15 16:11 ` Bob Copeland
@ 2014-06-16 18:59   ` Fabian Frederick
  0 siblings, 0 replies; 3+ messages in thread
From: Fabian Frederick @ 2014-06-16 18:59 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linux-kernel, Andrew Morton

On Sun, 15 Jun 2014 12:11:42 -0400
Bob Copeland <me@bobcopeland.com> wrote:

> On Sun, Jun 15, 2014 at 08:39:20AM +0200, Fabian Frederick wrote:
> > Use more explicit kernel.h definition
> >  	array_size = DIV_ROUND_UP(bitmap_size, sb->s_blocksize);
> >  
> > -	if (sbi->s_bitmap_ino == ~0ULL)
> > +	if (sbi->s_bitmap_ino == ULLONG_MAX)
> >  		goto out;
> 
> So I agree they are the same, but is there a good reason for the
> change?
> 
> Semantically, I think of ~0ULL as "all ones" whereas ULLONG_MAX
> as a maximum of a magnitude comparison, which this is not really.

Well it was meant to clarify code but in this case it doesn't indeed :)

Thanks,
Fabian

> 
> -- 
> Bob Copeland %% www.bobcopeland.com

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

end of thread, other threads:[~2014-06-16 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-15  6:39 [PATCH V2] fs/omfs/inode.c: use ULLONG_MAX instead of ~0ULL Fabian Frederick
2014-06-15 16:11 ` Bob Copeland
2014-06-16 18:59   ` Fabian Frederick

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.