Hello
Ming Zhang wrote:
> Hi,
>
> I saw from document that small files will be packed into meta-data thus
> save an extra data block read.
>
> how small is the boundary? i guess it has related with file block size.
>
> assume it is 4KB by default.
>
> so will
>
> < 4KB be packed?
>
> = 4KB be packed?
>
>>4KB be packed? (it is NO here i bet.)
>
It depends.
reiserfs by default packs into metadata blocks only last incomplete block of
file. It is called tail.
For example, if file is 4098 bytes long - first 4096 bytes are stored in full
data block (so called unformatted node).
2 last bytes (tail) are stored in one or two meta data blocks.
Files longer 4 * 4096 never get their data stored in meta data blocks.
Tail size depends on file size.
The code looks like:
#define STORE_TAIL_IN_UNFM_S1(n_file_size,n_tail_size,n_block_size) \
(\
(!(n_tail_size)) || \
(((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \
( (n_file_size) >= (n_block_size) * 4 ) || \
( ( (n_file_size) >= (n_block_size) * 3 ) && \
( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \
( ( (n_file_size) >= (n_block_size) * 2 ) && \
( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \
( ( (n_file_size) >= (n_block_size) ) && \
( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \
)
Reiser4 by default stores whole file in metadata blocks if it is shorter than
16384.
Longer files are stored in full data blocks completely.
> Thanks!
>
> Ming
>
>
>