From: Timofey Titovets <nefelim4ag@gmail.com>
To: Lionel Bouton <lionel-subscription@bouton.name>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/3] Btrfs: lzo compression must free at least PAGE_SIZE
Date: Sat, 20 May 2017 19:23:51 +0300 [thread overview]
Message-ID: <CAGqmi74d_G4pOSKJC3TrNWyB5qmCZE9AG-ugwAB8Dd=9mA-MQQ@mail.gmail.com> (raw)
In-Reply-To: <e290752e-55bd-22f2-6eca-37de0fc77e32@bouton.name>
2017-05-20 18:47 GMT+03:00 Lionel Bouton <lionel-subscription@bouton.name>:
> Le 19/05/2017 à 23:15, Timofey Titovets a écrit :
>> 2017-05-19 23:19 GMT+03:00 Lionel Bouton
>> <lionel-subscription@bouton.name>:
>>> I was too focused on other problems and having a fresh look at what I
>>> wrote I'm embarrassed by what I read. Used pages for a given amount
>>> of data should be (amount / PAGE_SIZE) + ((amount % PAGE_SIZE) == 0 ?
>>> 0 : 1) this seems enough of a common thing to compute that the kernel
>>> might have a macro defined for this.
>> If i understand the code correctly, the logic of comparing the size of
>> input/output by bytes is enough (IMHO)
>
> As I suspected I missed context : the name of the function makes it
> clear it is supposed to work on whole pages so you are right about the
> comparison.
>
> What I'm still unsure is if the test is at the right spot. The inner
> loop seems to work on at most
> in_len = min(len, PAGE_SIZE)
> chunks of data,
> for example on anything with len >= 4xPAGE_SIZE and PAGE_SIZE=4096 it
> seems to me there's a problem.
>
> if·(tot_in·>·8192·&&·tot_in·<·tot_out·+·PAGE_SIZE)
>
> tot_in > 8192 is true starting at the 3rd page being processedin my example
>
> If the 3 first pages don't manage to free one full page (ie the function
> only reaches at best a 2/3 compression ratio) the modified second
> condition is true and the compression is aborted. This even if
> continuing the compression would end up in freeing one page (tot_out is
> expected to rise slower than tot_in on compressible data so the
> difference could rise and reach a full PAGE_SIZE).
>
> Am I still confused by something ?
>
> Best regards,
>
> Lionel
You right, size must be checked after all data are already comressed,
so i will fix that and update patch set, thanks
--
Have a nice day,
Timofey.
next prev parent reply other threads:[~2017-05-20 16:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 13:38 [PATCH 0/3] Btrfs: compression fixes Timofey Titovets
2017-05-19 13:38 ` [PATCH 1/3] Btrfs: lzo.c pr_debug() deflate->lzo Timofey Titovets
2017-05-19 13:38 ` [PATCH 2/3] Btrfs: lzo compression must free at least PAGE_SIZE Timofey Titovets
2017-05-19 14:17 ` Lionel Bouton
2017-05-19 20:19 ` Lionel Bouton
2017-05-19 21:15 ` Timofey Titovets
2017-05-20 15:47 ` Lionel Bouton
2017-05-20 16:23 ` Timofey Titovets [this message]
2017-05-19 13:38 ` [PATCH 3/3] Btrfs: zlib " Timofey Titovets
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='CAGqmi74d_G4pOSKJC3TrNWyB5qmCZE9AG-ugwAB8Dd=9mA-MQQ@mail.gmail.com' \
--to=nefelim4ag@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=lionel-subscription@bouton.name \
/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;
as well as URLs for NNTP newsgroup(s).