Commit f4145654aaf67821fadf0081950a2ab5fa19163f
Committed by
Greg Kroah-Hartman
1 parent
09f2e748e0
udf: Remove repeated loads blocksize
commit 79144954278d4bb5989f8b903adcac7a20ff2a5a upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 8 additions and 11 deletions Side-by-side Diff
fs/udf/inode.c
... | ... | @@ -1288,6 +1288,7 @@ |
1288 | 1288 | struct kernel_lb_addr *iloc = &iinfo->i_location; |
1289 | 1289 | unsigned int link_count; |
1290 | 1290 | unsigned int indirections = 0; |
1291 | + int bs = inode->i_sb->s_blocksize; | |
1291 | 1292 | int ret = -EIO; |
1292 | 1293 | |
1293 | 1294 | reread: |
1294 | 1295 | |
1295 | 1296 | |
1296 | 1297 | |
1297 | 1298 | |
1298 | 1299 | |
... | ... | @@ -1374,38 +1375,35 @@ |
1374 | 1375 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { |
1375 | 1376 | iinfo->i_efe = 1; |
1376 | 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 | 1379 | sizeof(struct extendedFileEntry)); |
1379 | 1380 | if (ret) |
1380 | 1381 | goto out; |
1381 | 1382 | memcpy(iinfo->i_ext.i_data, |
1382 | 1383 | bh->b_data + sizeof(struct extendedFileEntry), |
1383 | - inode->i_sb->s_blocksize - | |
1384 | - sizeof(struct extendedFileEntry)); | |
1384 | + bs - sizeof(struct extendedFileEntry)); | |
1385 | 1385 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { |
1386 | 1386 | iinfo->i_efe = 0; |
1387 | 1387 | iinfo->i_use = 0; |
1388 | - ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | |
1389 | - sizeof(struct fileEntry)); | |
1388 | + ret = udf_alloc_i_data(inode, bs - sizeof(struct fileEntry)); | |
1390 | 1389 | if (ret) |
1391 | 1390 | goto out; |
1392 | 1391 | memcpy(iinfo->i_ext.i_data, |
1393 | 1392 | bh->b_data + sizeof(struct fileEntry), |
1394 | - inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | |
1393 | + bs - sizeof(struct fileEntry)); | |
1395 | 1394 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { |
1396 | 1395 | iinfo->i_efe = 0; |
1397 | 1396 | iinfo->i_use = 1; |
1398 | 1397 | iinfo->i_lenAlloc = le32_to_cpu( |
1399 | 1398 | ((struct unallocSpaceEntry *)bh->b_data)-> |
1400 | 1399 | lengthAllocDescs); |
1401 | - ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | |
1400 | + ret = udf_alloc_i_data(inode, bs - | |
1402 | 1401 | sizeof(struct unallocSpaceEntry)); |
1403 | 1402 | if (ret) |
1404 | 1403 | goto out; |
1405 | 1404 | memcpy(iinfo->i_ext.i_data, |
1406 | 1405 | bh->b_data + sizeof(struct unallocSpaceEntry), |
1407 | - inode->i_sb->s_blocksize - | |
1408 | - sizeof(struct unallocSpaceEntry)); | |
1406 | + bs - sizeof(struct unallocSpaceEntry)); | |
1409 | 1407 | return 0; |
1410 | 1408 | } |
1411 | 1409 | |
... | ... | @@ -1498,8 +1496,7 @@ |
1498 | 1496 | if (iinfo->i_lenAlloc != inode->i_size) |
1499 | 1497 | goto out; |
1500 | 1498 | /* File in ICB has to fit in there... */ |
1501 | - if (inode->i_size > inode->i_sb->s_blocksize - | |
1502 | - udf_file_entry_alloc_offset(inode)) | |
1499 | + if (inode->i_size > bs - udf_file_entry_alloc_offset(inode)) | |
1503 | 1500 | goto out; |
1504 | 1501 | } |
1505 | 1502 |