Re: [PATCH] btrfs: Fix error handling in btrfs_cleanup_ordered_extents

2018-10-26 Thread kbuild test robot
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: x86_64-randconfig-x014-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=x86_64 

All error/warnings (new ones prefixed by >>):

   fs/btrfs/inode.c: In function 'btrfs_cleanup_ordered_extents':
>> fs/btrfs/inode.c:10618:0: error: unterminated argument list invoking macro 
>> "if"
};

>> fs/btrfs/inode.c:140:2: error: expected '(' at end of input
 if (page_start >= offset && page_end <= (offset + bytes - 1) {
 ^~
>> fs/btrfs/inode.c:140:2: warning: this 'if' clause does not guard... 
>> [-Wmisleading-indentation]
   fs/btrfs/inode.c:10618:0: note: ...this statement, but the latter is 
misleadingly indented as if it were guarded by the 'if'
};

>> fs/btrfs/inode.c:140:2: error: expected declaration or statement at end of 
>> input
 if (page_start >= offset && page_end <= (offset + bytes - 1) {
 ^~
   fs/btrfs/inode.c:122:6: warning: unused variable 'page_end' 
[-Wunused-variable]
 u64 page_end = page_start + PAGE_SIZE - 1;
 ^~~~
   fs/btrfs/inode.c: At top level:
   fs/btrfs/inode.c:87:12: warning: 'btrfs_setsize' declared 'static' but never 
defined [-Wunused-function]
static int btrfs_setsize(struct inode *inode, struct iattr *attr);
   ^
   fs/btrfs/inode.c:88:12: warning: 'btrfs_truncate' declared 'static' but 
never defined [-Wunused-function]
static int btrfs_truncate(struct inode *inode, bool skip_writeback);
   ^~
   fs/btrfs/inode.c:89:12: warning: 'btrfs_finish_ordered_io' declared 'static' 
but never defined [-Wunused-function]
static int btrfs_finish_ordered_io(struct btrfs_ordered_extent 
*ordered_extent);
   ^~~
   fs/btrfs/inode.c:90:21: warning: 'cow_file_range' declared 'static' but 
never defined [-Wunused-function]
static noinline int cow_file_range(struct inode *inode,
^~
   fs/btrfs/inode.c:95:27: warning: 'create_io_em' declared 'static' but never 
defined [-Wunused-function]
static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 
len,
  ^~~~
   fs/btrfs/inode.c:101:13: warning: '__endio_write_update_ordered' declared 
'static' but never defined [-Wunused-function]
static void __endio_write_update_ordered(struct inode *inode,
^~~~
   fs/btrfs/inode.c:71:27: warning: 'btrfs_inode_cachep' defined but not used 
[-Wunused-variable]
static struct kmem_cache *btrfs_inode_cachep;
  ^~

vim +/if +10618 fs/btrfs/inode.c

76dda93c Yan, Zheng  2009-09-21  10615  
82d339d9 Alexey Dobriyan 2009-10-09  10616  const struct dentry_operations 
btrfs_dentry_operations = {
76dda93c Yan, Zheng  2009-09-21  10617  .d_delete   = 
btrfs_dentry_delete,
76dda93c Yan, Zheng  2009-09-21 @10618  };

:: The code at line 10618 was first introduced by commit
:: 76dda93c6ae2c1dc3e6cde34569d6aca26b0c918 Btrfs: add snapshot/subvolume 
destroy ioctl

:: TO: Yan, Zheng 
:: CC: Chris Mason 

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


.config.gz
Description: application/gzip


Re: [PATCH] btrfs: Fix error handling in btrfs_cleanup_ordered_extents

2018-10-26 Thread kbuild test robot
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 infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] btrfs: Fix error handling in btrfs_cleanup_ordered_extents

2018-10-26 Thread Holger Hoffstätte

On 10/26/18 13:13, Nikolay Borisov wrote:


+   if (page_start >= offset && page_end <= (offset + bytes - 1) {


fs/btrfs/inode.c: In function 'btrfs_cleanup_ordered_extents':
fs/btrfs/inode.c:140:62: error: expected ')' before '{' token
  if (page_start >= offset && page_end <= (offset + bytes - 1) {
 ~^~
  )
You're welcome :)

Holger