public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel <linux-kernel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>, Jens <axboe@kernel.dk>
Subject: [PATCH] mm/filemap.c: fix criteria of calling iov_shorten() in generic_file_direct_write()
Date: Tue, 23 Apr 2013 16:37:43 +0800	[thread overview]
Message-ID: <51764857.5010808@cn.fujitsu.com> (raw)

>From 35947e6535d92c54cf523470cc8811e8b5fee3e5 Mon Sep 17 00:00:00 2001
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
Date: Tue, 23 Apr 2013 16:09:04 +0800
Subject: [PATCH] mm/filemap.c: fix criteria of calling iov_shorten() in generic_file_direct_write()

generic_file_direct_write() compares 'count'(the max count we actually can write)
with 'ocount'(the count we request to write) to see if there is need to call
iov_shorten() to reduce number of segments and the iovec's length. If the
'count' is equal or greater than 'ocount', there is no need to call iov_shorten()
indeed. So the judgement should be changed:
'if (count != ocount)' --> 'if (count < ocount)'

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
 mm/filemap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index e1979fd..c566b9c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2183,7 +2183,7 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
 	size_t		write_len;
 	pgoff_t		end;
 
-	if (count != ocount)
+	if (count < ocount)
 		*nr_segs = iov_shorten((struct iovec *)iov, *nr_segs, count);
 
 	write_len = iov_length(iov, *nr_segs);
-- 
1.7.7


             reply	other threads:[~2013-04-23  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23  8:37 Gu Zheng [this message]
2013-04-24 12:21 ` [PATCH] mm/filemap.c: fix criteria of calling iov_shorten() in generic_file_direct_write() Jan Kara
2013-04-25  6:54   ` Gu Zheng

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=51764857.5010808@cn.fujitsu.com \
    --to=guz.fnst@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    /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