linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: chengang@emindsoft.com.cn
Cc: dhowells@redhat.com, akpm@linux-foundation.org,
	nicolas.iooss_linux@m4x.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Chen Gang <gang.chen.5i5j@gmail.com>
Subject: Re: [PATCH] fs: dcache: Use bool return value instead of int
Date: Mon, 11 Jan 2016 22:51:05 +0000	[thread overview]
Message-ID: <20160111225104.GO17997@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1452547845-12039-1-git-send-email-chengang@emindsoft.com.cn>

On Tue, Jan 12, 2016 at 05:30:45AM +0800, chengang@emindsoft.com.cn wrote:
> From: Chen Gang <gang.chen.5i5j@gmail.com>
> 
> Use bool type for all functions which return boolean value. It will not
> only let code clearer, but also sometimes let gcc produce better code.

What's the point of this chunk?

>  static enum d_walk_ret check_mount(void *data, struct dentry *dentry)
>  {
> -	int *ret = data;
> +	bool *ret = data;
>  	if (d_mountpoint(dentry)) {
> -		*ret = 1;
> +		*ret = true;
>  		return D_WALK_QUIT;
>  	}
>  	return D_WALK_CONTINUE;

You are replacing a 1-word store with 1-byte store; if anything, that's more
likely to yield _worse_ code, not better one.

> -static inline int d_unhashed(const struct dentry *dentry)
> +static inline bool d_unhashed(const struct dentry *dentry)
>  {
>  	return hlist_bl_unhashed(&dentry->d_hash);
>  }
>  
> -static inline int d_unlinked(const struct dentry *dentry)
> +static inline bool d_unlinked(const struct dentry *dentry)
>  {
>  	return d_unhashed(dentry) && !IS_ROOT(dentry);
>  }

> -static inline int simple_positive(struct dentry *dentry)
> +static inline bool simple_positive(struct dentry *dentry)
>  {
>  	return d_really_is_positive(dentry) && !d_unhashed(dentry);
>  }

And these three are harmless, but completely pointless...

  reply	other threads:[~2016-01-11 22:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 21:30 [PATCH] fs: dcache: Use bool return value instead of int chengang
2016-01-11 22:51 ` Al Viro [this message]
2016-01-12 21:42   ` Chen Gang
2016-01-12 22:21     ` Al Viro
2016-01-13 22:39       ` Chen Gang
2016-01-13 22:54         ` Al Viro
2016-01-14 15:39           ` Chen Gang
2016-01-24 21:19             ` Chen Gang
2016-01-24 21:27               ` Al Viro
2016-01-25 21:24                 ` Chen Gang
2016-01-12  0:33 ` David Howells
2016-01-12  1:02   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160111225104.GO17997@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=chengang@emindsoft.com.cn \
    --cc=dhowells@redhat.com \
    --cc=gang.chen.5i5j@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.iooss_linux@m4x.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).