ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 4/4] ocfs2: make mmap CoW work with readahead.
Date: Tue, 29 Jun 2010 16:35:41 +0800	[thread overview]
Message-ID: <1277800541-6844-4-git-send-email-tao.ma@oracle.com> (raw)
In-Reply-To: <4C29AE6C.1050205@oracle.com>

refcount_cow need file * to do the readahead.
So we just add 'struct file *' to ocfs2_write_begin_nolock
and __ocfs2_page_mkwrite and let them pass this parameter
to ocfs2_refcount_cow.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
 fs/ocfs2/aops.c |    7 ++++---
 fs/ocfs2/aops.h |    3 ++-
 fs/ocfs2/mmap.c |    8 ++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 5f94923..337e874 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -1645,7 +1645,8 @@ static int ocfs2_expand_nonsparse_inode(struct inode *inode, loff_t pos,
 	return ret;
 }
 
-int ocfs2_write_begin_nolock(struct address_space *mapping,
+int ocfs2_write_begin_nolock(struct file *file,
+			     struct address_space *mapping,
 			     loff_t pos, unsigned len, unsigned flags,
 			     struct page **pagep, void **fsdata,
 			     struct buffer_head *di_bh, struct page *mmap_page)
@@ -1691,7 +1692,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
 		mlog_errno(ret);
 		goto out;
 	} else if (ret == 1) {
-		ret = ocfs2_refcount_cow(inode, NULL, di_bh,
+		ret = ocfs2_refcount_cow(inode, file, di_bh,
 					 wc->w_cpos, wc->w_clen, UINT_MAX);
 		if (ret) {
 			mlog_errno(ret);
@@ -1853,7 +1854,7 @@ static int ocfs2_write_begin(struct file *file, struct address_space *mapping,
 	 */
 	down_write(&OCFS2_I(inode)->ip_alloc_sem);
 
-	ret = ocfs2_write_begin_nolock(mapping, pos, len, flags, pagep,
+	ret = ocfs2_write_begin_nolock(file, mapping, pos, len, flags, pagep,
 				       fsdata, di_bh, NULL);
 	if (ret) {
 		mlog_errno(ret);
diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h
index c48e93f..e99ac0f 100644
--- a/fs/ocfs2/aops.h
+++ b/fs/ocfs2/aops.h
@@ -48,7 +48,8 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
 			   loff_t pos, unsigned len, unsigned copied,
 			   struct page *page, void *fsdata);
 
-int ocfs2_write_begin_nolock(struct address_space *mapping,
+int ocfs2_write_begin_nolock(struct file *file,
+			     struct address_space *mapping,
 			     loff_t pos, unsigned len, unsigned flags,
 			     struct page **pagep, void **fsdata,
 			     struct buffer_head *di_bh, struct page *mmap_page);
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
index af2b8fe..7fcb107 100644
--- a/fs/ocfs2/mmap.c
+++ b/fs/ocfs2/mmap.c
@@ -59,8 +59,8 @@ static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf)
 	return ret;
 }
 
-static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
-				struct page *page)
+static int __ocfs2_page_mkwrite(struct file *file, struct inode *inode,
+				struct buffer_head *di_bh, struct page *page)
 {
 	int ret;
 	struct address_space *mapping = inode->i_mapping;
@@ -109,7 +109,7 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
 	if (page->index == last_index)
 		len = size & ~PAGE_CACHE_MASK;
 
-	ret = ocfs2_write_begin_nolock(mapping, pos, len, 0, &locked_page,
+	ret = ocfs2_write_begin_nolock(file, mapping, pos, len, 0, &locked_page,
 				       &fsdata, di_bh, page);
 	if (ret) {
 		if (ret != -ENOSPC)
@@ -157,7 +157,7 @@ static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 	 */
 	down_write(&OCFS2_I(inode)->ip_alloc_sem);
 
-	ret = __ocfs2_page_mkwrite(inode, di_bh, page);
+	ret = __ocfs2_page_mkwrite(vma->vm_file, inode, di_bh, page);
 
 	up_write(&OCFS2_I(inode)->ip_alloc_sem);
 
-- 
1.7.1.GIT

  parent reply	other threads:[~2010-06-29  8:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29  8:27 [Ocfs2-devel] [PATCH 0/4] Add readahead support in CoW for reflinked files Tao Ma
2010-06-29  8:35 ` [Ocfs2-devel] [PATCH 1/4] ocfs2: Add struct file to ocfs2_refcount_cow Tao Ma
2010-06-29 23:14   ` Joel Becker
2010-06-30  1:34     ` Tao Ma
2010-06-30  3:11     ` Tao Ma
2010-06-30 12:00       ` Joel Becker
2010-07-01  0:17         ` Tao Ma
2010-07-01  9:12           ` Joel Becker
2010-07-01  9:20             ` Tao Ma
2010-06-29  8:35 ` [Ocfs2-devel] [PATCH 2/4] ocfs2: Add readahead support for CoW Tao Ma
2010-06-29  8:35 ` [Ocfs2-devel] [PATCH 3/4] ocfs2: Add readhead during CoW Tao Ma
2010-06-29 23:23   ` Joel Becker
2010-06-30  1:46     ` Tao Ma
2010-06-29  8:35 ` Tao Ma [this message]
2010-06-29 23:24   ` [Ocfs2-devel] [PATCH 4/4] ocfs2: make mmap CoW work with readahead Joel Becker

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=1277800541-6844-4-git-send-email-tao.ma@oracle.com \
    --to=tao.ma@oracle.com \
    --cc=ocfs2-devel@oss.oracle.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;
as well as URLs for NNTP newsgroup(s).