[patch 5/6] generic_file_buffered_write(): max_len cleanup

Andrew Morton
2006-10-11T06:18:05Z

More dirty code.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

mm/filemap.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff -puN mm/filemap.c~generic_file_buffered_write-max_len-cleanup mm/filemap.c
--- a/mm/filemap.c~generic_file_buffered_write-max_len-cleanup
+++ a/mm/filemap.c
@@ -2090,7 +2090,6 @@ generic_file_buffered_write(struct kiocb
do {
pgoff_t index; /* Pagecache index for current page */
unsigned long offset; /* Offset into pagecache page */
- unsigned long maxlen; /* Bytes remaining in current iovec */
size_t bytes; /* Bytes to write to page */
size_t copied; /* Bytes copied from user */

@@ -2100,9 +2099,7 @@ generic_file_buffered_write(struct kiocb
if (bytes > count)
bytes = count;

- maxlen = cur_iov->iov_len - iov_offset;
- if (maxlen > bytes)
- maxlen = bytes;
+ bytes = min(cur_iov->iov_len - iov_offset, bytes);

/*
* Bring in the user page that we will copy from _first_.
_