lkml.org 
[lkml]   [2019]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 01/24] erofs: add on-disk layout
Hi Christoph,

On Thu, Aug 29, 2019 at 02:59:54AM -0700, Christoph Hellwig wrote:

[]

>
> > +static bool erofs_inode_is_data_compressed(unsigned int datamode)
> > +{
> > + if (datamode == EROFS_INODE_FLAT_COMPRESSION)
> > + return true;
> > + return datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY;
> > +}
>
> This looks like a really obsfucated way to write:
>
> return datamode == EROFS_INODE_FLAT_COMPRESSION ||
> datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY;

Add a word about this, the above approach is not horrible if more
datamode add here and comments, e.g

static bool erofs_inode_is_data_compressed(unsigned int datamode)
{
/* has z_erofs_map_header */
if (datamode == EROFS_INODE_FLAT_COMPRESSION)
return true;
/* some blablabla */
if (datamode == (1) )
return true;
/* some blablablabla */
if (datamode == (2) )
return true;
/* no z_erofs_map_header */
return datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY;
}

vs.

static bool erofs_inode_is_data_compressed(unsigned int datamode)
{
/* has z_erofs_map_header */
return datamode == EROFS_INODE_FLAT_COMPRESSION ||
/* some blablabla */
datamode == (1) ||
/* some blablablabla */
datamode == (2) ||
/* no z_erofs_map_header */
datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY;
}

I have no idea which one is better.
Anyway, if you still like the form, I will change it.

Thanks,
Gao Xiang

\
 
 \ /
  Last update: 2019-08-29 17:42    [W:0.281 / U:2.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site