diff options
author | Jan Kara <jack@suse.cz> | 2015-01-07 07:46:16 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2015-01-07 07:46:16 -0500 |
commit | 79144954278d4bb5989f8b903adcac7a20ff2a5a (patch) | |
tree | 82e1ff72cc24636f33ea27be5db113d7ec50f575 /fs/udf | |
parent | e4a93be6cb281fb3dbbd41b22aee02cb0e551ba8 (diff) |
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>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/inode.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 5bc71d9a674a..95cb6970c3ea 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1288,6 +1288,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) | |||
1288 | struct kernel_lb_addr *iloc = &iinfo->i_location; | 1288 | struct kernel_lb_addr *iloc = &iinfo->i_location; |
1289 | unsigned int link_count; | 1289 | unsigned int link_count; |
1290 | unsigned int indirections = 0; | 1290 | unsigned int indirections = 0; |
1291 | int bs = inode->i_sb->s_blocksize; | ||
1291 | int ret = -EIO; | 1292 | int ret = -EIO; |
1292 | 1293 | ||
1293 | reread: | 1294 | reread: |
@@ -1374,38 +1375,35 @@ reread: | |||
1374 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { | 1375 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { |
1375 | iinfo->i_efe = 1; | 1376 | iinfo->i_efe = 1; |
1376 | iinfo->i_use = 0; | 1377 | iinfo->i_use = 0; |
1377 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1378 | ret = udf_alloc_i_data(inode, bs - |
1378 | sizeof(struct extendedFileEntry)); | 1379 | sizeof(struct extendedFileEntry)); |
1379 | if (ret) | 1380 | if (ret) |
1380 | goto out; | 1381 | goto out; |
1381 | memcpy(iinfo->i_ext.i_data, | 1382 | memcpy(iinfo->i_ext.i_data, |
1382 | bh->b_data + sizeof(struct extendedFileEntry), | 1383 | bh->b_data + sizeof(struct extendedFileEntry), |
1383 | inode->i_sb->s_blocksize - | 1384 | bs - sizeof(struct extendedFileEntry)); |
1384 | sizeof(struct extendedFileEntry)); | ||
1385 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { | 1385 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { |
1386 | iinfo->i_efe = 0; | 1386 | iinfo->i_efe = 0; |
1387 | iinfo->i_use = 0; | 1387 | iinfo->i_use = 0; |
1388 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1388 | ret = udf_alloc_i_data(inode, bs - sizeof(struct fileEntry)); |
1389 | sizeof(struct fileEntry)); | ||
1390 | if (ret) | 1389 | if (ret) |
1391 | goto out; | 1390 | goto out; |
1392 | memcpy(iinfo->i_ext.i_data, | 1391 | memcpy(iinfo->i_ext.i_data, |
1393 | bh->b_data + sizeof(struct fileEntry), | 1392 | bh->b_data + sizeof(struct fileEntry), |
1394 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1393 | bs - sizeof(struct fileEntry)); |
1395 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { | 1394 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { |
1396 | iinfo->i_efe = 0; | 1395 | iinfo->i_efe = 0; |
1397 | iinfo->i_use = 1; | 1396 | iinfo->i_use = 1; |
1398 | iinfo->i_lenAlloc = le32_to_cpu( | 1397 | iinfo->i_lenAlloc = le32_to_cpu( |
1399 | ((struct unallocSpaceEntry *)bh->b_data)-> | 1398 | ((struct unallocSpaceEntry *)bh->b_data)-> |
1400 | lengthAllocDescs); | 1399 | lengthAllocDescs); |
1401 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1400 | ret = udf_alloc_i_data(inode, bs - |
1402 | sizeof(struct unallocSpaceEntry)); | 1401 | sizeof(struct unallocSpaceEntry)); |
1403 | if (ret) | 1402 | if (ret) |
1404 | goto out; | 1403 | goto out; |
1405 | memcpy(iinfo->i_ext.i_data, | 1404 | memcpy(iinfo->i_ext.i_data, |
1406 | bh->b_data + sizeof(struct unallocSpaceEntry), | 1405 | bh->b_data + sizeof(struct unallocSpaceEntry), |
1407 | inode->i_sb->s_blocksize - | 1406 | bs - sizeof(struct unallocSpaceEntry)); |
1408 | sizeof(struct unallocSpaceEntry)); | ||
1409 | return 0; | 1407 | return 0; |
1410 | } | 1408 | } |
1411 | 1409 | ||
@@ -1498,8 +1496,7 @@ reread: | |||
1498 | if (iinfo->i_lenAlloc != inode->i_size) | 1496 | if (iinfo->i_lenAlloc != inode->i_size) |
1499 | goto out; | 1497 | goto out; |
1500 | /* File in ICB has to fit in there... */ | 1498 | /* File in ICB has to fit in there... */ |
1501 | if (inode->i_size > inode->i_sb->s_blocksize - | 1499 | if (inode->i_size > bs - udf_file_entry_alloc_offset(inode)) |
1502 | udf_file_entry_alloc_offset(inode)) | ||
1503 | goto out; | 1500 | goto out; |
1504 | } | 1501 | } |
1505 | 1502 | ||