public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao2.yu@samsung.com>
To: jack@suse.cz
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] udf: avoid redundant memcpy when writing data in ICB
Date: Mon, 30 Jun 2014 13:37:15 +0800	[thread overview]
Message-ID: <000901cf9425$71219200$5364b600$@samsung.com> (raw)

We have already copied the changed data of page to extent area in ICB when call
->write_end() of adinicb aops, so we do not need to copy them another time in
->writepage() of adinicb aops. SetPageUptodate is redundant too, so it's better
to remove these redundant codes.

Also it looks more reasonable to set inode dirty after extent area are modified,
we'd better move mark_inode_dirty() from ->writepage() to ->write_end().

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/udf/file.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/fs/udf/file.c b/fs/udf/file.c
index d80738f..3cd0a50 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -65,17 +65,7 @@ static int udf_adinicb_readpage(struct file *file, struct page *page)
 static int udf_adinicb_writepage(struct page *page,
 				 struct writeback_control *wbc)
 {
-	struct inode *inode = page->mapping->host;
-	char *kaddr;
-	struct udf_inode_info *iinfo = UDF_I(inode);
-
 	BUG_ON(!PageLocked(page));
-
-	kaddr = kmap(page);
-	memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr, inode->i_size);
-	mark_inode_dirty(inode);
-	SetPageUptodate(page);
-	kunmap(page);
 	unlock_page(page);
 
 	return 0;
@@ -115,6 +105,8 @@ static int udf_adinicb_write_end(struct file *file,
 		kaddr + offset, copied);
 	kunmap_atomic(kaddr);
 
+	mark_inode_dirty(inode);
+
 	return simple_write_end(file, mapping, pos, len, copied, page, fsdata);
 }
 
-- 
1.7.9.5



             reply	other threads:[~2014-06-30  5:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30  5:37 Chao Yu [this message]
2014-07-14  8:46 ` [PATCH] udf: avoid redundant memcpy when writing data in ICB Jan Kara
2014-07-14 11:14   ` Chao Yu
2014-07-14 13:13     ` Jan Kara

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='000901cf9425$71219200$5364b600$@samsung.com' \
    --to=chao2.yu@samsung.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /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