From patchwork Thu Apr 2 03:45:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 6144141 Return-Path: X-Original-To: patchwork-ocfs2-devel@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 579BDBF4A6 for ; Thu, 2 Apr 2015 03:44:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77C8F20386 for ; Thu, 2 Apr 2015 03:44:37 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FFFA20382 for ; Thu, 2 Apr 2015 03:44:36 +0000 (UTC) Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t323hrdG026249 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Apr 2015 03:43:54 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t323hqam012912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Apr 2015 03:43:52 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1YdW2q-0005mj-CD; Wed, 01 Apr 2015 20:43:52 -0700 Received: from userv0021.oracle.com ([156.151.31.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1YdW2Q-0005m4-Rt for ocfs2-devel@oss.oracle.com; Wed, 01 Apr 2015 20:43:26 -0700 Received: from aserp1030.oracle.com (aserp1030.oracle.com [141.146.126.68]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t323hQmb013280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Apr 2015 03:43:26 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp1030.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t323hPse031925 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 2 Apr 2015 03:43:25 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.14.7/8.14.7) with SMTP id t323hLrI003546 for ; Thu, 2 Apr 2015 03:43:25 GMT Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) by userp2030.oracle.com with ESMTP id 1tgt99kaey-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 Apr 2015 03:43:24 +0000 Received: from localhost (c-67-161-9-76.hsd1.ca.comcast.net [67.161.9.76]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8E9D3273; Thu, 2 Apr 2015 03:43:18 +0000 (UTC) Date: Wed, 1 Apr 2015 20:45:41 -0700 From: Andrew Morton To: alex chen Message-Id: <20150401204541.585fc044.akpm@linux-foundation.org> In-Reply-To: <551CB41E.4030005@huawei.com> References: <5518C165.10106@huawei.com> <20150331151348.2887ede16683257826833e04@linux-foundation.org> <551B3F41.6020501@huawei.com> <20150331191909.d5445d66.akpm@linux-foundation.org> <551CB41E.4030005@huawei.com> X-Mailer: Sylpheed 2.7.1 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 X-ServerName: mail.linuxfoundation.org X-Proofpoint-Virus-Version: vendor=nai engine=5700 definitions=7758 signatures=670578 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1504020035 Cc: Mark Fasheh , "ocfs2-devel@oss.oracle.com" Subject: Re: [Ocfs2-devel] [PATCH] ocfs2: check if the ocfs2 lock resource be initialized before calling ocfs2_dlm_lock X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 On Thu, 2 Apr 2015 11:14:38 +0800 alex chen wrote: > >>> > >> I don't think this is fit for all. > >> In many places it should do cleanup rather than just return the error > >> code. > > > > There are about 50 sites which can use this. > > > > Can we define a new macro 'mlog_errno_return' as described below ? > In addition, ocfs2 does > if (v) > mlog_errno(v); > return v; > in some places. In order to deal with this situation we can judge if > 'st' is not equal to zero before printing log. Macros which hide control flow are evil, although in this case the "return" in the name gives people info about what's happening. But why bother? This: z:/usr/src/25> size fs/ocfs2/ocfs2.ko text data bss dec hex filename 1140849 82767 832192 2055808 1f5e80 fs/ocfs2/ocfs2.ko-before 675402 82767 226104 984273 f04d1 fs/ocfs2/ocfs2.ko It almost doubles the size of the object code! Someone, please put this thing on a diet. It doesn't all need to be inlined. We could just do extern void __mlog_errno(int st); #define mlog_errno(st) __mlog_errno(st, __LINE__) and save hundreds of kilobytes of text. It'll be faster too, due to the reduced instruction cache footprint. --- a/fs/ocfs2/cluster/masklog.h~ocfs2-make-mlog_errno-return-the-errno +++ a/fs/ocfs2/cluster/masklog.h @@ -196,13 +196,14 @@ extern struct mlog_bits mlog_and_bits, m } \ } while (0) -#define mlog_errno(st) do { \ +#define mlog_errno(st) ({ \ int _st = (st); \ if (_st != -ERESTARTSYS && _st != -EINTR && \ _st != AOP_TRUNCATED_PAGE && _st != -ENOSPC && \ _st != -EDQUOT) \ mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ -} while (0) + st; \ +}) #define mlog_bug_on_msg(cond, fmt, args...) do { \ if (cond) { \ is clean, idiomatic and works great. And with no other change it shrinks the fs object code by 6k. Gad, mlog_errno() is a *huge* source of bloat. Look: --- a/fs/ocfs2/cluster/masklog.h~a +++ a/fs/ocfs2/cluster/masklog.h @@ -183,27 +183,9 @@ extern struct mlog_bits mlog_and_bits, m task_pid_nr(current), __mlog_cpu_guess, \ __PRETTY_FUNCTION__, __LINE__ , ##args) -#define mlog(mask, fmt, args...) do { \ - u64 __m = MLOG_MASK_PREFIX | (mask); \ - if ((__m & ML_ALLOWED_BITS) && \ - __mlog_test_u64(__m, mlog_and_bits) && \ - !__mlog_test_u64(__m, mlog_not_bits)) { \ - if (__m & ML_ERROR) \ - __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ - else if (__m & ML_NOTICE) \ - __mlog_printk(KERN_NOTICE, fmt , ##args); \ - else __mlog_printk(KERN_INFO, fmt , ##args); \ - } \ -} while (0) +#define mlog(mask, fmt, args...) do { } while (0) -#define mlog_errno(st) ({ \ - int _st = (st); \ - if (_st != -ERESTARTSYS && _st != -EINTR && \ - _st != AOP_TRUNCATED_PAGE && _st != -ENOSPC && \ - _st != -EDQUOT) \ - mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ - st; \ -}) +#define mlog_errno(st) do { } while (0) #define mlog_bug_on_msg(cond, fmt, args...) do { \ if (cond) { \