aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2009-06-14 17:59:34 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-06-14 17:59:34 -0400
commit62e086be5d2abef8cad854bc5707329ad345f2ec (patch)
tree1f3ea5daf9325a338585e1368edf78a1d04747df
parent43ce1d23b43330634507a049b55c36e91d27282e (diff)
ext4: Move __ext4_journalled_writepage() to avoid forward declaration
In addition, fix two unused variable warnings. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/inode.c112
1 files changed, 54 insertions, 58 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 97c48b5b0578..c98e3afea30a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -47,10 +47,6 @@
47 47
48#define MPAGE_DA_EXTENT_TAIL 0x01 48#define MPAGE_DA_EXTENT_TAIL 0x01
49 49
50static int __ext4_journalled_writepage(struct page *page,
51 struct writeback_control *wbc,
52 unsigned int len);
53
54static inline int ext4_begin_ordered_truncate(struct inode *inode, 50static inline int ext4_begin_ordered_truncate(struct inode *inode,
55 loff_t new_size) 51 loff_t new_size)
56{ 52{
@@ -2522,6 +2518,59 @@ static int noalloc_get_block_write(struct inode *inode, sector_t iblock,
2522 return ret; 2518 return ret;
2523} 2519}
2524 2520
2521static int bget_one(handle_t *handle, struct buffer_head *bh)
2522{
2523 get_bh(bh);
2524 return 0;
2525}
2526
2527static int bput_one(handle_t *handle, struct buffer_head *bh)
2528{
2529 put_bh(bh);
2530 return 0;
2531}
2532
2533static int __ext4_journalled_writepage(struct page *page,
2534 struct writeback_control *wbc,
2535 unsigned int len)
2536{
2537 struct address_space *mapping = page->mapping;
2538 struct inode *inode = mapping->host;
2539 struct buffer_head *page_bufs;
2540 handle_t *handle = NULL;
2541 int ret = 0;
2542 int err;
2543
2544 page_bufs = page_buffers(page);
2545 BUG_ON(!page_bufs);
2546 walk_page_buffers(handle, page_bufs, 0, len, NULL, bget_one);
2547 /* As soon as we unlock the page, it can go away, but we have
2548 * references to buffers so we are safe */
2549 unlock_page(page);
2550
2551 handle = ext4_journal_start(inode, ext4_writepage_trans_blocks(inode));
2552 if (IS_ERR(handle)) {
2553 ret = PTR_ERR(handle);
2554 goto out;
2555 }
2556
2557 ret = walk_page_buffers(handle, page_bufs, 0, len, NULL,
2558 do_journal_get_write_access);
2559
2560 err = walk_page_buffers(handle, page_bufs, 0, len, NULL,
2561 write_end_fn);
2562 if (ret == 0)
2563 ret = err;
2564 err = ext4_journal_stop(handle);
2565 if (!ret)
2566 ret = err;
2567
2568 walk_page_buffers(handle, page_bufs, 0, len, NULL, bput_one);
2569 EXT4_I(inode)->i_state |= EXT4_STATE_JDATA;
2570out:
2571 return ret;
2572}
2573
2525/* 2574/*
2526 * Note that we don't need to start a transaction unless we're journaling data 2575 * Note that we don't need to start a transaction unless we're journaling data
2527 * because we should have holes filled from ext4_page_mkwrite(). We even don't 2576 * because we should have holes filled from ext4_page_mkwrite(). We even don't
@@ -2564,7 +2613,7 @@ static int noalloc_get_block_write(struct inode *inode, sector_t iblock,
2564 * Page also have the dirty flag cleared so we don't get recurive page_lock. 2613 * Page also have the dirty flag cleared so we don't get recurive page_lock.
2565 */ 2614 */
2566static int ext4_writepage(struct page *page, 2615static int ext4_writepage(struct page *page,
2567 struct writeback_control *wbc) 2616 struct writeback_control *wbc)
2568{ 2617{
2569 int ret = 0; 2618 int ret = 0;
2570 loff_t size; 2619 loff_t size;
@@ -3170,59 +3219,6 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
3170 return generic_block_bmap(mapping, block, ext4_get_block); 3219 return generic_block_bmap(mapping, block, ext4_get_block);
3171} 3220}
3172 3221
3173static int bget_one(handle_t *handle, struct buffer_head *bh)
3174{
3175 get_bh(bh);
3176 return 0;
3177}
3178
3179static int bput_one(handle_t *handle, struct buffer_head *bh)
3180{
3181 put_bh(bh);
3182 return 0;
3183}
3184
3185static int __ext4_journalled_writepage(struct page *page,
3186 struct writeback_control *wbc,
3187 unsigned int len)
3188{
3189 struct address_space *mapping = page->mapping;
3190 struct inode *inode = mapping->host;
3191 struct buffer_head *page_bufs;
3192 handle_t *handle = NULL;
3193 int ret = 0;
3194 int err;
3195
3196 page_bufs = page_buffers(page);
3197 BUG_ON(!page_bufs);
3198 walk_page_buffers(handle, page_bufs, 0, len, NULL, bget_one);
3199 /* As soon as we unlock the page, it can go away, but we have
3200 * references to buffers so we are safe */
3201 unlock_page(page);
3202
3203 handle = ext4_journal_start(inode, ext4_writepage_trans_blocks(inode));
3204 if (IS_ERR(handle)) {
3205 ret = PTR_ERR(handle);
3206 goto out;
3207 }
3208
3209 ret = walk_page_buffers(handle, page_bufs, 0, len, NULL,
3210 do_journal_get_write_access);
3211
3212 err = walk_page_buffers(handle, page_bufs, 0, len, NULL,
3213 write_end_fn);
3214 if (ret == 0)
3215 ret = err;
3216 err = ext4_journal_stop(handle);
3217 if (!ret)
3218 ret = err;
3219
3220 walk_page_buffers(handle, page_bufs, 0, len, NULL, bput_one);
3221 EXT4_I(inode)->i_state |= EXT4_STATE_JDATA;
3222out:
3223 return ret;
3224}
3225
3226static int ext4_readpage(struct file *file, struct page *page) 3222static int ext4_readpage(struct file *file, struct page *page)
3227{ 3223{
3228 return mpage_readpage(page, ext4_get_block); 3224 return mpage_readpage(page, ext4_get_block);