From patchwork Mon Sep 21 12:04:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denys Vlasenko X-Patchwork-Id: 7229421 Return-Path: X-Original-To: patchwork-linux-scsi@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 26A61BEEC1 for ; Mon, 21 Sep 2015 12:05:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05BC920781 for ; Mon, 21 Sep 2015 12:04:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D08692077A for ; Mon, 21 Sep 2015 12:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755839AbbIUMEl (ORCPT ); Mon, 21 Sep 2015 08:04:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45042 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753767AbbIUMEk (ORCPT ); Mon, 21 Sep 2015 08:04:40 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id DA0FA8E6F1; Mon, 21 Sep 2015 12:04:39 +0000 (UTC) Received: from localhost.localdomain (dhcp-1-139.brq.redhat.com [10.34.1.139]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8LC4Zvx016426; Mon, 21 Sep 2015 08:04:36 -0400 From: Denys Vlasenko To: Krishna Gudipati Cc: Denys Vlasenko , Vijaya Mohan Guvva , Anil Gurumurthy , James Bottomley , Fabian Frederick , Anil Gurumurthy , Christoph Hellwig , Guenter Roeck , Ben Hutchings , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH] bfa: deinline __bfa_trc, wwn2str and fcid2str Date: Mon, 21 Sep 2015 14:04:31 +0200 Message-Id: <1442837071-17803-1-git-send-email-dvlasenk@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os, after deinlining these functions have sizes and callsite counts as follows: __bfa_trc: 115 bytes, 1494 calls wwn2str: 108 bytes, 27 calls fcid2str: 46 bytes, 3 calls __bfa_trc32 is similar to __bfa_trc, so it should have been uninlined too. However, it is also unused. Anil Gurumurthy suggested I can just delete it, I did so. Change in code size is about 135,000 bytes: text data bss dec hex filename 91470054 19945080 36421632 147836766 8cfcf5e vmlinux.before 91335078 19944984 36421632 147701694 8cdbfbe vmlinux Signed-off-by: Denys Vlasenko CC: Krishna Gudipati CC: Vijaya Mohan Guvva CC: Anil Gurumurthy CC: James Bottomley CC: Fabian Frederick CC: Anil Gurumurthy CC: Christoph Hellwig CC: Guenter Roeck CC: Ben Hutchings CC: James Bottomley CC: linux-kernel@vger.kernel.org CC: linux-scsi@vger.kernel.org --- drivers/scsi/bfa/bfa_core.c | 45 ++++++++++++++++++++++++++++++ drivers/scsi/bfa/bfa_cs.h | 67 +++------------------------------------------ 2 files changed, 49 insertions(+), 63 deletions(-) diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index e3f67b0..fdf0f4e 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c @@ -90,6 +90,51 @@ static bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[BFI_MC_MAX] = { +void +wwn2str(char *wwn_str, u64 wwn) +{ + union { + u64 wwn; + u8 byte[8]; + } w; + + w.wwn = wwn; + sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0], + w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5], + w.byte[6], w.byte[7]); +} + +void +fcid2str(char *fcid_str, u32 fcid) +{ + union { + u32 fcid; + u8 byte[4]; + } f; + + f.fcid = fcid; + sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]); +} + +void +__bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) +{ + int tail = trcm->tail; + struct bfa_trc_s *trc = &trcm->trc[tail]; + + if (trcm->stopped) + return; + + trc->fileno = (u16) fileno; + trc->line = (u16) line; + trc->data.u64 = data; + trc->timestamp = BFA_TRC_TS(trcm); + + trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); + if (trcm->tail == trcm->head) + trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); +} + static void bfa_com_port_attach(struct bfa_s *bfa) { diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h index 91a8aa3..3f00eab 100644 --- a/drivers/scsi/bfa/bfa_cs.h +++ b/drivers/scsi/bfa/bfa_cs.h @@ -107,44 +107,8 @@ bfa_trc_stop(struct bfa_trc_mod_s *trcm) trcm->stopped = 1; } -static inline void -__bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) -{ - int tail = trcm->tail; - struct bfa_trc_s *trc = &trcm->trc[tail]; - - if (trcm->stopped) - return; - - trc->fileno = (u16) fileno; - trc->line = (u16) line; - trc->data.u64 = data; - trc->timestamp = BFA_TRC_TS(trcm); - - trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); - if (trcm->tail == trcm->head) - trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); -} - - -static inline void -__bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) -{ - int tail = trcm->tail; - struct bfa_trc_s *trc = &trcm->trc[tail]; - - if (trcm->stopped) - return; - - trc->fileno = (u16) fileno; - trc->line = (u16) line; - trc->data.u32.u32 = data; - trc->timestamp = BFA_TRC_TS(trcm); - - trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); - if (trcm->tail == trcm->head) - trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); -} +void +__bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data); #define bfa_sm_fault(__mod, __event) do { \ bfa_trc(__mod, (((u32)0xDEAD << 16) | __event)); \ @@ -324,31 +288,8 @@ bfa_wc_wait(struct bfa_wc_s *wc) bfa_wc_down(wc); } -static inline void -wwn2str(char *wwn_str, u64 wwn) -{ - union { - u64 wwn; - u8 byte[8]; - } w; - - w.wwn = wwn; - sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0], - w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5], - w.byte[6], w.byte[7]); -} - -static inline void -fcid2str(char *fcid_str, u32 fcid) -{ - union { - u32 fcid; - u8 byte[4]; - } f; - - f.fcid = fcid; - sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]); -} +void wwn2str(char *wwn_str, u64 wwn); +void fcid2str(char *fcid_str, u32 fcid); #define bfa_swap_3b(_x) \ ((((_x) & 0xff) << 16) | \