Hi Nikolay,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v4.19]
[also build test ERROR on next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Nikolay-Borisov/btrfs-Fix-error-handling-in-btrfs_cleanup_ordered_extents/20181026-194005
config: i386-randconfig-x007-201842 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   fs//btrfs/inode.c: In function 'btrfs_cleanup_ordered_extents':
>> fs//btrfs/inode.c:140:63: error: expected ')' before '{' token
     if (page_start >= offset && page_end <= (offset + bytes - 1) {
                                                                  ^
>> fs//btrfs/inode.c:146:1: error: expected expression before '}' token
    }
    ^

vim +140 fs//btrfs/inode.c

    86  
    87  static int btrfs_setsize(struct inode *inode, struct iattr *attr);
    88  static int btrfs_truncate(struct inode *inode, bool skip_writeback);
    89  static int btrfs_finish_ordered_io(struct btrfs_ordered_extent 
*ordered_extent);
    90  static noinline int cow_file_range(struct inode *inode,
    91                                     struct page *locked_page,
    92                                     u64 start, u64 end, u64 delalloc_end,
    93                                     int *page_started, unsigned long 
*nr_written,
    94                                     int unlock, struct btrfs_dedupe_hash 
*hash);
    95  static struct extent_map *create_io_em(struct inode *inode, u64 start, 
u64 len,
    96                                         u64 orig_start, u64 block_start,
    97                                         u64 block_len, u64 
orig_block_len,
    98                                         u64 ram_bytes, int compress_type,
    99                                         int type);
   100  
   101  static void __endio_write_update_ordered(struct inode *inode,
   102                                           const u64 offset, const u64 
bytes,
   103                                           const bool uptodate);
   104  
   105  /*
   106   * Cleanup all submitted ordered extents in specified range to handle 
errors
   107   * from the fill_dellaloc() callback.
   108   *
   109   * NOTE: caller must ensure that when an error happens, it can not call
   110   * extent_clear_unlock_delalloc() to clear both the bits 
EXTENT_DO_ACCOUNTING
   111   * and EXTENT_DELALLOC simultaneously, because that causes the reserved 
metadata
   112   * to be released, which we want to happen only when finishing the 
ordered
   113   * extent (btrfs_finish_ordered_io()).
   114   */
   115  static inline void btrfs_cleanup_ordered_extents(struct inode *inode,
   116                                                   struct page 
*locked_page,
   117                                                   u64 offset, u64 bytes)
   118  {
   119          unsigned long index = offset >> PAGE_SHIFT;
   120          unsigned long end_index = (offset + bytes - 1) >> PAGE_SHIFT;
   121          u64 page_start = page_offset(locked_page);
   122          u64 page_end = page_start + PAGE_SIZE - 1;
   123  
   124          struct page *page;
   125  
   126          while (index <= end_index) {
   127                  page = find_get_page(inode->i_mapping, index);
   128                  index++;
   129                  if (!page)
   130                          continue;
   131                  ClearPagePrivate2(page);
   132                  put_page(page);
   133          }
   134  
   135          /*
   136           * In case this page belongs to the delalloc range being 
instantiated
   137           * then skip it, since the first page of a range is going to be
   138           * properly cleaned up by the caller of run_delalloc_range
   139           */
 > 140          if (page_start >= offset && page_end <= (offset + bytes - 1) {
   141                  offset += PAGE_SIZE;
   142                  bytes -= PAGE_SIZE;
   143          }
   144  
   145          return __endio_write_update_ordered(inode, offset, bytes, 
false);
 > 146  }
   147  

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