Skip to contentSkip to conversation

fs/btrfs/volumes.c:5606 find_live_mirror_load() error: uninitialized symbol 'now'.

PATCH New Dan Carpenter 1 participant 1 message Jan 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 82/85 fs/btrfs/volumes.c:5606 find_live_mirror_load() error: uninitialized symbol 'now'.

tree:   https://github.com/kdave/btrfs-devel.git dev/raid-policy
head:   cdf61a56c20bf9881f8cac47eabe3adea5fc23a9
commit: e3953975b6a7b35788f3141689f2745e8200438d [82/85] btrfs: Add load read policy
config: i386-randconfig-m021-20210128 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate

New smatch warnings:
fs/btrfs/volumes.c:5606 find_live_mirror_load() error: uninitialized symbol 'now'.

Old smatch warnings:
fs/btrfs/volumes.c:1235 open_fs_devices() error: we previously assumed 'latest_dev' could be null (see line 1223)

vim +/now +5606 fs/btrfs/volumes.c

e3953975b6a7b3 Michal Rostecki 2021-01-22  5573  static int find_live_mirror_load(struct btrfs_fs_info *fs_info,
e3953975b6a7b3 Michal Rostecki 2021-01-22  5574  				 struct map_lookup *map, int first,
e3953975b6a7b3 Michal Rostecki 2021-01-22  5575  				 int num_stripes)
e3953975b6a7b3 Michal Rostecki 2021-01-22  5576  {
e3953975b6a7b3 Michal Rostecki 2021-01-22  5577  	int preferred_mirror;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5578  	u64 last_sched_time;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5579  	int min_load;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5580  	int cur_load;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5581  	u64 duration;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5582  	u64 now;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5583  	int i;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5584  
e3953975b6a7b3 Michal Rostecki 2021-01-22  5585  	last_sched_time = this_cpu_read(*fs_info->last_sched_time);
e3953975b6a7b3 Michal Rostecki 2021-01-22  5586  	if (last_sched_time != 0) {
e3953975b6a7b3 Michal Rostecki 2021-01-22  5587  		now = ktime_get_ns();
e3953975b6a7b3 Michal Rostecki 2021-01-22  5588  		duration = now - last_sched_time;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5589  
e3953975b6a7b3 Michal Rostecki 2021-01-22  5590  		if (duration < (NSEC_PER_MSEC *
e3953975b6a7b3 Michal Rostecki 2021-01-22  5591  				fs_info->fs_devices->read_policy_load_duration))
e3953975b6a7b3 Michal Rostecki 2021-01-22  5592  			return this_cpu_read(*fs_info->last_mirror);
e3953975b6a7b3 Michal Rostecki 2021-01-22  5593  	}

now not initialized on else path.

e3953975b6a7b3 Michal Rostecki 2021-01-22  5594  
e3953975b6a7b3 Michal Rostecki 2021-01-22  5595  	preferred_mirror = first;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5596  	min_load = INT_MAX;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5597  
e3953975b6a7b3 Michal Rostecki 2021-01-22  5598  	for (i = first; i < first + num_stripes; i++) {
e3953975b6a7b3 Michal Rostecki 2021-01-22  5599  		cur_load = mirror_load(fs_info, &map->stripes[i]);
e3953975b6a7b3 Michal Rostecki 2021-01-22  5600  		if (cur_load < min_load) {
e3953975b6a7b3 Michal Rostecki 2021-01-22  5601  			preferred_mirror = i;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5602  			min_load = cur_load;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5603  		}
e3953975b6a7b3 Michal Rostecki 2021-01-22  5604  	}
e3953975b6a7b3 Michal Rostecki 2021-01-22  5605  
e3953975b6a7b3 Michal Rostecki 2021-01-22 @5606  	this_cpu_write(*fs_info->last_sched_time, now);
e3953975b6a7b3 Michal Rostecki 2021-01-22  5607  	this_cpu_write(*fs_info->last_mirror, preferred_mirror);
e3953975b6a7b3 Michal Rostecki 2021-01-22  5608  	return preferred_mirror;
e3953975b6a7b3 Michal Rostecki 2021-01-22  5609  }

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