Re: [PATCH] ext4: Use page_mkwrite vma_operations to get mmap write notification.

Aneesh Kumar K.V
2008-02-22T18:23:23Z

On Fri, Feb 22, 2008 at 10:10:48AM -0800, Mingming Cao wrote:
> On Fri, 2008-02-22 at 20:09 +0530, Aneesh Kumar K.V wrote:

.....

> > + ext4_journal_stop(handle);
> > + goto out_unlock;
> > + }
> > + if (!ret && ext4_should_order_data(inode)) {
> > + ret = walk_page_buffers(handle, page_buffers(page),
> > + 0, end, NULL, ext4_journal_dirty_data);
> > + }
> > + if (!ret)
> > + ret = block_commit_write(page, 0, end);
> > +
> Hmm, it seems wired to do commit_write when the page is about becoming
> writable, but maybe that's the way it needs to?
>
> Don't we need to update the i_size somewhere?

block_commit_write simply iterate over buffer_head of page and mark them
dirty. That is why we don't want to call that for data=journalled mode.

>
> > + ext4_journal_stop(handle);
> > +out_unlock:
> > + unlock_page(page);
> > + mutex_unlock(&inode->i_mutex);
> > + return ret;
> > +}
>
> It seems this combined the three journalling mode prepare_write() code
> here:(
>
> Since prepare_write() and commit_write() is going to sunset, why not
> simply calling mappings->a_ops->write_begin() and then write_end()? that
> should take care of pretty much the journalling and the page operations,
> no?

write_begin and write_end works with the user space buffer. In this case
we don't have one. Also what ext4_page_mkwrite does is mostly what
write_begin/write_end does except the copy of user space buffer.

-aneesh