linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Diego Calleja <diegocg@gmail.com>
To: Timofey Titovets <nefelim4ag@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v5 4/6] Btrfs: heuristic add detection of zeroed sample
Date: Wed, 23 Aug 2017 19:55:12 +0200	[thread overview]
Message-ID: <4756671.4QeJesEyyX@archlinux> (raw)
In-Reply-To: <20170823002650.3133-5-nefelim4ag@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?

  reply	other threads:[~2017-08-23 17:55 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 [this message]
2017-08-23 20:03     ` Timofey Titovets
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=4756671.4QeJesEyyX@archlinux \
    --to=diegocg@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nefelim4ag@gmail.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;
as well as URLs for NNTP newsgroup(s).