From patchwork Thu Feb 7 14:57:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 218936 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0859F2C0091 for ; Fri, 8 Feb 2013 01:58:07 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758182Ab3BGO6G (ORCPT ); Thu, 7 Feb 2013 09:58:06 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:56184 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758291Ab3BGO6F (ORCPT ); Thu, 7 Feb 2013 09:58:05 -0500 Received: by mail-pa0-f51.google.com with SMTP id hz1so1472395pad.10 for ; Thu, 07 Feb 2013 06:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=o1xc44QX6XFhRHZV6C6gsvw9gnuXL2HDhuGLV0nRMZE=; b=ziUfyZlP01FkpMDFa3ivEZgtj43Al8M6np6qfH5FDN6ImiSrTNK1AcRcmGun+oHdIz iyu46wxbWVLPv3XSj63FB/8EpYFiZcz31DeaO9EFb4+KRKHC6hBvBTpB75OYJsABSc25 pxsU31UQ/B08Dj80blHGRO99dH43hig03tv2vJhdP1HaLaQ+aoJzYzOXM+In/2nojWWj +c8t762FeiRgSNghr99kALDPRYV1VE6UiLbmXVxACppjf6gIG73IKCJBofxxlt7b66AE Mmio7HFgjKpyFO7hiBrjq2yOg21kSAjYwW+wmhZDgO2t+ifc7pwkvOQuX6IP4lFx+gJY 69ew== X-Received: by 10.66.75.66 with SMTP id a2mr6483009paw.65.1360249085329; Thu, 07 Feb 2013 06:58:05 -0800 (PST) Received: from localhost.localdomain.localdomain ([36.58.200.131]) by mx.google.com with ESMTPS id c3sm2870895pax.9.2013.02.07.06.58.02 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 Feb 2013 06:58:04 -0800 (PST) From: Wang shilong To: jack@suse.cz Cc: linux-ext4@vger.kernel.org Subject: [PATCH v1 3/3] Ext2: remove the static function release_blocks to optimize the kernel Date: Thu, 7 Feb 2013 22:57:54 +0800 Message-Id: <1360249074-2642-2-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1360249074-2642-1-git-send-email-wangshilong1991@gmail.com> References: <1360249074-2642-1-git-send-email-wangshilong1991@gmail.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Wang Shilong Because the static function 'release_blocks' is only called when releasing blocks,it will be more simple and efficient to call the function 'percpu_counter_add' directly. Signed-off-by: Wang Shilong --- fs/ext2/balloc.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 9d372bf..d5a6afd 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -159,15 +159,6 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) return bh; } -static void release_blocks(struct super_block *sb, int count) -{ - if (count) { - struct ext2_sb_info *sbi = EXT2_SB(sb); - - percpu_counter_add(&sbi->s_freeblocks_counter, count); - } -} - static void group_adjust_blocks(struct super_block *sb, int group_no, struct ext2_group_desc *desc, struct buffer_head *bh, int count) { @@ -569,7 +560,7 @@ do_more: error_return: brelse(bitmap_bh); if (freed) { - release_blocks(sb, freed); + percpu_counter_add(&sbi->s_freeblocks_counter, freed); dquot_free_block_nodirty(inode, freed); mark_inode_dirty(inode); }