tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git 
write-calc
head:   d2bc11581b0f53bb8b1f6599b18485f1d51971f6
commit: d2bc11581b0f53bb8b1f6599b18485f1d51971f6 [6/6] gfs2: Rewrite 
gfs2_write_calc_reserv
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.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 d2bc11581b0f53bb8b1f6599b18485f1d51971f6
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   In file included from arch/mips/include/asm/div64.h:12:0,
                    from include/linux/kernel.h:174,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/spinlock.h:51,
                    from fs//gfs2/bmap.c:10:
   fs//gfs2/bmap.c: In function 'gfs2_write_calc_reserv':
   include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer 
types lacks a cast
     (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                               ^
>> fs//gfs2/bmap.c:2516:3: note: in expansion of macro 'do_div'
      do_div(pos, inptrs);
      ^~~~~~
   include/asm-generic/div64.h:222:28: warning: comparison of distinct pointer 
types lacks a cast
     (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                               ^
   fs//gfs2/bmap.c:2517:3: note: in expansion of macro 'do_div'
      do_div(last, inptrs);
      ^~~~~~

vim +/do_div +2516 fs//gfs2/bmap.c

  2456  
  2457  /**
  2458   * gfs2_write_calc_reserv - calculate number of blocks needed to write 
to a file
  2459   * @ip: the file
  2460   * @pos: offset of the write
  2461   * @len: the number of bytes to be written to the file
  2462   * @data_blocks: returns the number of data blocks required
  2463   * @ind_blocks: returns the number of indirect blocks required
  2464   *
  2465   */
  2466  
  2467  void gfs2_write_calc_reserv(const struct gfs2_inode *ip, loff_t pos,
  2468                              unsigned int len, unsigned int *data_blocks,
  2469                              unsigned int *ind_blocks)
  2470  {
  2471          const struct inode *inode = &ip->i_inode;
  2472          unsigned int blkbits = inode->i_blkbits;
  2473          struct gfs2_sbd *sdp = GFS2_SB(inode);
  2474          unsigned int inptrs = sdp->sd_inptrs;
  2475          unsigned int h = ip->i_height;
  2476          loff_t last;
  2477  
  2478          BUG_ON(gfs2_is_dir(ip));
  2479  
  2480          /* Calculate the height required for the new end of file */
  2481          while (pos + len > sdp->sd_heightsize[h])
  2482                  h++;
  2483  
  2484          /* Indirect blocks for growing the inode height */
  2485          *ind_blocks = h - ip->i_height;
  2486  
  2487          /* Write range rounded to block boundaries */
  2488          last = (pos + len - 1) >> blkbits;
  2489          pos >>= blkbits;
  2490          *data_blocks = last - pos + 1;
  2491  
  2492          /*
  2493           * Unstuffing (going from height 0 to 1) may require an 
additional data
  2494           * block, but won't require an indirect block.
  2495           */
  2496          if (gfs2_is_stuffed(ip)) {
  2497                  (*ind_blocks)--;
  2498                  if (i_size_read(inode) != 0 && pos != 0)
  2499                          (*data_blocks)++;
  2500          }
  2501  
  2502          /*
  2503           * Indirect blocks for filling the tree: each layer closer 
towards the
  2504           * root may require however many indirect blocks the write 
range still
  2505           * spans at that layer, which is at least one.
  2506           *
  2507           * We can ignore the data blocks at layer @h as well as the 
inode at
  2508           * layer 0.
  2509           *
  2510           * Note that we don't take into account which indirect blocks 
are
  2511           * already allocated here, so we overestimate the number of 
indirect
  2512           * blocks requires in most cases.
  2513           */
  2514          h--;
  2515          while (h >= 1) {
> 2516                  do_div(pos, inptrs);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to