CC: [email protected]
TO: Julia Lawall <[email protected]>
CC: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git 
sched/core
head:   99bc28db7c97f74928f3a85a4729ed12bea0c341
commit: 99bc28db7c97f74928f3a85a4729ed12bea0c341 [31/31] sched/fair: Check for 
idle core in wake_affine
:::::: branch date: 22 hours ago
:::::: commit date: 22 hours ago
config: h8300-randconfig-m031-20201026 (attached as .config)
compiler: h8300-linux-gcc (GCC) 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/xfs/libxfs/xfs_bmap.c:4905 xfs_bmap_del_extent_delay() warn: Function too 
hairy.  No more merges.

Old smatch warnings:
fs/xfs/libxfs/xfs_bmap.c:372 xfs_bmap_check_leaf_extents() error: we previously 
assumed 'bp' could be null (see line 364)
fs/xfs/libxfs/xfs_bmap.c:1880 xfs_bmap_add_extent_delay_real() warn: Function 
too hairy.  No more merges.
fs/xfs/libxfs/xfs_bmap.c:3672 xfs_bmap_btalloc() warn: Function too hairy.  No 
more merges.
fs/xfs/libxfs/xfs_bmap.c:6132 __xfs_bmap_add() error: potential null 
dereference 'bi'.  (kmem_alloc returns null)

vim +4905 fs/xfs/libxfs/xfs_bmap.c

a9bd24ac2becf69 Brian Foster      2016-03-15  4786  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4787  int
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4788  xfs_bmap_del_extent_delay(
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4789      struct xfs_inode        
*ip,
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4790      int                     
whichfork,
b2b1712a640824e Christoph Hellwig 2017-11-03  4791      struct xfs_iext_cursor  
*icur,
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4792      struct xfs_bmbt_irec    
*got,
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4793      struct xfs_bmbt_irec    
*del)
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4794  {
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4795      struct xfs_mount        
*mp = ip->i_mount;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4796      struct xfs_ifork        
*ifp = XFS_IFORK_PTR(ip, whichfork);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4797      struct xfs_bmbt_irec    
new;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4798      int64_t                 
da_old, da_new, da_diff = 0;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4799      xfs_fileoff_t           
del_endoff, got_endoff;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4800      xfs_filblks_t           
got_indlen, new_indlen, stolen;
060ea65b39409f3 Christoph Hellwig 2017-10-19  4801      int                     
state = xfs_bmap_fork_to_state(whichfork);
060ea65b39409f3 Christoph Hellwig 2017-10-19  4802      int                     
error = 0;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4803      bool                    
isrt;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4804  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4805      XFS_STATS_INC(mp, 
xs_del_exlist);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4806  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4807      isrt = (whichfork == 
XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4808      del_endoff = 
del->br_startoff + del->br_blockcount;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4809      got_endoff = 
got->br_startoff + got->br_blockcount;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4810      da_old = 
startblockval(got->br_startblock);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4811      da_new = 0;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4812  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4813      
ASSERT(del->br_blockcount > 0);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4814      ASSERT(got->br_startoff 
<= del->br_startoff);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4815      ASSERT(got_endoff >= 
del_endoff);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4816  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4817      if (isrt) {
4f1adf3373f0722 Eric Sandeen      2017-04-19  4818              uint64_t rtexts 
= XFS_FSB_TO_B(mp, del->br_blockcount);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4819  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4820              do_div(rtexts, 
mp->m_sb.sb_rextsize);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4821              
xfs_mod_frextents(mp, rtexts);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4822      }
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4823  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4824      /*
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4825       * Update the inode 
delalloc counter now and wait to update the
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4826       * sb counters as we 
might have to borrow some blocks for the
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4827       * indirect block 
accounting.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4828       */
4fd29ec47212c8c Darrick J. Wong   2016-11-08  4829      error = 
xfs_trans_reserve_quota_nblks(NULL, ip,
4fd29ec47212c8c Darrick J. Wong   2016-11-08  4830                      
-((long)del->br_blockcount), 0,
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4831                      isrt ? 
XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS);
4fd29ec47212c8c Darrick J. Wong   2016-11-08  4832      if (error)
4fd29ec47212c8c Darrick J. Wong   2016-11-08  4833              return error;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4834      ip->i_delayed_blks -= 
del->br_blockcount;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4835  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4836      if (got->br_startoff == 
del->br_startoff)
0173c689ff4c085 Christoph Hellwig 2017-10-17  4837              state |= 
BMAP_LEFT_FILLING;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4838      if (got_endoff == 
del_endoff)
0173c689ff4c085 Christoph Hellwig 2017-10-17  4839              state |= 
BMAP_RIGHT_FILLING;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4840  
0173c689ff4c085 Christoph Hellwig 2017-10-17  4841      switch (state & 
(BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING)) {
0173c689ff4c085 Christoph Hellwig 2017-10-17  4842      case BMAP_LEFT_FILLING 
| BMAP_RIGHT_FILLING:
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4843              /*
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4844               * Matches the 
whole extent.  Delete the entry.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4845               */
c38ccf599022e74 Christoph Hellwig 2017-11-03  4846              
xfs_iext_remove(ip, icur, state);
b2b1712a640824e Christoph Hellwig 2017-11-03  4847              
xfs_iext_prev(ifp, icur);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4848              break;
0173c689ff4c085 Christoph Hellwig 2017-10-17  4849      case BMAP_LEFT_FILLING:
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4850              /*
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4851               * Deleting the 
first part of the extent.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4852               */
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4853              
got->br_startoff = del_endoff;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4854              
got->br_blockcount -= del->br_blockcount;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4855              da_new = 
XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip,
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4856                              
got->br_blockcount), da_old);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4857              
got->br_startblock = nullstartblock((int)da_new);
b2b1712a640824e Christoph Hellwig 2017-11-03  4858              
xfs_iext_update_extent(ip, state, icur, got);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4859              break;
0173c689ff4c085 Christoph Hellwig 2017-10-17  4860      case BMAP_RIGHT_FILLING:
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4861              /*
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4862               * Deleting the 
last part of the extent.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4863               */
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4864              
got->br_blockcount = got->br_blockcount - del->br_blockcount;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4865              da_new = 
XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip,
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4866                              
got->br_blockcount), da_old);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4867              
got->br_startblock = nullstartblock((int)da_new);
b2b1712a640824e Christoph Hellwig 2017-11-03  4868              
xfs_iext_update_extent(ip, state, icur, got);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4869              break;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4870      case 0:
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4871              /*
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4872               * Deleting the 
middle of the extent.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4873               *
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4874               * Distribute 
the original indlen reservation across the two new
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4875               * extents.  
Steal blocks from the deleted extent if necessary.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4876               * Stealing 
blocks simply fudges the fdblocks accounting below.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4877               * Warn if 
either of the new indlen reservations is zero as this
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4878               * can lead to 
delalloc problems.
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4879               */
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4880              
got->br_blockcount = del->br_startoff - got->br_startoff;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4881              got_indlen = 
xfs_bmap_worst_indlen(ip, got->br_blockcount);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4882  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4883              
new.br_blockcount = got_endoff - del_endoff;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4884              new_indlen = 
xfs_bmap_worst_indlen(ip, new.br_blockcount);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4885  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4886              
WARN_ON_ONCE(!got_indlen || !new_indlen);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4887              stolen = 
xfs_bmap_split_indlen(da_old, &got_indlen, &new_indlen,
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4888                              
                       del->br_blockcount);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4889  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4890              
