From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753673AbcAXVQx (ORCPT ); Sun, 24 Jan 2016 16:16:53 -0500 Received: from mail113-250.mail.alibaba.com ([205.204.113.250]:39855 "EHLO us-alimail-mta1.hst.scl.en.alidc.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751605AbcAXVQv (ORCPT ); Sun, 24 Jan 2016 16:16:51 -0500 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07573866|-1;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07380;MF=chengang@emindsoft.com.cn;NM=1;PH=DS;RN=7;RT=6;SR=0;TI=SMTPD_----4Tqsovx_1453670171; Message-ID: <56A53FEF.6020803@emindsoft.com.cn> Date: Mon, 25 Jan 2016 05:19:43 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Al Viro CC: dhowells@redhat.com, akpm@linux-foundation.org, nicolas.iooss_linux@m4x.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] fs: dcache: Use bool return value instead of int References: <1452547845-12039-1-git-send-email-chengang@emindsoft.com.cn> <20160111225104.GO17997@ZenIV.linux.org.uk> <5695733C.1010201@emindsoft.com.cn> <20160112222105.GT17997@ZenIV.linux.org.uk> <5696D239.2000605@emindsoft.com.cn> <20160113225446.GU17997@ZenIV.linux.org.uk> <5697C139.7040709@emindsoft.com.cn> In-Reply-To: <5697C139.7040709@emindsoft.com.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello all: Is this patch OK? shall I send the other patch based on this one? (the other patch is v3 trivial patch for include/linux/dcache.h). And sorry for replying late: the last week, I was not in Beijing, had to be busy for analyzing a Linux kernel usb related issue for my company's customer in Guangzhou (but at last, I guess, it is not kernel issue). Thanks. On 1/14/16 23:39, Chen Gang wrote: > > On 1/14/16 06:54, Al Viro wrote: >> On Thu, Jan 14, 2016 at 06:39:53AM +0800, Chen Gang wrote: >> >>>> As for the inlines... frankly, if gcc generates a different code from having >>>> replaced int with bool in those, it's time to do something very nasty to >>>> gcc developers. >>>> >>> >>> Could you provide the related proof? >> >> static inline _Bool f(.....) >> { >> return ; >> } >> >> ... >> if (f(.....)) >> > > For me, your case above isn't suitable for using bool. Please check this > patch, there is no any cases like you said above. > > - For d_unhashed() which return hlist_bl_unhashed(), it seems like your > case, but in fact hlist_bl_unhashed() also need return bool (which I > shall send another patch for, next). > > - And all the other changes of this patch are all for real, pure bool > functions. > > Thanks. > >> should generate the code identical to >> if ((_Bool)) >> which, in turn, should generate the code identical to >> if ( != 0) >> and >> if () >> >> Neither explicit nor implicit conversion to _Bool (the former by the explicit >> cast, the latter - by declaring f() to return _Bool) matters at all when the >> damn thing is inlined in a condition context. Conversion to _Bool is >> equivalent to comparison with 0, and so is the use in condition of if() and >> friends. >> >> For something not inlined you might get different code generated due to a >> difference in calling sequences of _Bool(...) and int(...); for inlined >> case having one of those variants produce a better code means that compiler >> has managed to miss some trivial optimization in all other variants. >> >> And I'm yet to see any proof that gcc *does* fuck up in that fashion. It >> might - dumb bugs happen to everyone, but I would not assume that they'd >> managed to do something that bogys without experimental evidence. >> > > For your cases, what you said sounds OK to me (although I am not quite > sure what you said above whether precise or not). > > Thanks. > -- Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed