tail option limit
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?
Quoted 1 line
4KB be packed? (it is NO here i bet.)
Thanks!
Ming
Hello
Quoted 7 lines · Ming Zhang
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.
Quoted 10 lines
assume it is 4KB by default.
so will
< 4KB be packed?
= 4KB be packed?
Quoted 1 line
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.
Quoted 6 lines
Thanks!
Ming
Quoted 18 lines · Vladimir V. Saveliev
Hello
Quoted 15 lines · Ming Zhang
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?
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
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.
one or two? u mean there is a change that 2 bytes will be stored in 2 meta-data blocks? that is kind of weired.
Quoted 15 lines
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) ) ) \
Quoted 2 lines
)
too many ( and ) need to count. ;)
so here MAX_DIRECT_ITEM_LEN
http://lxr.linux.no/source/include/linux/reiserfs_fs.h#L1606 is 3976 with block size 4K by default.
assume a file is 4095. then n_file_size = 4095 and n_tail_size = 4095, so this define will return 1. then what will be the impact? i went through the code a bit and think this lead not to do packed?
Quoted 4 lines
Reiser4 by default stores whole file in metadata blocks if it is shorter than 16384. Longer files are stored in full data blocks completely.
so more files will be in tails.
Quoted 8 lines
Quoted 7 lines
Thanks!
Ming