From f4e420dc423148fba637af1ab618fa8896dfb2d6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 4 Jun 2010 11:29:56 +0200 Subject: clean up write_begin usage for directories in pagecache For filesystem that implement directories in pagecache we call block_write_begin with an already allocated page for this code, while the normal regular file write path uses the default block_write_begin behaviour. Get rid of the __foofs_write_begin helper and opencode the normal write_begin call in foofs_write_begin, while adding a new foofs_prepare_chunk helper for the directory code. The added benefit is that foofs_prepare_chunk has a much saner calling convention. Note that the interruptible flag passed into block_write_begin is always ignored if we already pass in a page (see next patch for details), and we never were doing truncations of exessive blocks for this case either so we can switch directly to block_write_begin_newtrunc. Signed-off-by: Christoph Hellwig Signed-off-by: Al Viro --- fs/ufs/inode.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'fs/ufs/inode.c') diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 73fe773aa03..a9555b1ffd2 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -558,12 +558,10 @@ static int ufs_readpage(struct file *file, struct page *page) return block_read_full_page(page,ufs_getfrag_block); } -int __ufs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata) +int ufs_prepare_chunk(struct page *page, loff_t pos, unsigned len) { - return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, - ufs_getfrag_block); + return block_write_begin_newtrunc(NULL, page->mapping, pos, len, 0, + &page, NULL, ufs_getfrag_block); } static int ufs_write_begin(struct file *file, struct address_space *mapping, @@ -571,7 +569,8 @@ static int ufs_write_begin(struct file *file, struct address_space *mapping, struct page **pagep, void **fsdata) { *pagep = NULL; - return __ufs_write_begin(file, mapping, pos, len, flags, pagep, fsdata); + return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, + ufs_getfrag_block); } static sector_t ufs_bmap(struct address_space *mapping, sector_t block) -- cgit v1.2.3