Re: [PATCH 20/20] block, blksnap: adds a blksnap to the kernel tree

From: kernel test robot
Date: Fri Jun 17 2022 - 22:12:09 EST


Hi Sergei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on v5.19-rc2 next-20220617]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/intel-lab-lkp/linux/commits/Sergei-Shtepa/blksnap-creating-non-persistent-snapshots-for-backup/20220614-025950
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: parisc-allmodconfig (https://download.01.org/0day-ci/archive/20220618/202206181039.UczT9AgC-lkp@xxxxxxxxx/config)
compiler: hppa-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/1cdaf9c498b3c016f311f65998256e2129623f70
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sergei-Shtepa/blksnap-creating-non-persistent-snapshots-for-backup/20220614-025950
git checkout 1cdaf9c498b3c016f311f65998256e2129623f70
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash drivers/ fs/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/block/blksnap/diff_buffer.c:10:6: warning: no previous prototype for 'diff_buffer_free' [-Wmissing-prototypes]
10 | void diff_buffer_free(struct diff_buffer *diff_buffer)
| ^~~~~~~~~~~~~~~~
>> drivers/block/blksnap/diff_buffer.c:34:21: warning: no previous prototype for 'diff_buffer_new' [-Wmissing-prototypes]
34 | struct diff_buffer *diff_buffer_new(size_t page_count, size_t buffer_size,
| ^~~~~~~~~~~~~~~
--
>> drivers/block/blksnap/diff_storage.c:134:22: warning: no previous prototype for 'diff_storage_bdev_by_id' [-Wmissing-prototypes]
134 | struct block_device *diff_storage_bdev_by_id(struct diff_storage *diff_storage,
| ^~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/block/blksnap/tracker.c:44:6: warning: no previous prototype for 'tracker_free' [-Wmissing-prototypes]
44 | void tracker_free(struct tracker *tracker)
| ^~~~~~~~~~~~


vim +/diff_buffer_free +10 drivers/block/blksnap/diff_buffer.c

9377564e255bc9 Sergei Shtepa 2022-06-13 9
9377564e255bc9 Sergei Shtepa 2022-06-13 @10 void diff_buffer_free(struct diff_buffer *diff_buffer)
9377564e255bc9 Sergei Shtepa 2022-06-13 11 {
9377564e255bc9 Sergei Shtepa 2022-06-13 12 size_t inx = 0;
9377564e255bc9 Sergei Shtepa 2022-06-13 13 struct page *page;
9377564e255bc9 Sergei Shtepa 2022-06-13 14
9377564e255bc9 Sergei Shtepa 2022-06-13 15 if (unlikely(!diff_buffer))
9377564e255bc9 Sergei Shtepa 2022-06-13 16 return;
9377564e255bc9 Sergei Shtepa 2022-06-13 17
9377564e255bc9 Sergei Shtepa 2022-06-13 18 for (inx = 0; inx < diff_buffer->page_count; inx++) {
9377564e255bc9 Sergei Shtepa 2022-06-13 19 page = diff_buffer->pages[inx];
9377564e255bc9 Sergei Shtepa 2022-06-13 20 if (page) {
9377564e255bc9 Sergei Shtepa 2022-06-13 21 __free_page(page);
9377564e255bc9 Sergei Shtepa 2022-06-13 22 #ifdef CONFIG_BLK_SNAP_DEBUG_MEMORY_LEAK
9377564e255bc9 Sergei Shtepa 2022-06-13 23 memory_object_dec(memory_object_page);
9377564e255bc9 Sergei Shtepa 2022-06-13 24 #endif
9377564e255bc9 Sergei Shtepa 2022-06-13 25 }
9377564e255bc9 Sergei Shtepa 2022-06-13 26 }
9377564e255bc9 Sergei Shtepa 2022-06-13 27
9377564e255bc9 Sergei Shtepa 2022-06-13 28 kfree(diff_buffer);
9377564e255bc9 Sergei Shtepa 2022-06-13 29 #ifdef CONFIG_BLK_SNAP_DEBUG_MEMORY_LEAK
9377564e255bc9 Sergei Shtepa 2022-06-13 30 memory_object_dec(memory_object_diff_buffer);
9377564e255bc9 Sergei Shtepa 2022-06-13 31 #endif
9377564e255bc9 Sergei Shtepa 2022-06-13 32 }
9377564e255bc9 Sergei Shtepa 2022-06-13 33
9377564e255bc9 Sergei Shtepa 2022-06-13 @34 struct diff_buffer *diff_buffer_new(size_t page_count, size_t buffer_size,
9377564e255bc9 Sergei Shtepa 2022-06-13 35 gfp_t gfp_mask)
9377564e255bc9 Sergei Shtepa 2022-06-13 36 {
9377564e255bc9 Sergei Shtepa 2022-06-13 37 struct diff_buffer *diff_buffer;
9377564e255bc9 Sergei Shtepa 2022-06-13 38 size_t inx = 0;
9377564e255bc9 Sergei Shtepa 2022-06-13 39 struct page *page;
9377564e255bc9 Sergei Shtepa 2022-06-13 40
9377564e255bc9 Sergei Shtepa 2022-06-13 41 if (unlikely(page_count <= 0))
9377564e255bc9 Sergei Shtepa 2022-06-13 42 return NULL;
9377564e255bc9 Sergei Shtepa 2022-06-13 43
9377564e255bc9 Sergei Shtepa 2022-06-13 44 /*
9377564e255bc9 Sergei Shtepa 2022-06-13 45 * In case of overflow, it is better to get a null pointer
9377564e255bc9 Sergei Shtepa 2022-06-13 46 * than a pointer to some memory area. Therefore + 1.
9377564e255bc9 Sergei Shtepa 2022-06-13 47 */
9377564e255bc9 Sergei Shtepa 2022-06-13 48 diff_buffer = kzalloc(sizeof(struct diff_buffer) +
9377564e255bc9 Sergei Shtepa 2022-06-13 49 (page_count + 1) * sizeof(struct page *),
9377564e255bc9 Sergei Shtepa 2022-06-13 50 gfp_mask);
9377564e255bc9 Sergei Shtepa 2022-06-13 51 if (!diff_buffer)
9377564e255bc9 Sergei Shtepa 2022-06-13 52 return NULL;
9377564e255bc9 Sergei Shtepa 2022-06-13 53 #ifdef CONFIG_BLK_SNAP_DEBUG_MEMORY_LEAK
9377564e255bc9 Sergei Shtepa 2022-06-13 54 memory_object_inc(memory_object_diff_buffer);
9377564e255bc9 Sergei Shtepa 2022-06-13 55 #endif
9377564e255bc9 Sergei Shtepa 2022-06-13 56 INIT_LIST_HEAD(&diff_buffer->link);
9377564e255bc9 Sergei Shtepa 2022-06-13 57 diff_buffer->size = buffer_size;
9377564e255bc9 Sergei Shtepa 2022-06-13 58 diff_buffer->page_count = page_count;
9377564e255bc9 Sergei Shtepa 2022-06-13 59
9377564e255bc9 Sergei Shtepa 2022-06-13 60 for (inx = 0; inx < page_count; inx++) {
9377564e255bc9 Sergei Shtepa 2022-06-13 61 page = alloc_page(gfp_mask);
9377564e255bc9 Sergei Shtepa 2022-06-13 62 if (!page)
9377564e255bc9 Sergei Shtepa 2022-06-13 63 goto fail;
9377564e255bc9 Sergei Shtepa 2022-06-13 64 #ifdef CONFIG_BLK_SNAP_DEBUG_MEMORY_LEAK
9377564e255bc9 Sergei Shtepa 2022-06-13 65 memory_object_inc(memory_object_page);
9377564e255bc9 Sergei Shtepa 2022-06-13 66 #endif
9377564e255bc9 Sergei Shtepa 2022-06-13 67 diff_buffer->pages[inx] = page;
9377564e255bc9 Sergei Shtepa 2022-06-13 68 }
9377564e255bc9 Sergei Shtepa 2022-06-13 69 return diff_buffer;
9377564e255bc9 Sergei Shtepa 2022-06-13 70 fail:
9377564e255bc9 Sergei Shtepa 2022-06-13 71 diff_buffer_free(diff_buffer);
9377564e255bc9 Sergei Shtepa 2022-06-13 72 return NULL;
9377564e255bc9 Sergei Shtepa 2022-06-13 73 }
9377564e255bc9 Sergei Shtepa 2022-06-13 74

--
0-DAY CI Kernel Test Service
https://01.org/lkp