All of lore.kernel.org
 help / color / mirror / Atom feed
* tail option limit
@ 2005-08-29 14:49 Ming Zhang
  2005-08-29 18:01 ` Vladimir V. Saveliev
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Zhang @ 2005-08-29 14:49 UTC (permalink / raw)
  To: reiserfs

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.)

Thanks!

Ming


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: tail option limit
  2005-08-29 14:49 tail option limit Ming Zhang
@ 2005-08-29 18:01 ` Vladimir V. Saveliev
  2005-08-29 18:46   ` Ming Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir V. Saveliev @ 2005-08-29 18:01 UTC (permalink / raw)
  To: mingz; +Cc: reiserfs

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
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: tail option limit
  2005-08-29 18:01 ` Vladimir V. Saveliev
@ 2005-08-29 18:46   ` Ming Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Ming Zhang @ 2005-08-29 18:46 UTC (permalink / raw)
  To: Vladimir V. Saveliev; +Cc: reiserfs

On Mon, 2005-08-29 at 22:01 +0400, Vladimir V. Saveliev wrote:
> 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.

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.


> 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) ) ) \
> )
> 

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?

> 
> 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.


> 
> > Thanks!
> > 
> > Ming
> > 
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-29 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-29 14:49 tail option limit Ming Zhang
2005-08-29 18:01 ` Vladimir V. Saveliev
2005-08-29 18:46   ` Ming Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.