CC: [email protected]
TO: Michal Rostecki <[email protected]>
CC: David Sterba <[email protected]>

tree:   https://github.com/kdave/btrfs-devel.git dev/raid-policy
head:   cdf61a56c20bf9881f8cac47eabe3adea5fc23a9
commit: 4535566286913fb8ad62c3efef00e6d2593b25e4 [83/85] btrfs: Add roundrobin 
read policy
:::::: branch date: 7 hours ago
:::::: commit date: 8 hours ago
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
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

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

Old smatch warnings:
fs/btrfs/volumes.c:1238 open_fs_devices() error: we previously assumed 
'latest_dev' could be null (see line 1226)
fs/btrfs/volumes.h:215 btrfs_device_set_total_bytes() warn: statement has no 
effect 31
fs/btrfs/volumes.h:216 btrfs_device_set_disk_total_bytes() warn: statement has 
no effect 31
fs/btrfs/volumes.h:217 btrfs_device_set_bytes_used() warn: statement has no 
effect 31
fs/btrfs/volumes.c:5609 find_live_mirror_load() error: uninitialized symbol 
'now'.

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

4535566286913f Michal Rostecki 2021-01-12  5712  
4535566286913f Michal Rostecki 2021-01-12  5713  /*
4535566286913f Michal Rostecki 2021-01-12  5714   * 
find_live_mirror_roundrobin() searches for a raid1 mirror which can process
4535566286913f Michal Rostecki 2021-01-12  5715   * more requests.
4535566286913f Michal Rostecki 2021-01-12  5716   *
4535566286913f Michal Rostecki 2021-01-12  5717   * @fs_info:     the filesystem
4535566286913f Michal Rostecki 2021-01-12  5718   * @map:         extent 
mapping which contains stripes
4535566286913f Michal Rostecki 2021-01-12  5719   * @first:       number of the 
first mirror
4535566286913f Michal Rostecki 2021-01-12  5720   * @num_stripes: number of 
stripes in the array
4535566286913f Michal Rostecki 2021-01-12  5721   *
4535566286913f Michal Rostecki 2021-01-12  5722   * It calls 
__find_live_mirror_roundrobin() function to try to find a suitable
4535566286913f Michal Rostecki 2021-01-12  5723   * mirror, firstly 
non-rotational, then rotational.
4535566286913f Michal Rostecki 2021-01-12  5724   *
4535566286913f Michal Rostecki 2021-01-12  5725   * If no suitable mirror 
found, it selects the next (last used + 1) mirror.
4535566286913f Michal Rostecki 2021-01-12  5726   */
4535566286913f Michal Rostecki 2021-01-12  5727  static int 
find_live_mirror_roundrobin(struct btrfs_fs_info *fs_info,
4535566286913f Michal Rostecki 2021-01-12  5728                                 
       struct map_lookup *map, int first,
4535566286913f Michal Rostecki 2021-01-12  5729                                 
       int num_stripes)
4535566286913f Michal Rostecki 2021-01-12  5730  {
4535566286913f Michal Rostecki 2021-01-12  5731         int preferred_mirror;
4535566286913f Michal Rostecki 2021-01-12  5732         int rotational_first;
4535566286913f Michal Rostecki 2021-01-12  5733         u64 last_sched_time;
4535566286913f Michal Rostecki 2021-01-12  5734         u64 duration;
4535566286913f Michal Rostecki 2021-01-12  5735         int limit;
4535566286913f Michal Rostecki 2021-01-12  5736         u64 now;
4535566286913f Michal Rostecki 2021-01-12  5737  
4535566286913f Michal Rostecki 2021-01-12  5738         last_sched_time = 
this_cpu_read(*fs_info->last_sched_time);
4535566286913f Michal Rostecki 2021-01-12  5739         if (last_sched_time != 
0) {
4535566286913f Michal Rostecki 2021-01-12  5740                 now = 
ktime_get_ns();
4535566286913f Michal Rostecki 2021-01-12  5741                 duration = now 
- last_sched_time;
4535566286913f Michal Rostecki 2021-01-12  5742  
4535566286913f Michal Rostecki 2021-01-12  5743                 if (duration < 
(NSEC_PER_MSEC *
4535566286913f Michal Rostecki 2021-01-12  5744                                 
fs_info->fs_devices->read_policy_roundrobin_duration)) {
4535566286913f Michal Rostecki 2021-01-12  5745                         
preferred_mirror = this_cpu_read(*fs_info->last_mirror);
4535566286913f Michal Rostecki 2021-01-12  5746                         goto 
out;
4535566286913f Michal Rostecki 2021-01-12  5747                 }
4535566286913f Michal Rostecki 2021-01-12  5748         }
4535566286913f Michal Rostecki 2021-01-12  5749  
4535566286913f Michal Rostecki 2021-01-12  5750         limit = first + 
num_stripes;
4535566286913f Michal Rostecki 2021-01-12  5751  
4535566286913f Michal Rostecki 2021-01-12  5752         /* Try to find 
non-rotational mirror */
4535566286913f Michal Rostecki 2021-01-12  5753         
__find_live_mirror_roundrobin_nonrot(fs_info, map, first, limit,
4535566286913f Michal Rostecki 2021-01-12  5754                                 
             &preferred_mirror,
4535566286913f Michal Rostecki 2021-01-12  5755                                 
             &rotational_first);
4535566286913f Michal Rostecki 2021-01-12  5756         if (preferred_mirror >= 
0)
4535566286913f Michal Rostecki 2021-01-12  5757                 goto out;
4535566286913f Michal Rostecki 2021-01-12  5758  
4535566286913f Michal Rostecki 2021-01-12  5759         /* Try to find 
rotational mirror if any available */
4535566286913f Michal Rostecki 2021-01-12  5760         if (rotational_first >= 
0) {
4535566286913f Michal Rostecki 2021-01-12  5761                 
preferred_mirror = __find_live_mirror_roundrobin_rot(
4535566286913f Michal Rostecki 2021-01-12  5762                         
fs_info, map, first, num_stripes);
4535566286913f Michal Rostecki 2021-01-12  5763                 if 
(preferred_mirror >= 0)
4535566286913f Michal Rostecki 2021-01-12  5764                         goto 
out;
4535566286913f Michal Rostecki 2021-01-12  5765         }
4535566286913f Michal Rostecki 2021-01-12  5766  
4535566286913f Michal Rostecki 2021-01-12  5767         /* If no suitable 
mirror found, return the next mirror */
4535566286913f Michal Rostecki 2021-01-12  5768         preferred_mirror = (
4535566286913f Michal Rostecki 2021-01-12  5769                 
this_cpu_read(*fs_info->last_mirror) + 1) % num_stripes;
4535566286913f Michal Rostecki 2021-01-12  5770  
4535566286913f Michal Rostecki 2021-01-12  5771  out:
4535566286913f Michal Rostecki 2021-01-12 @5772         
this_cpu_write(*fs_info->last_sched_time, now);
4535566286913f Michal Rostecki 2021-01-12  5773         
this_cpu_write(*fs_info->last_mirror, preferred_mirror);
4535566286913f Michal Rostecki 2021-01-12  5774         return preferred_mirror;
4535566286913f Michal Rostecki 2021-01-12  5775  }
4535566286913f Michal Rostecki 2021-01-12  5776  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to