lkml.org 
[lkml]   [2020]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4] btrfs: Use larger zlib buffer for s390 hardware compression
On Wed, Jan 08, 2020 at 07:48:31PM +0100, Zaslonko Mikhail wrote:
> >> +        } else if (workspace->strm.avail_out == 0) {
> >> +            /* get another page for the stream end */
> >> +            kunmap(out_page);
> >> +            if (nr_pages == nr_dest_pages) {
> >> +                out_page = NULL;
> >> +                ret = -E2BIG;
> >> +                goto out;
> >> +            }
> >> +            out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
> >> +            if (out_page == NULL) {
> >> +                ret = -ENOMEM;
> >> +                goto out;
> >> +            }
> >
> > Do we need zlib_deflateEnd() for the above error cases?  Thanks,
>
> The original btrfs code did not call zlib_deflateEnd() for -E2BIG and
> -ENOMEM cases, so I stick to the same logic.
> Unlike userspace zlib where deflateEnd() frees all dynamically allocated
> memory, in the kernel it doesn't do much apart from setting the return
> code (since all the memory allocations for kernel zlib are performed in advance).

Agreed, deflateEnd is not necessary in the error cases.

\
 
 \ /
  Last update: 2020-01-09 02:10    [W:0.090 / U:9.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site