mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chengang@emindsoft.com.cn
To: dhowells@redhat.com
Cc: akpm@linux-foundation.org, viro@zeniv.linux.org.uk,
	nicolas.iooss_linux@m4x.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Chen Gang <gang.chen.5i5j@gmail.com>
Subject: [PATCH] fs: dcache: Use bool return value instead of int
Date: Tue, 12 Jan 2016 05:30:45 +0800	[thread overview]
Message-ID: <1452547845-12039-1-git-send-email-chengang@emindsoft.com.cn> (raw)

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.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 fs/dcache.c            | 8 ++++----
 include/linux/dcache.h | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index b4539e8..7701479 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1281,9 +1281,9 @@ rename_retry:
 
 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;
@@ -1296,9 +1296,9 @@ static enum d_walk_ret check_mount(void *data, struct dentry *dentry)
  * Return true if the parent or its subdirectories contain
  * a mount point
  */
-int have_submounts(struct dentry *parent)
+bool have_submounts(struct dentry *parent)
 {
-	int ret = 0;
+	bool ret = false;
 
 	d_walk(parent, &ret, check_mount, NULL);
 
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 7781ce11..880a41c 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -266,7 +266,7 @@ extern struct dentry *d_find_alias(struct inode *);
 extern void d_prune_aliases(struct inode *);
 
 /* test whether we have any submounts in a subdir tree */
-extern int have_submounts(struct dentry *);
+extern bool have_submounts(struct dentry *);
 
 /*
  * This adds the entry to the hash queues.
@@ -370,12 +370,12 @@ extern struct dentry *dget_parent(struct dentry *dentry);
  *	Returns true if the dentry passed is not currently hashed.
  */
  
-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);
 }
@@ -508,7 +508,7 @@ static inline bool d_really_is_positive(const struct dentry *dentry)
 	return dentry->d_inode != NULL;
 }
 
-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);
 }
-- 
1.9.3

             reply	other threads:[~2016-01-11 21:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 21:30 chengang [this message]
2016-01-11 22:51 ` Al Viro
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=1452547845-12039-1-git-send-email-chengang@emindsoft.com.cn \
    --to=chengang@emindsoft.com.cn \
    --cc=akpm@linux-foundation.org \
    --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 \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®