Linux filesystem development
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@sun.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Zero-clearing all zero-clearable bytes.
Date: Sat, 22 Nov 2008 11:44:06 -0600	[thread overview]
Message-ID: <20081122174406.GQ3186@webber.adilger.int> (raw)
In-Reply-To: <200811221236.FJE81778.LtMHOQFJFVFSOO@I-love.SAKURA.ne.jp>

On Nov 22, 2008  12:36 +0900, Tetsuo Handa wrote:
> Compressing whole image files includes compressing deleted/unused bytes within
> a block. This means that non-zero bytes in deleted/unused blocks affect
> compression ratio.
> 
>     static char buffer[4096];
>     memset(buffer, 0, sizeof(buffer));
>     snprintf(buffer, sizeof(buffer) - 1, "%s/XXXXXX", argc > 1 ? argv[1] : "");
>     if ((fd = mkstemp(buffer)) != EOF) {
>         unlink(buffer);
>         memset(buffer, 255, sizeof(buffer));
>         while (write(fd, buffer, sizeof(buffer)) > 0);

Why would you fill the buffer with 0xff instead of 0?
In fact no such program is needed, just "dd if=/dev/zero of=/{fs}/tmp"
and then delete the file.


Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


  reply	other threads:[~2008-11-22 17:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-22  3:36 Zero-clearing all zero-clearable bytes Tetsuo Handa
2008-11-22 17:44 ` Andreas Dilger [this message]
2008-11-23  0:15   ` Tetsuo Handa
2008-11-23  3:05     ` Phillip Lougher
2008-11-23  4:27 ` Phillip Lougher
2008-11-23  5:03   ` Tetsuo Handa
2008-11-23 11:25     ` Henrique de Moraes Holschuh
2008-11-24 14:56       ` Martin Steigerwald
2008-11-25 10:59         ` Tetsuo Handa

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=20081122174406.GQ3186@webber.adilger.int \
    --to=adilger@sun.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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