got->br_startblock = nullstartblock((int)got_indlen);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4891  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4892              new.br_startoff 
= del_endoff;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4893              new.br_state = 
got->br_state;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4894              
new.br_startblock = nullstartblock((int)new_indlen);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4895  
b2b1712a640824e Christoph Hellwig 2017-11-03  4896              
xfs_iext_update_extent(ip, state, icur, got);
b2b1712a640824e Christoph Hellwig 2017-11-03  4897              
xfs_iext_next(ifp, icur);
0254c2f253d6fe1 Christoph Hellwig 2017-11-03  4898              
xfs_iext_insert(ip, icur, &new, state);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4899  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4900              da_new = 
got_indlen + new_indlen - stolen;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4901              
del->br_blockcount -= stolen;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4902              break;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4903      }
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4904  
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20 @4905      ASSERT(da_old >= 
da_new);
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4906      da_diff = da_old - 
da_new;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4907      if (!isrt)
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4908              da_diff += 
del->br_blockcount;
9fe82b8c422b5d9 Darrick J. Wong   2019-04-25  4909      if (da_diff) {
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4910              
xfs_mod_fdblocks(mp, da_diff, false);
9fe82b8c422b5d9 Darrick J. Wong   2019-04-25  4911              
xfs_mod_delalloc(mp, -da_diff);
9fe82b8c422b5d9 Darrick J. Wong   2019-04-25  4912      }
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4913      return error;
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4914  }
fa5c836ca8eb5ba Christoph Hellwig 2016-10-20  4915  

:::::: The code at line 4905 was first introduced by commit
:::::: fa5c836ca8eb5bad6316ddfc066acbc4e2485356 xfs: refactor xfs_bunmapi_cow

:::::: TO: Christoph Hellwig <[email protected]>
:::::: CC: Dave Chinner <[email protected]>

---
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