From patchwork Thu Jan 27 16:33:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coly Li X-Patchwork-Id: 80711 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 C799CB711E for ; Fri, 28 Jan 2011 03:14:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752000Ab1A0QOo (ORCPT ); Thu, 27 Jan 2011 11:14:44 -0500 Received: from [114.243.227.164] ([114.243.227.164]:50901 "EHLO enigma.site" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751216Ab1A0QOo (ORCPT ); Thu, 27 Jan 2011 11:14:44 -0500 X-Greylist: delayed 434 seconds by postgrey-1.27 at vger.kernel.org; Thu, 27 Jan 2011 11:14:43 EST Received: by enigma.site (Postfix, from userid 1000) id 05B21121343; Fri, 28 Jan 2011 00:33:10 +0800 (CST) From: Coly Li To: linux-ext4@vger.kernel.org Cc: Coly Li , Theodore Tso Subject: [PATCH] __ext4_get_inode_loc: use s_inodes_per_block directly Date: Fri, 28 Jan 2011 00:33:06 +0800 Message-Id: <1296145986-4985-1-git-send-email-bosong.ly@taobao.com> X-Mailer: git-send-email 1.7.3.4 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In __ext4_get_inode_loc(), inodes_per_block is calculated by (EXT4_BLOCK_SIZE(sb) / EXT4_INODE_SIZE(sb)). This is unncessary, the value can be found directly from s_inodes_per_block. Signed-off-by: Coly Li Cc: Theodore Tso --- fs/ext4/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9f7f9e4..837c5a6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4668,7 +4668,7 @@ static int __ext4_get_inode_loc(struct inode *inode, /* * Figure out the offset within the block group inode table */ - inodes_per_block = (EXT4_BLOCK_SIZE(sb) / EXT4_INODE_SIZE(sb)); + inodes_per_block = EXT4_SB(sb)->s_inodes_per_block; inode_offset = ((inode->i_ino - 1) % EXT4_INODES_PER_GROUP(sb)); block = ext4_inode_table(sb, gdp) + (inode_offset / inodes_per_block);