EXT2_FIND_SHARED

Section: ()
Updated: 06 October 2005
Index Return to Main Contents

 

NAME

ext2_find_shared - find the indirect blocks for partial truncation.  

SYNOPSIS

"SYNOPSIS"

Indirect * ext2_find_shared (struct inode * inode, int depth, int * offsets, Indirect * chain, u32 * top);  

ARGUMENTS

inode
inode in question
depth
depth of the affected branch
offsets
offsets of pointers in that branch (see ext2_block_to_path)
chain
place to store the pointers to partial indirect blocks
top
place to the (detached) top of branch
 

DESCRIPTION

This is a helper function used by ext2_truncate.

When we do truncate we may have to clean the ends of several indirect blocks but leave the blocks themselves alive. Block is partially truncated if some data below the new i_size is refered from it (and it is on the path to the first completely truncated data block, indeed). We have to free the top of that path along with everything to the right of the path. Since no allocation past the truncation point is possible until ext2_truncate finishes, we may safely do the latter, but top of branch may require special attention - pageout below the truncation point might try to populate it.

We atomically detach the top of branch from the tree, store the block number of its root in *top, pointers to buffer_heads of partially truncated blocks - in chain[].bh and pointers to their last elements that should not be removed - in chain[].p. Return value is the pointer to last filled element of chain.  

THE WORK LEFT TO CALLER TO DO THE ACTUAL FREEING OF SUBTREES

a) free the subtree starting from *top b) free the subtrees whose roots are stored in (chain[i].p+1 .. end of chain[i].bh->b_data) c) free the subtrees growing from the inode past the chain[0].p (no partially truncated stuff there).


 

Index

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
THE WORK LEFT TO CALLER TO DO THE ACTUAL FREEING OF SUBTREES

This document was created by man2html, using the manual pages.
Time: 07:07:06 GMT, October 06, 2005