linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Timofey Titovets <nefelim4ag@gmail.com>
To: Diego Calleja <diegocg@gmail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v5 4/6] Btrfs: heuristic add detection of zeroed sample
Date: Wed, 23 Aug 2017 23:03:03 +0300	[thread overview]
Message-ID: <CAGqmi77RHjeJfwdqhRDs5ityswKfPLF2Og-GEbZKjbr0TfKikw@mail.gmail.com> (raw)
In-Reply-To: <4756671.4QeJesEyyX@archlinux>

2017-08-23 20:55 GMT+03:00 Diego Calleja <diegocg@gmail.com>:
> El miércoles, 23 de agosto de 2017 2:26:48 (CEST) Timofey Titovets escribió:
>> +     for (i = 0; i < workspace->sample_size; i += sizeof(zero)) {
>> +             if (memcmp(&workspace->sample[i], &zero, sizeof(zero)))
>> +                     return false;
>
> Instead of just checking for 0, wouldn't it be a better idea to check
> for any kind of repetitions?
>
> As in, iterate over the sample and memcmp() each part of sample with
> the previous one. The cost would be the same, and it would detect not
> just zeros, but any kind of repeated data. Is there any reason I'm
> missing for not doing this?

Thank you, i was not think about that,
That approach seems better, i will update the patch.

-- 
Have a nice day,
Timofey.

  reply	other threads:[~2017-08-23 20:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23  0:26 [PATCH v5 0/6] Btrfs: populate heuristic with code Timofey Titovets
2017-08-23  0:26 ` [PATCH v5 1/6] Btrfs: heuristic make use compression workspaces Timofey Titovets
2017-08-23  0:26 ` [PATCH v5 2/6] Btrfs: heuristic workspace add bucket and sample items Timofey Titovets
2017-08-23  0:26 ` [PATCH v5 3/6] Btrfs: implement heuristic sampling logic Timofey Titovets
2017-08-23  0:26 ` [PATCH v5 4/6] Btrfs: heuristic add detection of zeroed sample Timofey Titovets
2017-08-23 17:55   ` Diego Calleja
2017-08-23 20:03     ` Timofey Titovets [this message]
2017-08-23  0:26 ` [PATCH v5 5/6] Btrfs: heuristic add byte set calculation Timofey Titovets
2017-08-23  0:26 ` [PATCH v5 6/6] Btrfs: heuristic add byte core " 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=CAGqmi77RHjeJfwdqhRDs5ityswKfPLF2Og-GEbZKjbr0TfKikw@mail.gmail.com \
    --to=nefelim4ag@gmail.com \
    --cc=diegocg@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).