From: Tao Ma Subject: [PATCH V7 01/23] ext4: Move extra inode read to a new function. Date: Wed, 24 Oct 2012 10:55:16 +0800 Message-ID: <1351047338-4963-1-git-send-email-tm@tao.ma> References: <1351047002-4723-1-git-send-email-tm@tao.ma> To: linux-ext4@vger.kernel.org Return-path: Received: from oproxy9.bluehost.com ([69.89.24.6]:40454 "HELO oproxy9.bluehost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S934265Ab2JXCzt (ORCPT ); Tue, 23 Oct 2012 22:55:49 -0400 Received: from [182.92.247.2] (port=23186 helo=tma-laptop1.taobao.ali.com) by box585.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TQr8G-0006KI-IY for linux-ext4@vger.kernel.org; Tue, 23 Oct 2012 20:55:49 -0600 In-Reply-To: <1351047002-4723-1-git-send-email-tm@tao.ma> Sender: linux-ext4-owner@vger.kernel.org List-ID: 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 b3c243b..e8f6ce0 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3756,6 +3756,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; @@ -3898,11 +3908,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); } } -- 1.7.1