[rgushchin:kmem_reparent.6 16/236] fs/btrfs/zstd.c:396:28: error: incompatible type for argument 1 of 'ZSTD_initCStream'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://github.com/rgushchin/linux.git kmem_reparent.6
head:   8e4d7c939f45c5d285469aee9e02777da23b582f
commit: 96d3001e2f61722b7e3d26456133ff2779de268b [16/236] zstd: pass pointer rathen than structure to functions
config: x86_64-lkp (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        git checkout 96d3001e2f61722b7e3d26456133ff2779de268b
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

All errors (new ones prefixed by >>):

   fs/btrfs/zstd.c: In function 'zstd_compress_pages':
>> fs/btrfs/zstd.c:396:28: error: incompatible type for argument 1 of 'ZSTD_initCStream'
     stream = ZSTD_initCStream(params, len, workspace->mem,
                               ^~~~~~
   In file included from fs/btrfs/zstd.c:19:0:
   include/linux/zstd.h:555:15: note: expected 'const ZSTD_parameters * {aka const struct <anonymous> *}' but argument is of type 'ZSTD_parameters {aka struct <anonymous>}'
    ZSTD_CStream *ZSTD_initCStream(const ZSTD_parameters *params,
                  ^~~~~~~~~~~~~~~~

vim +/ZSTD_initCStream +396 fs/btrfs/zstd.c

5c1aab1d Nick Terrell 2017-08-09  368  
5c1aab1d Nick Terrell 2017-08-09  369  static int zstd_compress_pages(struct list_head *ws,
5c1aab1d Nick Terrell 2017-08-09  370  		struct address_space *mapping,
5c1aab1d Nick Terrell 2017-08-09  371  		u64 start,
5c1aab1d Nick Terrell 2017-08-09  372  		struct page **pages,
5c1aab1d Nick Terrell 2017-08-09  373  		unsigned long *out_pages,
5c1aab1d Nick Terrell 2017-08-09  374  		unsigned long *total_in,
5c1aab1d Nick Terrell 2017-08-09  375  		unsigned long *total_out)
5c1aab1d Nick Terrell 2017-08-09  376  {
5c1aab1d Nick Terrell 2017-08-09  377  	struct workspace *workspace = list_entry(ws, struct workspace, list);
5c1aab1d Nick Terrell 2017-08-09  378  	ZSTD_CStream *stream;
5c1aab1d Nick Terrell 2017-08-09  379  	int ret = 0;
5c1aab1d Nick Terrell 2017-08-09  380  	int nr_pages = 0;
5c1aab1d Nick Terrell 2017-08-09  381  	struct page *in_page = NULL;  /* The current page to read */
5c1aab1d Nick Terrell 2017-08-09  382  	struct page *out_page = NULL; /* The current page to write to */
5c1aab1d Nick Terrell 2017-08-09  383  	unsigned long tot_in = 0;
5c1aab1d Nick Terrell 2017-08-09  384  	unsigned long tot_out = 0;
5c1aab1d Nick Terrell 2017-08-09  385  	unsigned long len = *total_out;
5c1aab1d Nick Terrell 2017-08-09  386  	const unsigned long nr_dest_pages = *out_pages;
5c1aab1d Nick Terrell 2017-08-09  387  	unsigned long max_out = nr_dest_pages * PAGE_SIZE;
e0dc87af Dennis Zhou  2019-02-04  388  	ZSTD_parameters params = zstd_get_btrfs_parameters(workspace->req_level,
e0dc87af Dennis Zhou  2019-02-04  389  							   len);
5c1aab1d Nick Terrell 2017-08-09  390  
5c1aab1d Nick Terrell 2017-08-09  391  	*out_pages = 0;
5c1aab1d Nick Terrell 2017-08-09  392  	*total_out = 0;
5c1aab1d Nick Terrell 2017-08-09  393  	*total_in = 0;
5c1aab1d Nick Terrell 2017-08-09  394  
5c1aab1d Nick Terrell 2017-08-09  395  	/* Initialize the stream */
5c1aab1d Nick Terrell 2017-08-09 @396  	stream = ZSTD_initCStream(params, len, workspace->mem,
5c1aab1d Nick Terrell 2017-08-09  397  			workspace->size);
5c1aab1d Nick Terrell 2017-08-09  398  	if (!stream) {
5c1aab1d Nick Terrell 2017-08-09  399  		pr_warn("BTRFS: ZSTD_initCStream failed\n");
5c1aab1d Nick Terrell 2017-08-09  400  		ret = -EIO;
5c1aab1d Nick Terrell 2017-08-09  401  		goto out;
5c1aab1d Nick Terrell 2017-08-09  402  	}
5c1aab1d Nick Terrell 2017-08-09  403  
5c1aab1d Nick Terrell 2017-08-09  404  	/* map in the first page of input data */
5c1aab1d Nick Terrell 2017-08-09  405  	in_page = find_get_page(mapping, start >> PAGE_SHIFT);
431e9822 David Sterba 2017-11-15  406  	workspace->in_buf.src = kmap(in_page);
431e9822 David Sterba 2017-11-15  407  	workspace->in_buf.pos = 0;
431e9822 David Sterba 2017-11-15  408  	workspace->in_buf.size = min_t(size_t, len, PAGE_SIZE);
5c1aab1d Nick Terrell 2017-08-09  409  
5c1aab1d Nick Terrell 2017-08-09  410  
5c1aab1d Nick Terrell 2017-08-09  411  	/* Allocate and map in the output buffer */
5c1aab1d Nick Terrell 2017-08-09  412  	out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
5c1aab1d Nick Terrell 2017-08-09  413  	if (out_page == NULL) {
5c1aab1d Nick Terrell 2017-08-09  414  		ret = -ENOMEM;
5c1aab1d Nick Terrell 2017-08-09  415  		goto out;
5c1aab1d Nick Terrell 2017-08-09  416  	}
5c1aab1d Nick Terrell 2017-08-09  417  	pages[nr_pages++] = out_page;
431e9822 David Sterba 2017-11-15  418  	workspace->out_buf.dst = kmap(out_page);
431e9822 David Sterba 2017-11-15  419  	workspace->out_buf.pos = 0;
431e9822 David Sterba 2017-11-15  420  	workspace->out_buf.size = min_t(size_t, max_out, PAGE_SIZE);
5c1aab1d Nick Terrell 2017-08-09  421  
5c1aab1d Nick Terrell 2017-08-09  422  	while (1) {
5c1aab1d Nick Terrell 2017-08-09  423  		size_t ret2;
5c1aab1d Nick Terrell 2017-08-09  424  
431e9822 David Sterba 2017-11-15  425  		ret2 = ZSTD_compressStream(stream, &workspace->out_buf,
431e9822 David Sterba 2017-11-15  426  				&workspace->in_buf);
5c1aab1d Nick Terrell 2017-08-09  427  		if (ZSTD_isError(ret2)) {
5c1aab1d Nick Terrell 2017-08-09  428  			pr_debug("BTRFS: ZSTD_compressStream returned %d\n",
5c1aab1d Nick Terrell 2017-08-09  429  					ZSTD_getErrorCode(ret2));
5c1aab1d Nick Terrell 2017-08-09  430  			ret = -EIO;
5c1aab1d Nick Terrell 2017-08-09  431  			goto out;
5c1aab1d Nick Terrell 2017-08-09  432  		}
5c1aab1d Nick Terrell 2017-08-09  433  
5c1aab1d Nick Terrell 2017-08-09  434  		/* Check to see if we are making it bigger */
431e9822 David Sterba 2017-11-15  435  		if (tot_in + workspace->in_buf.pos > 8192 &&
431e9822 David Sterba 2017-11-15  436  				tot_in + workspace->in_buf.pos <
431e9822 David Sterba 2017-11-15  437  				tot_out + workspace->out_buf.pos) {
5c1aab1d Nick Terrell 2017-08-09  438  			ret = -E2BIG;
5c1aab1d Nick Terrell 2017-08-09  439  			goto out;
5c1aab1d Nick Terrell 2017-08-09  440  		}
5c1aab1d Nick Terrell 2017-08-09  441  
5c1aab1d Nick Terrell 2017-08-09  442  		/* We've reached the end of our output range */
431e9822 David Sterba 2017-11-15  443  		if (workspace->out_buf.pos >= max_out) {
431e9822 David Sterba 2017-11-15  444  			tot_out += workspace->out_buf.pos;
5c1aab1d Nick Terrell 2017-08-09  445  			ret = -E2BIG;
5c1aab1d Nick Terrell 2017-08-09  446  			goto out;
5c1aab1d Nick Terrell 2017-08-09  447  		}
5c1aab1d Nick Terrell 2017-08-09  448  
5c1aab1d Nick Terrell 2017-08-09  449  		/* Check if we need more output space */
431e9822 David Sterba 2017-11-15  450  		if (workspace->out_buf.pos == workspace->out_buf.size) {
5c1aab1d Nick Terrell 2017-08-09  451  			tot_out += PAGE_SIZE;
5c1aab1d Nick Terrell 2017-08-09  452  			max_out -= PAGE_SIZE;
5c1aab1d Nick Terrell 2017-08-09  453  			kunmap(out_page);
5c1aab1d Nick Terrell 2017-08-09  454  			if (nr_pages == nr_dest_pages) {
5c1aab1d Nick Terrell 2017-08-09  455  				out_page = NULL;
5c1aab1d Nick Terrell 2017-08-09  456  				ret = -E2BIG;
5c1aab1d Nick Terrell 2017-08-09  457  				goto out;
5c1aab1d Nick Terrell 2017-08-09  458  			}
5c1aab1d Nick Terrell 2017-08-09  459  			out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
5c1aab1d Nick Terrell 2017-08-09  460  			if (out_page == NULL) {
5c1aab1d Nick Terrell 2017-08-09  461  				ret = -ENOMEM;
5c1aab1d Nick Terrell 2017-08-09  462  				goto out;
5c1aab1d Nick Terrell 2017-08-09  463  			}
5c1aab1d Nick Terrell 2017-08-09  464  			pages[nr_pages++] = out_page;
431e9822 David Sterba 2017-11-15  465  			workspace->out_buf.dst = kmap(out_page);
431e9822 David Sterba 2017-11-15  466  			workspace->out_buf.pos = 0;
431e9822 David Sterba 2017-11-15  467  			workspace->out_buf.size = min_t(size_t, max_out,
431e9822 David Sterba 2017-11-15  468  							PAGE_SIZE);
5c1aab1d Nick Terrell 2017-08-09  469  		}
5c1aab1d Nick Terrell 2017-08-09  470  
5c1aab1d Nick Terrell 2017-08-09  471  		/* We've reached the end of the input */
431e9822 David Sterba 2017-11-15  472  		if (workspace->in_buf.pos >= len) {
431e9822 David Sterba 2017-11-15  473  			tot_in += workspace->in_buf.pos;
5c1aab1d Nick Terrell 2017-08-09  474  			break;
5c1aab1d Nick Terrell 2017-08-09  475  		}
5c1aab1d Nick Terrell 2017-08-09  476  
5c1aab1d Nick Terrell 2017-08-09  477  		/* Check if we need more input */
431e9822 David Sterba 2017-11-15  478  		if (workspace->in_buf.pos == workspace->in_buf.size) {
5c1aab1d Nick Terrell 2017-08-09  479  			tot_in += PAGE_SIZE;
5c1aab1d Nick Terrell 2017-08-09  480  			kunmap(in_page);
5c1aab1d Nick Terrell 2017-08-09  481  			put_page(in_page);
5c1aab1d Nick Terrell 2017-08-09  482  
5c1aab1d Nick Terrell 2017-08-09  483  			start += PAGE_SIZE;
5c1aab1d Nick Terrell 2017-08-09  484  			len -= PAGE_SIZE;
5c1aab1d Nick Terrell 2017-08-09  485  			in_page = find_get_page(mapping, start >> PAGE_SHIFT);
431e9822 David Sterba 2017-11-15  486  			workspace->in_buf.src = kmap(in_page);
431e9822 David Sterba 2017-11-15  487  			workspace->in_buf.pos = 0;
431e9822 David Sterba 2017-11-15  488  			workspace->in_buf.size = min_t(size_t, len, PAGE_SIZE);
5c1aab1d Nick Terrell 2017-08-09  489  		}
5c1aab1d Nick Terrell 2017-08-09  490  	}
5c1aab1d Nick Terrell 2017-08-09  491  	while (1) {
5c1aab1d Nick Terrell 2017-08-09  492  		size_t ret2;
5c1aab1d Nick Terrell 2017-08-09  493  
431e9822 David Sterba 2017-11-15  494  		ret2 = ZSTD_endStream(stream, &workspace->out_buf);
5c1aab1d Nick Terrell 2017-08-09  495  		if (ZSTD_isError(ret2)) {
5c1aab1d Nick Terrell 2017-08-09  496  			pr_debug("BTRFS: ZSTD_endStream returned %d\n",
5c1aab1d Nick Terrell 2017-08-09  497  					ZSTD_getErrorCode(ret2));
5c1aab1d Nick Terrell 2017-08-09  498  			ret = -EIO;
5c1aab1d Nick Terrell 2017-08-09  499  			goto out;
5c1aab1d Nick Terrell 2017-08-09  500  		}
5c1aab1d Nick Terrell 2017-08-09  501  		if (ret2 == 0) {
431e9822 David Sterba 2017-11-15  502  			tot_out += workspace->out_buf.pos;
5c1aab1d Nick Terrell 2017-08-09  503  			break;
5c1aab1d Nick Terrell 2017-08-09  504  		}
431e9822 David Sterba 2017-11-15  505  		if (workspace->out_buf.pos >= max_out) {
431e9822 David Sterba 2017-11-15  506  			tot_out += workspace->out_buf.pos;
5c1aab1d Nick Terrell 2017-08-09  507  			ret = -E2BIG;
5c1aab1d Nick Terrell 2017-08-09  508  			goto out;
5c1aab1d Nick Terrell 2017-08-09  509  		}
5c1aab1d Nick Terrell 2017-08-09  510  
5c1aab1d Nick Terrell 2017-08-09  511  		tot_out += PAGE_SIZE;
5c1aab1d Nick Terrell 2017-08-09  512  		max_out -= PAGE_SIZE;
5c1aab1d Nick Terrell 2017-08-09  513  		kunmap(out_page);
5c1aab1d Nick Terrell 2017-08-09  514  		if (nr_pages == nr_dest_pages) {
5c1aab1d Nick Terrell 2017-08-09  515  			out_page = NULL;
5c1aab1d Nick Terrell 2017-08-09  516  			ret = -E2BIG;
5c1aab1d Nick Terrell 2017-08-09  517  			goto out;
5c1aab1d Nick Terrell 2017-08-09  518  		}
5c1aab1d Nick Terrell 2017-08-09  519  		out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
5c1aab1d Nick Terrell 2017-08-09  520  		if (out_page == NULL) {
5c1aab1d Nick Terrell 2017-08-09  521  			ret = -ENOMEM;
5c1aab1d Nick Terrell 2017-08-09  522  			goto out;
5c1aab1d Nick Terrell 2017-08-09  523  		}
5c1aab1d Nick Terrell 2017-08-09  524  		pages[nr_pages++] = out_page;
431e9822 David Sterba 2017-11-15  525  		workspace->out_buf.dst = kmap(out_page);
431e9822 David Sterba 2017-11-15  526  		workspace->out_buf.pos = 0;
431e9822 David Sterba 2017-11-15  527  		workspace->out_buf.size = min_t(size_t, max_out, PAGE_SIZE);
5c1aab1d Nick Terrell 2017-08-09  528  	}
5c1aab1d Nick Terrell 2017-08-09  529  
5c1aab1d Nick Terrell 2017-08-09  530  	if (tot_out >= tot_in) {
5c1aab1d Nick Terrell 2017-08-09  531  		ret = -E2BIG;
5c1aab1d Nick Terrell 2017-08-09  532  		goto out;
5c1aab1d Nick Terrell 2017-08-09  533  	}
5c1aab1d Nick Terrell 2017-08-09  534  
5c1aab1d Nick Terrell 2017-08-09  535  	ret = 0;
5c1aab1d Nick Terrell 2017-08-09  536  	*total_in = tot_in;
5c1aab1d Nick Terrell 2017-08-09  537  	*total_out = tot_out;
5c1aab1d Nick Terrell 2017-08-09  538  out:
5c1aab1d Nick Terrell 2017-08-09  539  	*out_pages = nr_pages;
5c1aab1d Nick Terrell 2017-08-09  540  	/* Cleanup */
5c1aab1d Nick Terrell 2017-08-09  541  	if (in_page) {
5c1aab1d Nick Terrell 2017-08-09  542  		kunmap(in_page);
5c1aab1d Nick Terrell 2017-08-09  543  		put_page(in_page);
5c1aab1d Nick Terrell 2017-08-09  544  	}
5c1aab1d Nick Terrell 2017-08-09  545  	if (out_page)
5c1aab1d Nick Terrell 2017-08-09  546  		kunmap(out_page);
5c1aab1d Nick Terrell 2017-08-09  547  	return ret;
5c1aab1d Nick Terrell 2017-08-09  548  }
5c1aab1d Nick Terrell 2017-08-09  549  

:::::: The code at line 396 was first introduced by commit
:::::: 5c1aab1dd5445ed8bdcdbb575abc1b0d7ee5b2e7 btrfs: Add zstd support

:::::: TO: Nick Terrell <terrelln@xxxxxx>
:::::: CC: Chris Mason <clm@xxxxxx>

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux