fs: kill block_prepare_write
__block_write_begin and block_prepare_write are identical except for slightly different calling conventions. Convert all callers to the __block_write_begin calling conventions and drop block_prepare_write. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
committed by
Al Viro
parent
56b0dacfa2
commit
ebdec241d5
@ -22,8 +22,6 @@
|
||||
|
||||
int reiserfs_commit_write(struct file *f, struct page *page,
|
||||
unsigned from, unsigned to);
|
||||
int reiserfs_prepare_write(struct file *f, struct page *page,
|
||||
unsigned from, unsigned to);
|
||||
|
||||
void reiserfs_evict_inode(struct inode *inode)
|
||||
{
|
||||
@ -165,7 +163,7 @@ inline void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
|
||||
** but tail is still sitting in a direct item, and we can't write to
|
||||
** it. So, look through this page, and check all the mapped buffers
|
||||
** to make sure they have valid block numbers. Any that don't need
|
||||
** to be unmapped, so that block_prepare_write will correctly call
|
||||
** to be unmapped, so that __block_write_begin will correctly call
|
||||
** reiserfs_get_block to convert the tail into an unformatted node
|
||||
*/
|
||||
static inline void fix_tail_page_for_writing(struct page *page)
|
||||
@ -439,13 +437,13 @@ static int reiserfs_bmap(struct inode *inode, sector_t block,
|
||||
}
|
||||
|
||||
/* special version of get_block that is only used by grab_tail_page right
|
||||
** now. It is sent to block_prepare_write, and when you try to get a
|
||||
** now. It is sent to __block_write_begin, and when you try to get a
|
||||
** block past the end of the file (or a block from a hole) it returns
|
||||
** -ENOENT instead of a valid buffer. block_prepare_write expects to
|
||||
** -ENOENT instead of a valid buffer. __block_write_begin expects to
|
||||
** be able to do i/o on the buffers returned, unless an error value
|
||||
** is also returned.
|
||||
**
|
||||
** So, this allows block_prepare_write to be used for reading a single block
|
||||
** So, this allows __block_write_begin to be used for reading a single block
|
||||
** in a page. Where it does not produce a valid page for holes, or past the
|
||||
** end of the file. This turns out to be exactly what we need for reading
|
||||
** tails for conversion.
|
||||
@ -558,11 +556,12 @@ static int convert_tail_for_hole(struct inode *inode,
|
||||
**
|
||||
** We must fix the tail page for writing because it might have buffers
|
||||
** that are mapped, but have a block number of 0. This indicates tail
|
||||
** data that has been read directly into the page, and block_prepare_write
|
||||
** won't trigger a get_block in this case.
|
||||
** data that has been read directly into the page, and
|
||||
** __block_write_begin won't trigger a get_block in this case.
|
||||
*/
|
||||
fix_tail_page_for_writing(tail_page);
|
||||
retval = reiserfs_prepare_write(NULL, tail_page, tail_start, tail_end);
|
||||
retval = __reiserfs_write_begin(tail_page, tail_start,
|
||||
tail_end - tail_start);
|
||||
if (retval)
|
||||
goto unlock;
|
||||
|
||||
@ -2033,7 +2032,7 @@ static int grab_tail_page(struct inode *inode,
|
||||
/* start within the page of the last block in the file */
|
||||
start = (offset / blocksize) * blocksize;
|
||||
|
||||
error = block_prepare_write(page, start, offset,
|
||||
error = __block_write_begin(page, start, offset - start,
|
||||
reiserfs_get_block_create_0);
|
||||
if (error)
|
||||
goto unlock;
|
||||
@ -2628,8 +2627,7 @@ static int reiserfs_write_begin(struct file *file,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int reiserfs_prepare_write(struct file *f, struct page *page,
|
||||
unsigned from, unsigned to)
|
||||
int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len)
|
||||
{
|
||||
struct inode *inode = page->mapping->host;
|
||||
int ret;
|
||||
@ -2650,7 +2648,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
|
||||
th->t_refcount++;
|
||||
}
|
||||
|
||||
ret = block_prepare_write(page, from, to, reiserfs_get_block);
|
||||
ret = __block_write_begin(page, from, len, reiserfs_get_block);
|
||||
if (ret && reiserfs_transaction_running(inode->i_sb)) {
|
||||
struct reiserfs_transaction_handle *th = current->journal_info;
|
||||
/* this gets a little ugly. If reiserfs_get_block returned an
|
||||
|
Reference in New Issue
Block a user