.\" 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 "EXT2_ALLOC_BRANCH" "" "06 October 2005" "" "" .SH NAME ext2_alloc_branch \- allocate and set up a chain of blocks. .SH SYNOPSIS "SYNOPSIS" .sp \fB .sp int ext2_alloc_branch (struct inode * \fIinode\fB, int \fInum\fB, unsigned long \fIgoal\fB, int * \fIoffsets\fB, Indirect * \fIbranch\fB); \fR .SH "ARGUMENTS" .TP \fB\fIinode\fB\fR owner .TP \fB\fInum\fB\fR depth of the chain (number of blocks to allocate) .TP \fB\fIgoal\fB\fR -- undescribed -- .TP \fB\fIoffsets\fB\fR offsets (in the blocks) to store the pointers to next. .TP \fB\fIbranch\fB\fR place to store the chain in. .SH "DESCRIPTION" .PP This function allocates \fInum\fR blocks, zeroes out all but the last one, links them into chain and (if we are synchronous) writes them to disk. In other words, it prepares a branch that can be spliced onto the inode. It stores the information about that chain in the branch[], in the same format as \fBext2_get_branch\fR would do. We are calling it after we had read the existing part of chain and partial points to the last triple of that (one with zero ->key). Upon the exit we have the same picture as after the successful \fBext2_get_block\fR, excpet that in one place chain is disconnected - *branch->p is still zero (we did not set the last link), but branch->key contains the number that should be placed into *branch->p to fill that gap. .PP If allocation fails we free all blocks we've allocated (and forget their buffer_heads) and return the error value the from failed \fBext2_alloc_block\fR (normally -ENOSPC). Otherwise we set the chain as described above and return 0.