public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Nick Terrell <terrelln@fb.com>,
	Chris Down <chris@chrisdown.name>,
	Filipe Manana <fdmanana@suse.com>, Qu Wenruo <wqu@suse.com>,
	Nikolay Borisov <nborisov@suse.com>,
	Gabriel Niebler <gniebler@suse.com>,
	Ira Weiny <ira.weiny@intel.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Qu Wenruo <quwenruo.btrfs@gmx.com>
Subject: Re: [RFC PATCH v2 3/3] btrfs: Use kmap_local_page() on "in_page" in zlib_compress_pages()
Date: Sat, 18 Jun 2022 11:04:41 +0200	[thread overview]
Message-ID: <2057523.KlZ2vcFHjT@opensuse> (raw)
In-Reply-To: <94f8d618-ec7a-f68e-c302-2639ae3d7549@gmx.com>

On sabato 18 giugno 2022 00:16:15 CEST Qu Wenruo wrote:
> 
> On 2022/6/18 02:13, Fabio M. De Francesco wrote:

[snip]

> 
> Thanks for pointing to the doc, and that doc is enough to answer my
> question.
> 

Well, this confirms that my changes were quite helpful :-)

[snip]

> > As I said in a recent email, I'm relatively new to kernel development,
> > especially to Btrfs and other filesystems.
> 
> That's not a big deal, that's why we're here to provide help.
> 
> >
> > However, I noted that this code does different handling depending 
> > on how many "in_page" is going to map. I am not able to say why...
> 
> AFAIK the reason is optimization.
> 
> The idea is like this, if there are multiple pages left as input, we
> copy the pages from page cache into the workspace buffer.
> 
> If there is no more than one page left, we use that page from page cache
> directly.
> 
> I believe that's the problem causing the difficult in converting to
> kmap_local_page().
> 

[snip]

> 
> I'll send out a cleanup for zlib_compress_pages(), mostly to make the
> (strm.avail_in == 0) branch to call kmap() and kunmap() in pairs,
> without holding @in_page mapped.
> 
> Would that make it easier?
> 

I was doubtful when you asked this question. However, when this morning I 
saw your patch, I soon understood that it would make that task so easy that 
a silly script could do a mechanical conversion.

Thanks so much,

Fabio




      reply	other threads:[~2022-06-18  9:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 12:05 [RFC PATCH v2 0/3] btrfs: Convert zlib.c to use kmap_local_page() Fabio M. De Francesco
2022-06-17 12:05 ` [RFC PATCH v2 1/3] btrfs: Convert zlib_decompress_bio() " Fabio M. De Francesco
2022-06-17 12:51   ` Qu Wenruo
2022-06-17 17:35     ` Fabio M. De Francesco
2022-06-17 12:05 ` [RFC PATCH v2 2/3] btrfs: Use kmap_local_page() on "out_page" in zlib_compress_pages() Fabio M. De Francesco
2022-06-17 12:54   ` Qu Wenruo
2022-06-17 17:46     ` Fabio M. De Francesco
2022-06-17 12:05 ` [RFC PATCH v2 3/3] btrfs: Use kmap_local_page() on "in_page" " Fabio M. De Francesco
2022-06-17 13:09   ` Qu Wenruo
2022-06-17 14:20     ` David Sterba
2022-06-17 18:25       ` Fabio M. De Francesco
2022-06-17 18:13     ` Fabio M. De Francesco
2022-06-17 22:16       ` Qu Wenruo
2022-06-18  9:04         ` Fabio M. De Francesco [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2057523.KlZ2vcFHjT@opensuse \
    --to=fmdefrancesco@gmail.com \
    --cc=chris@chrisdown.name \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@suse.com \
    --cc=gniebler@suse.com \
    --cc=ira.weiny@intel.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=terrelln@fb.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox