• Evgeniy Dushistov's avatar
    [PATCH] ufs: change block number on the fly · 6ef4d6bf
    Evgeniy Dushistov authored
    First of all some necessary notes about UFS by it self: To avoid waste of disk
    space the tail of file consists not from blocks (which is ordinary big enough,
    16K usually), it consists from fragments(which is ordinary 2K).  When file is
    growing its tail occupy 1 fragment, 2 fragments...  At some stage decision to
    allocate whole block is made and all fragments are moved to one block.
    How this situation was handled before:
    	bh = sb_bread
    	bh->b_blocknr = result + i;
    	mark_buffer_dirty (bh);
    This is wrong solution, because:
    - it didn't take into consideration that there is another cache: "inode page
    - because of sb_getblk uses not b_blocknr, (it uses page->index) to find
      certain block, this breaks sb_getblk.
    How this situation is handled now: we go though all "page inode cache", if
    there are no such page in cache we load it into cache, and change b_blocknr.
    Signed-off-by: default avatarEvgeniy Dushistov <dushistov@mail.ru>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>