Maps all unmapped but prepared pages from the list.
Updates metadata with newly allocated blocknumbers as needed */
intreiserfs_allocate_blocks_for_region(
structreiserfs_transaction_handle*th,
structinode*inode,/* Inode we work with */
loff_tpos,/* Writing position */
intnum_pages,/* number of pages write going
...
...
@@ -167,7 +170,6 @@ int reiserfs_allocate_blocks_for_region(
structcpu_keykey;// cpu key of item that we are going to deal with
structitem_head*ih;// pointer to item head that we are going to deal with
structbuffer_head*bh;// Buffer head that contains items that we are going to deal with
structreiserfs_transaction_handleth;// transaction handle for transaction we are going to create.
__u32*item;// pointer to item we are going to deal with
INITIALIZE_PATH(path);// path to item, that we are going to deal with.
b_blocknr_tallocated_blocks[blocks_to_allocate];// Pointer to a place where allocated blocknumbers would be stored. Right now statically allocated, later that will change.
...
...
@@ -194,7 +196,7 @@ int reiserfs_allocate_blocks_for_region(
/* If we came here, it means we absolutely need to open a transaction,
since we need to allocate some blocks */
reiserfs_write_lock(inode->i_sb);// Journaling stuff and we need that.
journal_begin(&th,inode->i_sb,JOURNAL_PER_BALANCE_CNT*3+1);// Wish I know if this number enough
journal_begin(th,inode->i_sb,JOURNAL_PER_BALANCE_CNT*3+1);// Wish I know if this number enough
reiserfs_update_inode_transaction(inode);
/* Look for the in-tree position of our write, need path for block allocator */
...
...
@@ -206,7 +208,7 @@ int reiserfs_allocate_blocks_for_region(
/* Allocate blocks */
/* First fill in "hint" structure for block allocator */
hint.th=&th;// transaction handle.
hint.th=th;// transaction handle.
hint.path=&path;// Path, so that block allocator can determine packing locality or whatever it needs to determine.
hint.inode=inode;// Inode is needed by block allocator too.
hint.search_start=0;// We have no hint on where to search free blocks for block allocator.
...
...
@@ -222,7 +224,7 @@ int reiserfs_allocate_blocks_for_region(
/* We flush the transaction in case of no space. This way some