diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-02-08 04:20:44 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 09:22:35 -0800 |
commit | 48d6d8ff7dca804536298e517298182c4a51c421 (patch) | |
tree | 8566ae59bdd01fb3568b6441b909d035dba7b61b /fs/udf/ialloc.c | |
parent | c0b344385fa05f6bea462e707fcba89f9e2776c2 (diff) | |
download | linux-3.10-48d6d8ff7dca804536298e517298182c4a51c421.tar.gz linux-3.10-48d6d8ff7dca804536298e517298182c4a51c421.tar.bz2 linux-3.10-48d6d8ff7dca804536298e517298182c4a51c421.zip |
udf: cache struct udf_inode_info
cache UDF_I(struct inode *) return values when there are
at least 2 uses in one function
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/ialloc.c')
-rw-r--r-- | fs/udf/ialloc.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 5ed8cda1c53..84360315aca 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c @@ -67,6 +67,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) struct inode *inode; int block; uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; + struct udf_inode_info *iinfo; + struct udf_inode_info *dinfo = UDF_I(dir); inode = new_inode(sb); @@ -76,14 +78,15 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) } *err = -ENOSPC; - UDF_I(inode)->i_unique = 0; - UDF_I(inode)->i_lenExtents = 0; - UDF_I(inode)->i_next_alloc_block = 0; - UDF_I(inode)->i_next_alloc_goal = 0; - UDF_I(inode)->i_strat4096 = 0; + iinfo = UDF_I(inode); + iinfo->i_unique = 0; + iinfo->i_lenExtents = 0; + iinfo->i_next_alloc_block = 0; + iinfo->i_next_alloc_goal = 0; + iinfo->i_strat4096 = 0; block = udf_new_block(dir->i_sb, NULL, - UDF_I(dir)->i_location.partitionReferenceNum, + dinfo->i_location.partitionReferenceNum, start, err); if (*err) { iput(inode); @@ -107,7 +110,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) else lvidiu->numFiles = cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1); - UDF_I(inode)->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); + iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); if (!(++uniqueID & 0x00000000FFFFFFFFUL)) uniqueID += 16; lvhd->uniqueID = cpu_to_le64(uniqueID); @@ -123,41 +126,41 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) inode->i_gid = current->fsgid; } - UDF_I(inode)->i_location.logicalBlockNum = block; - UDF_I(inode)->i_location.partitionReferenceNum = - UDF_I(dir)->i_location.partitionReferenceNum; - inode->i_ino = udf_get_lb_pblock(sb, UDF_I(inode)->i_location, 0); + iinfo->i_location.logicalBlockNum = block; + iinfo->i_location.partitionReferenceNum = + dinfo->i_location.partitionReferenceNum; + inode->i_ino = udf_get_lb_pblock(sb, iinfo->i_location, 0); inode->i_blocks = 0; - UDF_I(inode)->i_lenEAttr = 0; - UDF_I(inode)->i_lenAlloc = 0; - UDF_I(inode)->i_use = 0; + iinfo->i_lenEAttr = 0; + iinfo->i_lenAlloc = 0; + iinfo->i_use = 0; if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { - UDF_I(inode)->i_efe = 1; + iinfo->i_efe = 1; if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev) sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE; - UDF_I(inode)->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - + iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL); } else { - UDF_I(inode)->i_efe = 0; - UDF_I(inode)->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - + iinfo->i_efe = 0; + iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); } - if (!UDF_I(inode)->i_ext.i_data) { + if (!iinfo->i_ext.i_data) { iput(inode); *err = -ENOMEM; mutex_unlock(&sbi->s_alloc_mutex); return NULL; } if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) - UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; + iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) - UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; + iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; else - UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; + iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; inode->i_mtime = inode->i_atime = inode->i_ctime = - UDF_I(inode)->i_crtime = current_fs_time(inode->i_sb); + iinfo->i_crtime = current_fs_time(inode->i_sb); insert_inode_hash(inode); mark_inode_dirty(inode); mutex_unlock(&sbi->s_alloc_mutex); |