aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-08-29 15:43:11 -0400
committerTheodore Ts'o <tytso@mit.edu>2016-08-29 15:43:11 -0400
commit6e0cd088c01023c02b1e887e02c8b6f3f395344f (patch)
tree7834e571ec515cfe8579e51c69cf57384290132f /fs/ext4
parent3f2571c1f91f2de729562344b4956786a2c74d73 (diff)
ext4: remove (almost) unused variables from ext4_expand_extra_isize_ea()
'start' variable is completely unused in ext4_expand_extra_isize_ea(). Variable 'first' is used only once in one place. So just remove them. Variables 'entry' and 'last' are only really used later in the function inside a loop. Move their declarations there. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/xattr.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 8f582ae1032d..2ef687620205 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1425,12 +1425,11 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
1425 struct ext4_inode *raw_inode, handle_t *handle) 1425 struct ext4_inode *raw_inode, handle_t *handle)
1426{ 1426{
1427 struct ext4_xattr_ibody_header *header; 1427 struct ext4_xattr_ibody_header *header;
1428 struct ext4_xattr_entry *entry, *last, *first;
1429 struct buffer_head *bh = NULL; 1428 struct buffer_head *bh = NULL;
1430 size_t min_offs; 1429 size_t min_offs;
1431 size_t ifree, bfree; 1430 size_t ifree, bfree;
1432 int total_ino; 1431 int total_ino;
1433 void *base, *start, *end; 1432 void *base, *end;
1434 int error = 0, tried_min_extra_isize = 0; 1433 int error = 0, tried_min_extra_isize = 0;
1435 int s_min_extra_isize = le16_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_min_extra_isize); 1434 int s_min_extra_isize = le16_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_min_extra_isize);
1436 int isize_diff; /* How much do we need to grow i_extra_isize */ 1435 int isize_diff; /* How much do we need to grow i_extra_isize */
@@ -1446,24 +1445,22 @@ retry:
1446 goto out; 1445 goto out;
1447 1446
1448 header = IHDR(inode, raw_inode); 1447 header = IHDR(inode, raw_inode);
1449 entry = IFIRST(header);
1450 1448
1451 /* 1449 /*
1452 * Check if enough free space is available in the inode to shift the 1450 * Check if enough free space is available in the inode to shift the
1453 * entries ahead by new_extra_isize. 1451 * entries ahead by new_extra_isize.
1454 */ 1452 */
1455 1453
1456 base = start = entry; 1454 base = IFIRST(header);
1457 end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; 1455 end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
1458 min_offs = end - base; 1456 min_offs = end - base;
1459 last = entry;
1460 total_ino = sizeof(struct ext4_xattr_ibody_header); 1457 total_ino = sizeof(struct ext4_xattr_ibody_header);
1461 1458
1462 error = xattr_check_inode(inode, header, end); 1459 error = xattr_check_inode(inode, header, end);
1463 if (error) 1460 if (error)
1464 goto cleanup; 1461 goto cleanup;
1465 1462
1466 ifree = ext4_xattr_free_space(last, &min_offs, base, &total_ino); 1463 ifree = ext4_xattr_free_space(base, &min_offs, base, &total_ino);
1467 if (ifree >= isize_diff) 1464 if (ifree >= isize_diff)
1468 goto shift; 1465 goto shift;
1469 1466
@@ -1483,10 +1480,10 @@ retry:
1483 goto cleanup; 1480 goto cleanup;
1484 } 1481 }
1485 base = BHDR(bh); 1482 base = BHDR(bh);
1486 first = BFIRST(bh);
1487 end = bh->b_data + bh->b_size; 1483 end = bh->b_data + bh->b_size;
1488 min_offs = end - base; 1484 min_offs = end - base;
1489 bfree = ext4_xattr_free_space(first, &min_offs, base, NULL); 1485 bfree = ext4_xattr_free_space(BFIRST(bh), &min_offs, base,
1486 NULL);
1490 if (bfree + ifree < isize_diff) { 1487 if (bfree + ifree < isize_diff) {
1491 if (!tried_min_extra_isize && s_min_extra_isize) { 1488 if (!tried_min_extra_isize && s_min_extra_isize) {
1492 tried_min_extra_isize++; 1489 tried_min_extra_isize++;
@@ -1502,14 +1499,14 @@ retry:
1502 } 1499 }
1503 1500
1504 while (isize_diff > ifree) { 1501 while (isize_diff > ifree) {
1505 struct ext4_xattr_entry *small_entry = NULL; 1502 struct ext4_xattr_entry *small_entry = NULL, *entry = NULL;
1503 struct ext4_xattr_entry *last;
1506 unsigned int entry_size; /* EA entry size */ 1504 unsigned int entry_size; /* EA entry size */
1507 unsigned int total_size; /* EA entry size + value size */ 1505 unsigned int total_size; /* EA entry size + value size */
1508 unsigned int min_total_size = ~0U; 1506 unsigned int min_total_size = ~0U;
1509 1507
1510 last = IFIRST(header); 1508 last = IFIRST(header);
1511 /* Find the entry best suited to be pushed into EA block */ 1509 /* Find the entry best suited to be pushed into EA block */
1512 entry = NULL;
1513 for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) { 1510 for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
1514 total_size = 1511 total_size =
1515 EXT4_XATTR_SIZE(le32_to_cpu(last->e_value_size)) + 1512 EXT4_XATTR_SIZE(le32_to_cpu(last->e_value_size)) +
@@ -1556,8 +1553,7 @@ retry:
1556 1553
1557shift: 1554shift:
1558 /* Adjust the offsets and shift the remaining entries ahead */ 1555 /* Adjust the offsets and shift the remaining entries ahead */
1559 entry = IFIRST(header); 1556 ext4_xattr_shift_entries(IFIRST(header), EXT4_I(inode)->i_extra_isize
1560 ext4_xattr_shift_entries(entry, EXT4_I(inode)->i_extra_isize
1561 - new_extra_isize, (void *)raw_inode + 1557 - new_extra_isize, (void *)raw_inode +
1562 EXT4_GOOD_OLD_INODE_SIZE + new_extra_isize, 1558 EXT4_GOOD_OLD_INODE_SIZE + new_extra_isize,
1563 (void *)header, total_ino); 1559 (void *)header, total_ino);