[chao-linux:feature/dax 1/9] fs/f2fs/data.c:1536:35: error: expected ')' before 'goto'

From: kernel test robot
Date: Sun Aug 08 2021 - 13:50:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git feature/dax
head: fe9932d5af4ceade2736e4a3a8c245e05331c392
commit: 100c09383c079477b620703951db64d7faaf5911 [1/9] f2fs: support iomap operation
config: parisc-buildonly-randconfig-r003-20210809 (attached as .config)
compiler: hppa64-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/commit/?id=100c09383c079477b620703951db64d7faaf5911
git remote add chao-linux https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git
git fetch --no-tags chao-linux feature/dax
git checkout 100c09383c079477b620703951db64d7faaf5911
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash fs/f2fs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

fs/f2fs/data.c: In function 'f2fs_map_blocks':
>> fs/f2fs/data.c:1536:35: error: expected ')' before 'goto'
1536 | (map->m_flags & F2FS_MAP_NEW)
| ^
| )
1537 | goto sync_out;
| ~~~~
fs/f2fs/data.c:1535:6: note: to match this '('
1535 | if (flag == F2FS_GET_BLOCK_ZERO &&
| ^
>> fs/f2fs/data.c:1538:2: error: expected expression before '}' token
1538 | } else {
| ^


vim +1536 fs/f2fs/data.c

1439
1440 /*
1441 * f2fs_map_blocks() tries to find or build mapping relationship which
1442 * maps continuous logical blocks to physical blocks, and return such
1443 * info via f2fs_map_blocks structure.
1444 */
1445 int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
1446 int create, int flag)
1447 {
1448 unsigned int maxblocks = map->m_len;
1449 struct dnode_of_data dn;
1450 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
1451 int mode = map->m_may_create ? ALLOC_NODE : LOOKUP_NODE;
1452 pgoff_t pgofs, end_offset, end;
1453 int err = 0, ofs = 1;
1454 unsigned int ofs_in_node, last_ofs_in_node;
1455 blkcnt_t prealloc;
1456 struct extent_info ei = {0, };
1457 block_t blkaddr;
1458 unsigned int start_pgofs;
1459
1460 if (!maxblocks)
1461 return 0;
1462
1463 map->m_len = 0;
1464 map->m_flags = 0;
1465
1466 /* it only supports block size == page size */
1467 pgofs = (pgoff_t)map->m_lblk;
1468 end = pgofs + maxblocks;
1469
1470 if (!create && f2fs_lookup_extent_cache(inode, pgofs, &ei)) {
1471 if (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO &&
1472 map->m_may_create)
1473 goto next_dnode;
1474
1475 map->m_pblk = ei.blk + pgofs - ei.fofs;
1476 map->m_len = min((pgoff_t)maxblocks, ei.fofs + ei.len - pgofs);
1477 map->m_flags = F2FS_MAP_MAPPED;
1478 if (map->m_next_extent)
1479 *map->m_next_extent = pgofs + map->m_len;
1480
1481 /* for hardware encryption, but to avoid potential issue in future */
1482 if (flag == F2FS_GET_BLOCK_DIO)
1483 f2fs_wait_on_block_writeback_range(inode,
1484 map->m_pblk, map->m_len);
1485 goto out;
1486 }
1487
1488 next_dnode:
1489 if (map->m_may_create)
1490 f2fs_do_map_lock(sbi, flag, true);
1491
1492 /* When reading holes, we need its node page */
1493 set_new_dnode(&dn, inode, NULL, NULL, 0);
1494 err = f2fs_get_dnode_of_data(&dn, pgofs, mode);
1495 if (err) {
1496 if (flag == F2FS_GET_BLOCK_BMAP)
1497 map->m_pblk = 0;
1498 if (err == -ENOENT) {
1499 err = 0;
1500 if (map->m_next_pgofs)
1501 *map->m_next_pgofs =
1502 f2fs_get_next_page_offset(&dn, pgofs);
1503 if (map->m_next_extent)
1504 *map->m_next_extent =
1505 f2fs_get_next_page_offset(&dn, pgofs);
1506 }
1507 goto unlock_out;
1508 }
1509
1510 start_pgofs = pgofs;
1511 prealloc = 0;
1512 last_ofs_in_node = ofs_in_node = dn.ofs_in_node;
1513 end_offset = ADDRS_PER_PAGE(dn.node_page, inode);
1514
1515 next_block:
1516 blkaddr = f2fs_data_blkaddr(&dn);
1517
1518 if (__is_valid_data_blkaddr(blkaddr) &&
1519 !f2fs_is_valid_blkaddr(sbi, blkaddr, DATA_GENERIC_ENHANCE)) {
1520 err = -EFSCORRUPTED;
1521 goto sync_out;
1522 }
1523
1524 if (__is_valid_data_blkaddr(blkaddr)) {
1525 /* use out-place-update for driect IO under LFS mode */
1526 if (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO &&
1527 map->m_may_create) {
1528 err = __allocate_data_block(&dn, map->m_seg_type);
1529 if (err)
1530 goto sync_out;
1531 blkaddr = dn.data_blkaddr;
1532 set_inode_flag(inode, FI_APPEND_WRITE);
1533 }
1534
1535 if (flag == F2FS_GET_BLOCK_ZERO &&
> 1536 (map->m_flags & F2FS_MAP_NEW)
1537 goto sync_out;
> 1538 } else {
1539 if (create) {
1540 if (unlikely(f2fs_cp_error(sbi))) {
1541 err = -EIO;
1542 goto sync_out;
1543 }
1544 /*
1545 * If newly allocated blocks are to be zeroed out later,
1546 * a single f2fs_map_blocks must not contain both old
1547 * and new blocks at the same time.
1548 */
1549 if (flag == F2FS_GET_BLOCK_ZERO
1550 && (map->m_flags & F2FS_MAP_MAPPED)
1551 && !(map->m_flags & F2FS_MAP_NEW))
1552 goto sync_out;
1553 if (flag == F2FS_GET_BLOCK_PRE_AIO) {
1554 if (blkaddr == NULL_ADDR) {
1555 prealloc++;
1556 last_ofs_in_node = dn.ofs_in_node;
1557 }
1558 } else {
1559 WARN_ON(flag != F2FS_GET_BLOCK_PRE_DIO &&
1560 flag != F2FS_GET_BLOCK_DIO &&
1561 flag != F2FS_GET_BLOCK_ZERO);
1562 err = __allocate_data_block(&dn,
1563 map->m_seg_type);
1564 if (!err)
1565 set_inode_flag(inode, FI_APPEND_WRITE);
1566 }
1567 if (err)
1568 goto sync_out;
1569 map->m_flags |= F2FS_MAP_NEW;
1570 blkaddr = dn.data_blkaddr;
1571 } else {
1572 if (flag == F2FS_GET_BLOCK_BMAP) {
1573 map->m_pblk = 0;
1574 goto sync_out;
1575 }
1576 if (flag == F2FS_GET_BLOCK_PRECACHE)
1577 goto sync_out;
1578 if (flag == F2FS_GET_BLOCK_FIEMAP &&
1579 blkaddr == NULL_ADDR) {
1580 if (map->m_next_pgofs)
1581 *map->m_next_pgofs = pgofs + 1;
1582 goto sync_out;
1583 }
1584 if (flag != F2FS_GET_BLOCK_FIEMAP) {
1585 /* for defragment case */
1586 if (map->m_next_pgofs)
1587 *map->m_next_pgofs = pgofs + 1;
1588 goto sync_out;
1589 }
1590 }
1591 }
1592
1593 if (flag == F2FS_GET_BLOCK_PRE_AIO)
1594 goto skip;
1595
1596 if (map->m_len == 0) {
1597 /* preallocated unwritten block should be mapped for fiemap. */
1598 if (blkaddr == NEW_ADDR)
1599 map->m_flags |= F2FS_MAP_UNWRITTEN;
1600 map->m_flags |= F2FS_MAP_MAPPED;
1601
1602 map->m_pblk = blkaddr;
1603 map->m_len = 1;
1604 } else if ((map->m_pblk != NEW_ADDR &&
1605 blkaddr == (map->m_pblk + ofs)) ||
1606 (map->m_pblk == NEW_ADDR && blkaddr == NEW_ADDR) ||
1607 flag == F2FS_GET_BLOCK_PRE_DIO) {
1608 ofs++;
1609 map->m_len++;
1610 } else {
1611 goto sync_out;
1612 }
1613
1614 skip:
1615 dn.ofs_in_node++;
1616 pgofs++;
1617
1618 /* preallocate blocks in batch for one dnode page */
1619 if (flag == F2FS_GET_BLOCK_PRE_AIO &&
1620 (pgofs == end || dn.ofs_in_node == end_offset)) {
1621
1622 dn.ofs_in_node = ofs_in_node;
1623 err = f2fs_reserve_new_blocks(&dn, prealloc);
1624 if (err)
1625 goto sync_out;
1626
1627 map->m_len += dn.ofs_in_node - ofs_in_node;
1628 if (prealloc && dn.ofs_in_node != last_ofs_in_node + 1) {
1629 err = -ENOSPC;
1630 goto sync_out;
1631 }
1632 dn.ofs_in_node = end_offset;
1633 }
1634
1635 if (pgofs >= end)
1636 goto sync_out;
1637 else if (dn.ofs_in_node < end_offset)
1638 goto next_block;
1639
1640 if (flag == F2FS_GET_BLOCK_PRECACHE) {
1641 if (map->m_flags & F2FS_MAP_MAPPED) {
1642 unsigned int ofs = start_pgofs - map->m_lblk;
1643
1644 f2fs_update_extent_cache_range(&dn,
1645 start_pgofs, map->m_pblk + ofs,
1646 map->m_len - ofs);
1647 }
1648 }
1649
1650 f2fs_put_dnode(&dn);
1651
1652 if (map->m_may_create) {
1653 f2fs_do_map_lock(sbi, flag, false);
1654 f2fs_balance_fs(sbi, dn.node_changed);
1655 }
1656 goto next_dnode;
1657
1658 sync_out:
1659
1660 /* for hardware encryption, but to avoid potential issue in future */
1661 if (flag == F2FS_GET_BLOCK_DIO && map->m_flags & F2FS_MAP_MAPPED)
1662 f2fs_wait_on_block_writeback_range(inode,
1663 map->m_pblk, map->m_len);
1664
1665 if (flag == F2FS_GET_BLOCK_PRECACHE) {
1666 if (map->m_flags & F2FS_MAP_MAPPED) {
1667 unsigned int ofs = start_pgofs - map->m_lblk;
1668
1669 f2fs_update_extent_cache_range(&dn,
1670 start_pgofs, map->m_pblk + ofs,
1671 map->m_len - ofs);
1672 }
1673 if (map->m_next_extent)
1674 *map->m_next_extent = pgofs + 1;
1675 }
1676
1677 if (flag == F2FS_GET_BLOCK_ZERO && (map->m_flags & F2FS_MAP_NEW)) {
1678 if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode))
1679 err = fscrypt_zeroout_range(inode, map->m_lblk,
1680 map->m_pblk, map->m_len);
1681 else
1682 err = sb_issue_zeroout(inode->i_sb, map->m_pblk,
1683 map->m_len, GFP_NOFS);
1684 }
1685
1686 f2fs_put_dnode(&dn);
1687 unlock_out:
1688 if (map->m_may_create) {
1689 f2fs_do_map_lock(sbi, flag, false);
1690 f2fs_balance_fs(sbi, dn.node_changed);
1691 }
1692 out:
1693 trace_f2fs_map_blocks(inode, map, err);
1694 return err;
1695 }
1696

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip