All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-review:UPDATE-20200405-035226/Sahitya-Tummala/f2fs-prevent-meta-updates-while-checkpoint-is-in-progress/20200327-044221 1/1] fs/f2fs/gc.c:1416:7: error: 'gc_mode' undeclared
@ 2020-04-04 22:27 kbuild test robot
  0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2020-04-04 22:27 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9104 bytes --]

tree:   https://github.com/0day-ci/linux/commits/UPDATE-20200405-035226/Sahitya-Tummala/f2fs-prevent-meta-updates-while-checkpoint-is-in-progress/20200327-044221
head:   dadde12a6469421c025620a70301e970f36e1679
commit: dadde12a6469421c025620a70301e970f36e1679 [1/1] f2fs: prevent meta updates while checkpoint is in progress
config: openrisc-randconfig-a001-20200405 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout dadde12a6469421c025620a70301e970f36e1679
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=openrisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   fs/f2fs/gc.c: In function 'free_segment_range':
>> fs/f2fs/gc.c:1416:7: error: 'gc_mode' undeclared (first use in this function)
    1416 |  for (gc_mode = 0; gc_mode < MAX_GC_POLICY; gc_mode++)
         |       ^~~~~~~
   fs/f2fs/gc.c:1416:7: note: each undeclared identifier is reported only once for each function it appears in
>> fs/f2fs/gc.c:1420:7: error: 'gc_type' undeclared (first use in this function); did you mean 'cftype'?
    1420 |  for (gc_type = BG_GC; gc_type <= FG_GC; gc_type++)
         |       ^~~~~~~
         |       cftype
   fs/f2fs/gc.c: In function 'f2fs_resize_fs':
>> fs/f2fs/gc.c:1590:44: error: expected ';' before ':' token
    1590 |  err = free_segment_range(sbi, secs, false):
         |                                            ^
         |                                            ;
   fs/f2fs/gc.c:1528:15: warning: unused variable 'gc_type' [-Wunused-variable]
    1528 |  int gc_mode, gc_type;
         |               ^~~~~~~
   fs/f2fs/gc.c:1528:6: warning: unused variable 'gc_mode' [-Wunused-variable]
    1528 |  int gc_mode, gc_type;
         |      ^~~~~~~

vim +/gc_mode +1416 fs/f2fs/gc.c

  1401	
  1402	static int free_segment_range(struct f2fs_sb_info *sbi,
  1403					unsigned int secs, bool gc_only)
  1404	{
  1405		unsigned int segno, next_inuse, start, end;
  1406		struct cp_control cpc = { CP_RESIZE, 0, 0, 0 };
  1407		int err = 0;
  1408		int type;
  1409	
  1410		/* Force block allocation for GC */
  1411		MAIN_SECS(sbi) -= secs;
  1412		start = MAIN_SECS(sbi) * sbi->segs_per_sec;
  1413		end = MAIN_SEGS(sbi) - 1;
  1414	
  1415		mutex_lock(&DIRTY_I(sbi)->seglist_lock);
> 1416		for (gc_mode = 0; gc_mode < MAX_GC_POLICY; gc_mode++)
  1417			if (SIT_I(sbi)->last_victim[gc_mode] >= start)
  1418				SIT_I(sbi)->last_victim[gc_mode] = 0;
  1419	
> 1420		for (gc_type = BG_GC; gc_type <= FG_GC; gc_type++)
  1421			if (sbi->next_victim_seg[gc_type] >= start)
  1422				sbi->next_victim_seg[gc_type] = NULL_SEGNO;
  1423		mutex_unlock(&DIRTY_I(sbi)->seglist_lock);
  1424	
  1425		/* Move out cursegs from the target range */
  1426		for (type = CURSEG_HOT_DATA; type < NR_CURSEG_TYPE; type++)
  1427			allocate_segment_for_resize(sbi, type, start, end);
  1428	
  1429		/* do GC to move out valid blocks in the range */
  1430		for (segno = start; segno <= end; segno += sbi->segs_per_sec) {
  1431			struct gc_inode_list gc_list = {
  1432				.ilist = LIST_HEAD_INIT(gc_list.ilist),
  1433				.iroot = RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS),
  1434			};
  1435	
  1436			do_garbage_collect(sbi, segno, &gc_list, FG_GC);
  1437			put_gc_inode(&gc_list);
  1438	
  1439			if (!gc_only && get_valid_blocks(sbi, segno, true)) {
  1440				err = -EAGAIN;
  1441				goto out;
  1442			}
  1443		}
  1444		if (gc_only)
  1445			goto out;
  1446	
  1447		err = f2fs_write_checkpoint(sbi, &cpc);
  1448		if (err)
  1449			goto out;
  1450	
  1451		next_inuse = find_next_inuse(FREE_I(sbi), end + 1, start);
  1452		if (next_inuse <= end) {
  1453			f2fs_err(sbi, "segno %u should be free but still inuse!",
  1454				 next_inuse);
  1455			f2fs_bug_on(sbi, 1);
  1456		}
  1457	out:
  1458		MAIN_SECS(sbi) -= secs;
  1459		return err;
  1460	}
  1461	
  1462	static void update_sb_metadata(struct f2fs_sb_info *sbi, int secs)
  1463	{
  1464		struct f2fs_super_block *raw_sb = F2FS_RAW_SUPER(sbi);
  1465		int section_count;
  1466		int segment_count;
  1467		int segment_count_main;
  1468		long long block_count;
  1469		int segs = secs * sbi->segs_per_sec;
  1470	
  1471		down_write(&sbi->sb_lock);
  1472	
  1473		section_count = le32_to_cpu(raw_sb->section_count);
  1474		segment_count = le32_to_cpu(raw_sb->segment_count);
  1475		segment_count_main = le32_to_cpu(raw_sb->segment_count_main);
  1476		block_count = le64_to_cpu(raw_sb->block_count);
  1477	
  1478		raw_sb->section_count = cpu_to_le32(section_count + secs);
  1479		raw_sb->segment_count = cpu_to_le32(segment_count + segs);
  1480		raw_sb->segment_count_main = cpu_to_le32(segment_count_main + segs);
  1481		raw_sb->block_count = cpu_to_le64(block_count +
  1482						(long long)segs * sbi->blocks_per_seg);
  1483		if (f2fs_is_multi_device(sbi)) {
  1484			int last_dev = sbi->s_ndevs - 1;
  1485			int dev_segs =
  1486				le32_to_cpu(raw_sb->devs[last_dev].total_segments);
  1487	
  1488			raw_sb->devs[last_dev].total_segments =
  1489							cpu_to_le32(dev_segs + segs);
  1490		}
  1491	
  1492		up_write(&sbi->sb_lock);
  1493	}
  1494	
  1495	static void update_fs_metadata(struct f2fs_sb_info *sbi, int secs)
  1496	{
  1497		int segs = secs * sbi->segs_per_sec;
  1498		long long blks = (long long)segs * sbi->blocks_per_seg;
  1499		long long user_block_count =
  1500					le64_to_cpu(F2FS_CKPT(sbi)->user_block_count);
  1501	
  1502		SM_I(sbi)->segment_count = (int)SM_I(sbi)->segment_count + segs;
  1503		MAIN_SEGS(sbi) = (int)MAIN_SEGS(sbi) + segs;
  1504		MAIN_SECS(sbi) += secs;
  1505		FREE_I(sbi)->free_sections = (int)FREE_I(sbi)->free_sections + secs;
  1506		FREE_I(sbi)->free_segments = (int)FREE_I(sbi)->free_segments + segs;
  1507		F2FS_CKPT(sbi)->user_block_count = cpu_to_le64(user_block_count + blks);
  1508	
  1509		if (f2fs_is_multi_device(sbi)) {
  1510			int last_dev = sbi->s_ndevs - 1;
  1511	
  1512			FDEV(last_dev).total_segments =
  1513					(int)FDEV(last_dev).total_segments + segs;
  1514			FDEV(last_dev).end_blk =
  1515					(long long)FDEV(last_dev).end_blk + blks;
  1516	#ifdef CONFIG_BLK_DEV_ZONED
  1517			FDEV(last_dev).nr_blkz = (int)FDEV(last_dev).nr_blkz +
  1518						(int)(blks >> sbi->log_blocks_per_blkz);
  1519	#endif
  1520		}
  1521	}
  1522	
  1523	int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count)
  1524	{
  1525		__u64 old_block_count, shrunk_blocks;
  1526		struct cp_control cpc = { CP_RESIZE, 0, 0, 0 };
  1527		unsigned int secs;
  1528		int gc_mode, gc_type;
  1529		int err = 0;
  1530		__u32 rem;
  1531	
  1532		old_block_count = le64_to_cpu(F2FS_RAW_SUPER(sbi)->block_count);
  1533		if (block_count > old_block_count)
  1534			return -EINVAL;
  1535	
  1536		if (f2fs_is_multi_device(sbi)) {
  1537			int last_dev = sbi->s_ndevs - 1;
  1538			__u64 last_segs = FDEV(last_dev).total_segments;
  1539	
  1540			if (block_count + last_segs * sbi->blocks_per_seg <=
  1541									old_block_count)
  1542				return -EINVAL;
  1543		}
  1544	
  1545		/* new fs size should align to section size */
  1546		div_u64_rem(block_count, BLKS_PER_SEC(sbi), &rem);
  1547		if (rem)
  1548			return -EINVAL;
  1549	
  1550		if (block_count == old_block_count)
  1551			return 0;
  1552	
  1553		if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) {
  1554			f2fs_err(sbi, "Should run fsck to repair first.");
  1555			return -EFSCORRUPTED;
  1556		}
  1557	
  1558		if (test_opt(sbi, DISABLE_CHECKPOINT)) {
  1559			f2fs_err(sbi, "Checkpoint should be enabled.");
  1560			return -EINVAL;
  1561		}
  1562	
  1563		shrunk_blocks = old_block_count - block_count;
  1564		secs = div_u64(shrunk_blocks, BLKS_PER_SEC(sbi));
  1565	
  1566		/* protect MAIN_SEC in free_segment_range */
  1567		f2fs_lock_op(sbi);
  1568		err = free_segment_range(sbi, secs, true);
  1569		f2fs_unlock_op(sbi);
  1570		if (err)
  1571			return err;
  1572	
  1573		set_sbi_flag(sbi, SBI_IS_RESIZEFS);
  1574	
  1575		freeze_super(sbi->sb);
  1576		down_write(&sbi->gc_lock);
  1577		mutex_lock(&sbi->cp_mutex);
  1578	
  1579		spin_lock(&sbi->stat_lock);
  1580		if (shrunk_blocks + valid_user_blocks(sbi) +
  1581			sbi->current_reserved_blocks + sbi->unusable_block_count +
  1582			F2FS_OPTION(sbi).root_reserved_blocks > sbi->user_block_count)
  1583			err = -ENOSPC;
  1584		else
  1585			sbi->user_block_count -= shrunk_blocks;
  1586		spin_unlock(&sbi->stat_lock);
  1587		if (err)
  1588			goto out_err;
  1589	
> 1590		err = free_segment_range(sbi, secs, false):

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 21947 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-04 22:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 22:27 [linux-review:UPDATE-20200405-035226/Sahitya-Tummala/f2fs-prevent-meta-updates-while-checkpoint-is-in-progress/20200327-044221 1/1] fs/f2fs/gc.c:1416:7: error: 'gc_mode' undeclared kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.