From patchwork Fri Sep 14 11:24:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ma X-Patchwork-Id: 183884 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 DD7AA2C0082 for ; Fri, 14 Sep 2012 21:25:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758248Ab2INLZ2 (ORCPT ); Fri, 14 Sep 2012 07:25:28 -0400 Received: from oproxy12-pub.bluehost.com ([50.87.16.10]:49809 "HELO oproxy12-pub.bluehost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753034Ab2INLZV (ORCPT ); Fri, 14 Sep 2012 07:25:21 -0400 Received: (qmail 5806 invoked by uid 0); 14 Sep 2012 11:25:19 -0000 Received: from unknown (HELO box585.bluehost.com) (66.147.242.185) by oproxy12.bluehost.com with SMTP; 14 Sep 2012 11:25:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tao.ma; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=50XV9ND2ZpdUwXfB7q7MV2oNndyZ/MTJRDrztYdXdbU=; b=I+TSUQP02G5t5wcj2hK+z1Q1mmasugDNfXcnfn9o47lKJfIXWhQovVqxu61HwP2DgDBDz3OJpUnUomJWmyytslwQRQlxEy6fiJ6SJtdl2huc2D05eP6qgeOnr0Sw3+G4; Received: from [182.92.247.2] (port=60014 helo=tma-laptop1.taobao.ali.com) by box585.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TCU1P-0001sO-0J for linux-ext4@vger.kernel.org; Fri, 14 Sep 2012 05:25:19 -0600 From: Tao Ma To: linux-ext4@vger.kernel.org Subject: [PATCH V6 01/23] ext4: Move extra inode read to a new function. Date: Fri, 14 Sep 2012 19:24:49 +0800 Message-Id: <1347621911-4104-1-git-send-email-tm@tao.ma> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1347621512-3660-1-git-send-email-tm@tao.ma> References: <1347621512-3660-1-git-send-email-tm@tao.ma> X-Identified-User: {1390:box585.bluehost.com:colyli:tao.ma} {sentby:smtp auth 182.92.247.2 authed with tm@tao.ma} Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Tao Ma Currently, in ext4_iget we do a simple check to see whether there does exist some information starting from the end of i_extra_size. With inline data added, this procedure is more complicated. So move it to a new function named ext4_iget_extra_inode. Signed-off-by: Tao Ma --- fs/ext4/inode.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index dff171c..bfaac61 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3773,6 +3773,16 @@ static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode, } } +static inline void ext4_iget_extra_inode(struct inode *inode, + struct ext4_inode *raw_inode, + struct ext4_inode_info *ei) +{ + __le32 *magic = (void *)raw_inode + + EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize; + if (*magic == cpu_to_le32(EXT4_XATTR_MAGIC)) + ext4_set_inode_state(inode, EXT4_STATE_XATTR); +} + struct inode *ext4_iget(struct super_block *sb, unsigned long ino) { struct ext4_iloc iloc; @@ -3915,11 +3925,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ei->i_extra_isize = sizeof(struct ext4_inode) - EXT4_GOOD_OLD_INODE_SIZE; } else { - __le32 *magic = (void *)raw_inode + - EXT4_GOOD_OLD_INODE_SIZE + - ei->i_extra_isize; - if (*magic == cpu_to_le32(EXT4_XATTR_MAGIC)) - ext4_set_inode_state(inode, EXT4_STATE_XATTR); + ext4_iget_extra_inode(inode, raw_inode, ei); } }