[PATCH] mm/filemap.c: fix criteria of calling iov_shorten() in generic_file_direct_write()

From: Gu Zheng
Date: Tue Apr 23 2013 - 04:09:04 EST


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@xxxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/