lkml.org 
[lkml]   [2008]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Zero-clearing all zero-clearable bytes.
From
Date
Hello.

Phillip Lougher wrote:
> Most filesystems will not create a sparse file if zero-byte filled
> blocks are written. To create a sparse file you normally have to seek
> beyond the file end and then write blocks, leaving a hole in-between the
> positions.
>
> The information from stat can tell you if a file has been stored
> sparsely, because the blocks used count will be less than the file size
> suggests.
>
Then, I can use "dd if=/dev/zero" without worrying sparse files.

Phillip Lougher wrote:
> You don't mention what you're using to compress the ext3 image file. If
> you're using Squashfs then it's much better to zero-fill the blocks
> rather than use 255, because Squashfs detects zero-filled blocks and
> stores them sparsely. This not only gets slightly better compression
> (than a compressed zero-filled block), but reading is also slightly faster.
>
Yes, I use squashfs.



What I wanted to do is "Zero-clearing *all zero-clearable* bytes".
Suppose blocks for inode are 8192 bytes and only 128 bytes are in use,
I think there are 8064 bytes I can zero-fill.
Suppose blocks for file data are 8192 bytes and a file's size is 1 byte,
I think there are 8191 bytes I can zero-fill.
Such bytes may have non-zero values because directory entries can be
unlink()ed and file data can be truncate()d.
I wished there is a utility to zero-fill such bytes.


Thanks a lot.


\
 
 \ /
  Last update: 2008-11-23 06:05    [W:0.052 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site