linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Chinner <dgc@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: David Chinner <dgc@sgi.com>,
	xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [RFC] Implement ->page_mkwrite for XFS
Date: Wed, 7 Feb 2007 22:55:21 +1100	[thread overview]
Message-ID: <20070207115521.GH44411608@melbourne.sgi.com> (raw)
In-Reply-To: <20070207101823.GA2703@infradead.org>

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>

      reply	other threads:[~2007-02-07 11:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-06 22:53 David Chinner
2007-02-07 10:18 ` Christoph Hellwig
2007-02-07 11:55   ` David Chinner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070207115521.GH44411608@melbourne.sgi.com \
    --to=dgc@sgi.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox