aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r--fs/ext3/inode.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 5e0faf4cda79..3451d23c3bae 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -498,7 +498,7 @@ static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block,
498} 498}
499 499
500/** 500/**
501 * ext3_blks_to_allocate: Look up the block map and count the number 501 * ext3_blks_to_allocate - Look up the block map and count the number
502 * of direct blocks need to be allocated for the given branch. 502 * of direct blocks need to be allocated for the given branch.
503 * 503 *
504 * @branch: chain of indirect blocks 504 * @branch: chain of indirect blocks
@@ -536,14 +536,18 @@ static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks,
536} 536}
537 537
538/** 538/**
539 * ext3_alloc_blocks: multiple allocate blocks needed for a branch 539 * ext3_alloc_blocks - multiple allocate blocks needed for a branch
540 * @handle: handle for this transaction
541 * @inode: owner
542 * @goal: preferred place for allocation
540 * @indirect_blks: the number of blocks need to allocate for indirect 543 * @indirect_blks: the number of blocks need to allocate for indirect
541 * blocks 544 * blocks
542 * 545 * @blks: number of blocks need to allocated for direct blocks
543 * @new_blocks: on return it will store the new block numbers for 546 * @new_blocks: on return it will store the new block numbers for
544 * the indirect blocks(if needed) and the first direct block, 547 * the indirect blocks(if needed) and the first direct block,
545 * @blks: on return it will store the total number of allocated 548 * @err: here we store the error value
546 * direct blocks 549 *
550 * return the number of direct blocks allocated
547 */ 551 */
548static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, 552static int ext3_alloc_blocks(handle_t *handle, struct inode *inode,
549 ext3_fsblk_t goal, int indirect_blks, int blks, 553 ext3_fsblk_t goal, int indirect_blks, int blks,
@@ -598,9 +602,11 @@ failed_out:
598 602
599/** 603/**
600 * ext3_alloc_branch - allocate and set up a chain of blocks. 604 * ext3_alloc_branch - allocate and set up a chain of blocks.
605 * @handle: handle for this transaction
601 * @inode: owner 606 * @inode: owner
602 * @indirect_blks: number of allocated indirect blocks 607 * @indirect_blks: number of allocated indirect blocks
603 * @blks: number of allocated direct blocks 608 * @blks: number of allocated direct blocks
609 * @goal: preferred place for allocation
604 * @offsets: offsets (in the blocks) to store the pointers to next. 610 * @offsets: offsets (in the blocks) to store the pointers to next.
605 * @branch: place to store the chain in. 611 * @branch: place to store the chain in.
606 * 612 *
@@ -700,10 +706,9 @@ failed:
700 706
701/** 707/**
702 * ext3_splice_branch - splice the allocated branch onto inode. 708 * ext3_splice_branch - splice the allocated branch onto inode.
709 * @handle: handle for this transaction
703 * @inode: owner 710 * @inode: owner
704 * @block: (logical) number of block we are adding 711 * @block: (logical) number of block we are adding
705 * @chain: chain of indirect blocks (with a missing link - see
706 * ext3_alloc_branch)
707 * @where: location of missing link 712 * @where: location of missing link
708 * @num: number of indirect blocks we are adding 713 * @num: number of indirect blocks we are adding
709 * @blks: number of direct blocks we are adding 714 * @blks: number of direct blocks we are adding
@@ -1696,8 +1701,8 @@ static int ext3_journalled_writepage(struct page *page,
1696 * doesn't seem much point in redirtying the page here. 1701 * doesn't seem much point in redirtying the page here.
1697 */ 1702 */
1698 ClearPageChecked(page); 1703 ClearPageChecked(page);
1699 ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE, 1704 ret = __block_write_begin(page, 0, PAGE_CACHE_SIZE,
1700 ext3_get_block); 1705 ext3_get_block);
1701 if (ret != 0) { 1706 if (ret != 0) {
1702 ext3_journal_stop(handle); 1707 ext3_journal_stop(handle);
1703 goto out_unlock; 1708 goto out_unlock;
@@ -1889,7 +1894,6 @@ static const struct address_space_operations ext3_ordered_aops = {
1889 .readpage = ext3_readpage, 1894 .readpage = ext3_readpage,
1890 .readpages = ext3_readpages, 1895 .readpages = ext3_readpages,
1891 .writepage = ext3_ordered_writepage, 1896 .writepage = ext3_ordered_writepage,
1892 .sync_page = block_sync_page,
1893 .write_begin = ext3_write_begin, 1897 .write_begin = ext3_write_begin,
1894 .write_end = ext3_ordered_write_end, 1898 .write_end = ext3_ordered_write_end,
1895 .bmap = ext3_bmap, 1899 .bmap = ext3_bmap,
@@ -1905,7 +1909,6 @@ static const struct address_space_operations ext3_writeback_aops = {
1905 .readpage = ext3_readpage, 1909 .readpage = ext3_readpage,
1906 .readpages = ext3_readpages, 1910 .readpages = ext3_readpages,
1907 .writepage = ext3_writeback_writepage, 1911 .writepage = ext3_writeback_writepage,
1908 .sync_page = block_sync_page,
1909 .write_begin = ext3_write_begin, 1912 .write_begin = ext3_write_begin,
1910 .write_end = ext3_writeback_write_end, 1913 .write_end = ext3_writeback_write_end,
1911 .bmap = ext3_bmap, 1914 .bmap = ext3_bmap,
@@ -1921,7 +1924,6 @@ static const struct address_space_operations ext3_journalled_aops = {
1921 .readpage = ext3_readpage, 1924 .readpage = ext3_readpage,
1922 .readpages = ext3_readpages, 1925 .readpages = ext3_readpages,
1923 .writepage = ext3_journalled_writepage, 1926 .writepage = ext3_journalled_writepage,
1924 .sync_page = block_sync_page,
1925 .write_begin = ext3_write_begin, 1927 .write_begin = ext3_write_begin,
1926 .write_end = ext3_journalled_write_end, 1928 .write_end = ext3_journalled_write_end,
1927 .set_page_dirty = ext3_journalled_set_page_dirty, 1929 .set_page_dirty = ext3_journalled_set_page_dirty,
@@ -2053,7 +2055,7 @@ static inline int all_zeroes(__le32 *p, __le32 *q)
2053 * 2055 *
2054 * When we do truncate() we may have to clean the ends of several 2056 * When we do truncate() we may have to clean the ends of several
2055 * indirect blocks but leave the blocks themselves alive. Block is 2057 * indirect blocks but leave the blocks themselves alive. Block is
2056 * partially truncated if some data below the new i_size is refered 2058 * partially truncated if some data below the new i_size is referred
2057 * from it (and it is on the path to the first completely truncated 2059 * from it (and it is on the path to the first completely truncated
2058 * data block, indeed). We have to free the top of that path along 2060 * data block, indeed). We have to free the top of that path along
2059 * with everything to the right of the path. Since no allocation 2061 * with everything to the right of the path. Since no allocation
@@ -2140,13 +2142,15 @@ static void ext3_clear_blocks(handle_t *handle, struct inode *inode,
2140 if (try_to_extend_transaction(handle, inode)) { 2142 if (try_to_extend_transaction(handle, inode)) {
2141 if (bh) { 2143 if (bh) {
2142 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata"); 2144 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
2143 ext3_journal_dirty_metadata(handle, bh); 2145 if (ext3_journal_dirty_metadata(handle, bh))
2146 return;
2144 } 2147 }
2145 ext3_mark_inode_dirty(handle, inode); 2148 ext3_mark_inode_dirty(handle, inode);
2146 truncate_restart_transaction(handle, inode); 2149 truncate_restart_transaction(handle, inode);
2147 if (bh) { 2150 if (bh) {
2148 BUFFER_TRACE(bh, "retaking write access"); 2151 BUFFER_TRACE(bh, "retaking write access");
2149 ext3_journal_get_write_access(handle, bh); 2152 if (ext3_journal_get_write_access(handle, bh))
2153 return;
2150 } 2154 }
2151 } 2155 }
2152 2156
@@ -2180,7 +2184,7 @@ static void ext3_clear_blocks(handle_t *handle, struct inode *inode,
2180 * @first: array of block numbers 2184 * @first: array of block numbers
2181 * @last: points immediately past the end of array 2185 * @last: points immediately past the end of array
2182 * 2186 *
2183 * We are freeing all blocks refered from that array (numbers are stored as 2187 * We are freeing all blocks referred from that array (numbers are stored as
2184 * little-endian 32-bit) and updating @inode->i_blocks appropriately. 2188 * little-endian 32-bit) and updating @inode->i_blocks appropriately.
2185 * 2189 *
2186 * We accumulate contiguous runs of blocks to free. Conveniently, if these 2190 * We accumulate contiguous runs of blocks to free. Conveniently, if these
@@ -2268,7 +2272,7 @@ static void ext3_free_data(handle_t *handle, struct inode *inode,
2268 * @last: pointer immediately past the end of array 2272 * @last: pointer immediately past the end of array
2269 * @depth: depth of the branches to free 2273 * @depth: depth of the branches to free
2270 * 2274 *
2271 * We are freeing all blocks refered from these branches (numbers are 2275 * We are freeing all blocks referred from these branches (numbers are
2272 * stored as little-endian 32-bit) and updating @inode->i_blocks 2276 * stored as little-endian 32-bit) and updating @inode->i_blocks
2273 * appropriately. 2277 * appropriately.
2274 */ 2278 */
@@ -2530,7 +2534,6 @@ void ext3_truncate(struct inode *inode)
2530 */ 2534 */
2531 } else { 2535 } else {
2532 /* Shared branch grows from an indirect block */ 2536 /* Shared branch grows from an indirect block */
2533 BUFFER_TRACE(partial->bh, "get_write_access");
2534 ext3_free_branches(handle, inode, partial->bh, 2537 ext3_free_branches(handle, inode, partial->bh,
2535 partial->p, 2538 partial->p,
2536 partial->p+1, (chain+n-1) - partial); 2539 partial->p+1, (chain+n-1) - partial);
@@ -3288,7 +3291,7 @@ static int ext3_writepage_trans_blocks(struct inode *inode)
3288 if (ext3_should_journal_data(inode)) 3291 if (ext3_should_journal_data(inode))
3289 ret = 3 * (bpp + indirects) + 2; 3292 ret = 3 * (bpp + indirects) + 2;
3290 else 3293 else
3291 ret = 2 * (bpp + indirects) + 2; 3294 ret = 2 * (bpp + indirects) + indirects + 2;
3292 3295
3293#ifdef CONFIG_QUOTA 3296#ifdef CONFIG_QUOTA
3294 /* We know that structure was already allocated during dquot_initialize so 3297 /* We know that structure was already allocated during dquot_initialize so
@@ -3389,7 +3392,7 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode)
3389 * so would cause a commit on atime updates, which we don't bother doing. 3392 * so would cause a commit on atime updates, which we don't bother doing.
3390 * We handle synchronous inodes at the highest possible level. 3393 * We handle synchronous inodes at the highest possible level.
3391 */ 3394 */
3392void ext3_dirty_inode(struct inode *inode) 3395void ext3_dirty_inode(struct inode *inode, int flags)
3393{ 3396{
3394 handle_t *current_handle = ext3_journal_current_handle(); 3397 handle_t *current_handle = ext3_journal_current_handle();
3395 handle_t *handle; 3398 handle_t *handle;