From patchwork Tue Apr 9 06:04:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fanchaoting X-Patchwork-Id: 2419361 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 354103FCA5 for ; Wed, 10 Apr 2013 06:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752355Ab3DJGFe (ORCPT ); Wed, 10 Apr 2013 02:05:34 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:51632 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751866Ab3DJGFe (ORCPT ); Wed, 10 Apr 2013 02:05:34 -0400 X-IronPort-AV: E=Sophos;i="4.87,445,1363104000"; d="scan'208";a="7026416" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 10 Apr 2013 14:02:34 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r3A65B5J025048; Wed, 10 Apr 2013 14:05:12 +0800 Received: from localhost.localdomain ([10.167.233.70]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013041014040152-430848 ; Wed, 10 Apr 2013 14:04:01 +0800 Message-ID: <5163AF52.2080303@cn.fujitsu.com> Date: Tue, 09 Apr 2013 14:04:02 +0800 From: fanchaoting User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: "bfields@fieldses.org" CC: "linux-nfs@vger.kernel.org" Subject: [PATCH] nfsd: don't calculate mem's size in loop every time X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/04/10 14:04:01, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/04/10 14:04:01, Serialize complete at 2013/04/10 14:04:01 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: fanchaoting --- fs/nfsd/nfs4state.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2e27430..df3e3fd 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -716,8 +716,8 @@ static struct nfsd4_session *__alloc_session(int slotsize, int numslots) if (!new) return NULL; /* allocate each struct nfsd4_slot and data cache in one piece */ + mem = sizeof(struct nfsd4_slot) + slotsize; for (i = 0; i < numslots; i++) { - mem = sizeof(struct nfsd4_slot) + slotsize; new->se_slots[i] = kzalloc(mem, GFP_KERNEL); if (!new->se_slots[i]) goto out_free;