int ext3_alloc_branch (handle_t * handle, struct inode * inode, int num, unsigned long goal, int * offsets, Indirect * branch);
This function allocates num 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 ext3_get_branch 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 ext3_get_block, 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.
If allocation fails we free all blocks we've allocated (and forget their buffer_heads) and return the error value the from failed ext3_alloc_block (normally -ENOSPC). Otherwise we set the chain as described above and return 0.