Indirect * ext2_find_shared (struct inode * inode, int depth, int * offsets, Indirect * chain, u32 * top);
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.
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).