EXT2_ALLOC_BRANCH

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

 

NAME

ext2_alloc_branch - allocate and set up a chain of blocks.  

SYNOPSIS

"SYNOPSIS"

int ext2_alloc_branch (struct inode * inode, int num, unsigned long goal, int * offsets, Indirect * branch);  

ARGUMENTS

inode
owner
num
depth of the chain (number of blocks to allocate)
goal
-- undescribed --
offsets
offsets (in the blocks) to store the pointers to next.
branch
place to store the chain in.
 

DESCRIPTION

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 ext2_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 ext2_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 ext2_alloc_block (normally -ENOSPC). Otherwise we set the chain as described above and return 0.


 

Index

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION

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