mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 12:52:30 +00:00
udf: Remove repeated loads blocksize
Store blocksize in a local variable in udf_fill_inode() since it is used a lot of times. Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
e4a93be6cb
commit
7914495427
@ -1288,6 +1288,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
|
|||||||
struct kernel_lb_addr *iloc = &iinfo->i_location;
|
struct kernel_lb_addr *iloc = &iinfo->i_location;
|
||||||
unsigned int link_count;
|
unsigned int link_count;
|
||||||
unsigned int indirections = 0;
|
unsigned int indirections = 0;
|
||||||
|
int bs = inode->i_sb->s_blocksize;
|
||||||
int ret = -EIO;
|
int ret = -EIO;
|
||||||
|
|
||||||
reread:
|
reread:
|
||||||
@ -1374,38 +1375,35 @@ reread:
|
|||||||
if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) {
|
if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) {
|
||||||
iinfo->i_efe = 1;
|
iinfo->i_efe = 1;
|
||||||
iinfo->i_use = 0;
|
iinfo->i_use = 0;
|
||||||
ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
|
ret = udf_alloc_i_data(inode, bs -
|
||||||
sizeof(struct extendedFileEntry));
|
sizeof(struct extendedFileEntry));
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
memcpy(iinfo->i_ext.i_data,
|
memcpy(iinfo->i_ext.i_data,
|
||||||
bh->b_data + sizeof(struct extendedFileEntry),
|
bh->b_data + sizeof(struct extendedFileEntry),
|
||||||
inode->i_sb->s_blocksize -
|
bs - sizeof(struct extendedFileEntry));
|
||||||
sizeof(struct extendedFileEntry));
|
|
||||||
} else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) {
|
} else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) {
|
||||||
iinfo->i_efe = 0;
|
iinfo->i_efe = 0;
|
||||||
iinfo->i_use = 0;
|
iinfo->i_use = 0;
|
||||||
ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
|
ret = udf_alloc_i_data(inode, bs - sizeof(struct fileEntry));
|
||||||
sizeof(struct fileEntry));
|
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
memcpy(iinfo->i_ext.i_data,
|
memcpy(iinfo->i_ext.i_data,
|
||||||
bh->b_data + sizeof(struct fileEntry),
|
bh->b_data + sizeof(struct fileEntry),
|
||||||
inode->i_sb->s_blocksize - sizeof(struct fileEntry));
|
bs - sizeof(struct fileEntry));
|
||||||
} else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) {
|
} else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) {
|
||||||
iinfo->i_efe = 0;
|
iinfo->i_efe = 0;
|
||||||
iinfo->i_use = 1;
|
iinfo->i_use = 1;
|
||||||
iinfo->i_lenAlloc = le32_to_cpu(
|
iinfo->i_lenAlloc = le32_to_cpu(
|
||||||
((struct unallocSpaceEntry *)bh->b_data)->
|
((struct unallocSpaceEntry *)bh->b_data)->
|
||||||
lengthAllocDescs);
|
lengthAllocDescs);
|
||||||
ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
|
ret = udf_alloc_i_data(inode, bs -
|
||||||
sizeof(struct unallocSpaceEntry));
|
sizeof(struct unallocSpaceEntry));
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
memcpy(iinfo->i_ext.i_data,
|
memcpy(iinfo->i_ext.i_data,
|
||||||
bh->b_data + sizeof(struct unallocSpaceEntry),
|
bh->b_data + sizeof(struct unallocSpaceEntry),
|
||||||
inode->i_sb->s_blocksize -
|
bs - sizeof(struct unallocSpaceEntry));
|
||||||
sizeof(struct unallocSpaceEntry));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1498,8 +1496,7 @@ reread:
|
|||||||
if (iinfo->i_lenAlloc != inode->i_size)
|
if (iinfo->i_lenAlloc != inode->i_size)
|
||||||
goto out;
|
goto out;
|
||||||
/* File in ICB has to fit in there... */
|
/* File in ICB has to fit in there... */
|
||||||
if (inode->i_size > inode->i_sb->s_blocksize -
|
if (inode->i_size > bs - udf_file_entry_alloc_offset(inode))
|
||||||
udf_file_entry_alloc_offset(inode))
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user