On Wed, 26 Jul 2000, Daniel Phillips wrote:

> I don't know exactly what ReiserFS does - I just heard Hans mention the term
> 'tail merging' and I could see that it was a good idea.
> 

I'll give the quick and dirty answer, if people want more details, let me
know.  In 2.2, reiserfs_file_write deals directly with tails.  It appends
to them if there is room in the packed block, or converts them if there
isn't.  If reiserfs_file_write is called with a buffer size > 512 bytes,
it tries to write into full blocks instead of tails.  This limits the
overhead when you cp/untar to create new files.

In both releases, there is locking on the tail to prevent races, and we
don't bother with tails on files > 16k (configurable).  

For 2.4, the functions work like this:

reiserfs_get_block converts the tail into its own block and points
the buffer head at the new block.

reiserfs_readpage reads directly from the tail into the page, leaves the
buffer head mapped, and sets b_blocknr to 0.

reiserfs_writepage and reiserfs_prepare_write both check for mapped buffer
heads with a block number of 0 in the page.  If found, they are unmapped.
Then block_write_full_page or block_prepare_write is called.

reiserfs_truncate deals directly with the tail.  If the last block is
packed back into the tail, it is unmapped from the page cache.

reiserfs_file_release will check to see if the tail needs to be repacked,
and use truncate (without changing i_size) to pack the tail.

-chris



Reply via email to