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>
This commit is contained in:
parent
43ce1d23b4
commit
62e086be5d
112
fs/ext4/inode.c
112
fs/ext4/inode.c
|
@ -47,10 +47,6 @@
|
|||
|
||||
#define MPAGE_DA_EXTENT_TAIL 0x01
|
||||
|
||||
static int __ext4_journalled_writepage(struct page *page,
|
||||
struct writeback_control *wbc,
|
||||
unsigned int len);
|
||||
|
||||
static inline int ext4_begin_ordered_truncate(struct inode *inode,
|
||||
loff_t new_size)
|
||||
{
|
||||
|
@ -2522,6 +2518,59 @@ static int noalloc_get_block_write(struct inode *inode, sector_t iblock,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int bget_one(handle_t *handle, struct buffer_head *bh)
|
||||
{
|
||||
get_bh(bh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bput_one(handle_t *handle, struct buffer_head *bh)
|
||||
{
|
||||
put_bh(bh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __ext4_journalled_writepage(struct page *page,
|
||||
struct writeback_control *wbc,
|
||||
unsigned int len)
|
||||
{
|
||||
struct address_space *mapping = page->mapping;
|
||||
struct inode *inode = mapping->host;
|
||||
struct buffer_head *page_bufs;
|
||||
handle_t *handle = NULL;
|
||||
int ret = 0;
|
||||
int err;
|
||||
|
||||
page_bufs = page_buffers(page);
|
||||
BUG_ON(!page_bufs);
|
||||
walk_page_buffers(handle, page_bufs, 0, len, NULL, bget_one);
|
||||
/* As soon as we unlock the page, it can go away, but we have
|
||||
* references to buffers so we are safe */
|
||||
unlock_page(page);
|
||||
|
||||
handle = ext4_journal_start(inode, ext4_writepage_trans_blocks(inode));
|
||||
if (IS_ERR(handle)) {
|
||||
ret = PTR_ERR(handle);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = walk_page_buffers(handle, page_bufs, 0, len, NULL,
|
||||
do_journal_get_write_access);
|
||||
|
||||
err = walk_page_buffers(handle, page_bufs, 0, len, NULL,
|
||||
write_end_fn);
|
||||
if (ret == 0)
|
||||
ret = err;
|
||||
err = ext4_journal_stop(handle);
|
||||
if (!ret)
|
||||
ret = err;
|
||||
|
||||
walk_page_buffers(handle, page_bufs, 0, len, NULL, bput_one);
|
||||
EXT4_I(inode)->i_state |= EXT4_STATE_JDATA;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that we don't need to start a transaction unless we're journaling data
|
||||
* 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,
|
|||
* Page also have the dirty flag cleared so we don't get recurive page_lock.
|
||||
*/
|
||||
static int ext4_writepage(struct page *page,
|
||||
struct writeback_control *wbc)
|
||||
struct writeback_control *wbc)
|
||||
{
|
||||
int ret = 0;
|
||||
loff_t size;
|
||||
|
@ -3170,59 +3219,6 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
|
|||
return generic_block_bmap(mapping, block, ext4_get_block);
|
||||
}
|
||||
|
||||
static int bget_one(handle_t *handle, struct buffer_head *bh)
|
||||
{
|
||||
get_bh(bh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bput_one(handle_t *handle, struct buffer_head *bh)
|
||||
{
|
||||
put_bh(bh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __ext4_journalled_writepage(struct page *page,
|
||||
struct writeback_control *wbc,
|
||||
unsigned int len)
|
||||
{
|
||||
struct address_space *mapping = page->mapping;
|
||||
struct inode *inode = mapping->host;
|
||||
struct buffer_head *page_bufs;
|
||||
handle_t *handle = NULL;
|
||||
int ret = 0;
|
||||
int err;
|
||||
|
||||
page_bufs = page_buffers(page);
|
||||
BUG_ON(!page_bufs);
|
||||
walk_page_buffers(handle, page_bufs, 0, len, NULL, bget_one);
|
||||
/* As soon as we unlock the page, it can go away, but we have
|
||||
* references to buffers so we are safe */
|
||||
unlock_page(page);
|
||||
|
||||
handle = ext4_journal_start(inode, ext4_writepage_trans_blocks(inode));
|
||||
if (IS_ERR(handle)) {
|
||||
ret = PTR_ERR(handle);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = walk_page_buffers(handle, page_bufs, 0, len, NULL,
|
||||
do_journal_get_write_access);
|
||||
|
||||
err = walk_page_buffers(handle, page_bufs, 0, len, NULL,
|
||||
write_end_fn);
|
||||
if (ret == 0)
|
||||
ret = err;
|
||||
err = ext4_journal_stop(handle);
|
||||
if (!ret)
|
||||
ret = err;
|
||||
|
||||
walk_page_buffers(handle, page_bufs, 0, len, NULL, bput_one);
|
||||
EXT4_I(inode)->i_state |= EXT4_STATE_JDATA;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ext4_readpage(struct file *file, struct page *page)
|
||||
{
|
||||
return mpage_readpage(page, ext4_get_block);
|
||||
|
|
Loading…
Reference in New Issue