Re: Zero-clearing all zero-clearable bytes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux