.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
.TH "EXT3_FIND_SHARED" "" "06 October 2005" "" ""
.SH NAME
ext3_find_shared \- find the indirect blocks for partial truncation.
.SH SYNOPSIS
"SYNOPSIS"
.sp
\fB
.sp
Indirect * ext3_find_shared (struct inode * \fIinode\fB, int \fIdepth\fB, int * \fIoffsets\fB, Indirect * \fIchain\fB, u32 * \fItop\fB);
\fR
.SH "ARGUMENTS"
.TP
\fB\fIinode\fB\fR
inode in question
.TP
\fB\fIdepth\fB\fR
depth of the affected branch
.TP
\fB\fIoffsets\fB\fR
offsets of pointers in that branch (see ext3_block_to_path)
.TP
\fB\fIchain\fB\fR
place to store the pointers to partial indirect blocks
.TP
\fB\fItop\fB\fR
place to the (detached) top of branch
.SH "DESCRIPTION"
.PP
This is a helper function used by \fBext3_truncate\fR\&.
.PP
When we do \fBtruncate\fR 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 \fBext3_truncate\fR
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.
.PP
We atomically detach the top of branch from the tree, store the
block number of its root in *\fItop\fR, pointers to buffer_heads of
partially truncated blocks - in \fIchain\fR[].bh and pointers to
their last elements that should not be removed - in
\fIchain\fR[].p. Return value is the pointer to last filled element
of \fIchain\fR\&.
.SH "THE WORK LEFT TO CALLER TO DO THE ACTUAL FREEING OF SUBTREES"
.PP
a) free the subtree starting from *\fItop\fR
b) free the subtrees whose roots are stored in
(\fIchain\fR[i].p+1 .. end of \fIchain\fR[i].bh->b_data)
c) free the subtrees growing from the inode past the \fIchain\fR[0].