From patchwork Mon Jan 11 21:30:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 8011561 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52ED4BEEE5 for ; Mon, 11 Jan 2016 21:32:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CF0D201B9 for ; Mon, 11 Jan 2016 21:32:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64E6220173 for ; Mon, 11 Jan 2016 21:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933473AbcAKVcS (ORCPT ); Mon, 11 Jan 2016 16:32:18 -0500 Received: from mail113-250.mail.alibaba.com ([205.204.113.250]:47709 "EHLO us-alimail-mta2.hst.scl.en.alidc.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933352AbcAKVcQ (ORCPT ); Mon, 11 Jan 2016 16:32:16 -0500 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.074474|-1; FP=0|0|0|0|0|-1|-1|-1; HT=e01l04447; MF=chengang@emindsoft.com.cn; NM=1; PH=DS; RN=8; RT=7; SR=0; TI=SMTPD_----4RYQJrx_1452547862; Received: from localhost.localdomain.localdomain(mailfrom:chengang@emindsoft.com.cn ip:223.72.67.30) by smtp.aliyun-inc.com(10.147.42.135); Tue, 12 Jan 2016 05:31:09 +0800 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 Subject: [PATCH] fs: dcache: Use bool return value instead of int Date: Tue, 12 Jan 2016 05:30:45 +0800 Message-Id: <1452547845-12039-1-git-send-email-chengang@emindsoft.com.cn> X-Mailer: git-send-email 1.9.3 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chen Gang 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 --- 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); }