Re: [RFC] Implement ->page_mkwrite for XFS
From: David Chinner <hidden>
Date: 2007-02-07 11:55:53
Also in:
linux-fsdevel, linux-xfs
On Wed, Feb 07, 2007 at 10:18:23AM +0000, Christoph Hellwig wrote:
This looks to me. But given that this is generic code except for the
get_block callback, shouldn't we put the guts into buffer.c and wire
all filesystems up to use it? e.g.
int block_page_mkwrite(struct vm_area_struct *vma, struct page *page,
get_block_t get_block)
{
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
unsigned long end;
int ret = 0;
if ((page->index + 1) << PAGE_CACHE_SHIFT > i_size_read(inode))
end = i_size_read(inode) & ~PAGE_CACHE_MASK;
else
end = PAGE_CACHE_SIZE;
lock_page(page);
ret = block_prepare_write(page, 0, end, block);
if (!ret)
ret = block_commit_write(page, 0, end);
unlock_page(page);
return ret;
}
and then in xfs and similar in other filesystems:
STATIC int
xfs_vm_page_mkwrite(
struct vm_area_struct *vma,
struct page *page)
{
return block_page_mkwrite(vma, page, xfs_get_blocks);
}Yes, that can be done. block_page_mkwrite() would then go into fs/buffer.c? My patch originally had a bunch of other stuff and i wasn't sure that it could be done with generic code. I'll send an updated patch in a little while.
BTW, why is xfs_get_blocks not called xfs_get_block?
<shrug> I presume because it replaced the xfs_get_block() function when the block mapping callouts were modified to support mapping of multiple blocks. Maybe you should ask Nathan that question. ;) Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>