diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 9 | ||||
-rw-r--r-- | mm/filemap.h | 4 |
2 files changed, 3 insertions, 10 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index c504db18ac26..caaaa7adfdf9 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1895,12 +1895,6 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, | |||
1895 | break; | 1895 | break; |
1896 | } | 1896 | } |
1897 | 1897 | ||
1898 | if (unlikely(bytes == 0)) { | ||
1899 | status = 0; | ||
1900 | copied = 0; | ||
1901 | goto zero_length_segment; | ||
1902 | } | ||
1903 | |||
1904 | status = a_ops->prepare_write(file, page, offset, offset+bytes); | 1898 | status = a_ops->prepare_write(file, page, offset, offset+bytes); |
1905 | if (unlikely(status)) { | 1899 | if (unlikely(status)) { |
1906 | loff_t isize = i_size_read(inode); | 1900 | loff_t isize = i_size_read(inode); |
@@ -1930,8 +1924,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, | |||
1930 | page_cache_release(page); | 1924 | page_cache_release(page); |
1931 | continue; | 1925 | continue; |
1932 | } | 1926 | } |
1933 | zero_length_segment: | 1927 | if (likely(copied > 0)) { |
1934 | if (likely(copied >= 0)) { | ||
1935 | if (!status) | 1928 | if (!status) |
1936 | status = copied; | 1929 | status = copied; |
1937 | 1930 | ||
diff --git a/mm/filemap.h b/mm/filemap.h index c2bff04c84ed..a1e10a232e92 100644 --- a/mm/filemap.h +++ b/mm/filemap.h | |||
@@ -87,7 +87,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes) | |||
87 | const struct iovec *iov = *iovp; | 87 | const struct iovec *iov = *iovp; |
88 | size_t base = *basep; | 88 | size_t base = *basep; |
89 | 89 | ||
90 | do { | 90 | while (bytes) { |
91 | int copy = min(bytes, iov->iov_len - base); | 91 | int copy = min(bytes, iov->iov_len - base); |
92 | 92 | ||
93 | bytes -= copy; | 93 | bytes -= copy; |
@@ -96,7 +96,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes) | |||
96 | iov++; | 96 | iov++; |
97 | base = 0; | 97 | base = 0; |
98 | } | 98 | } |
99 | } while (bytes); | 99 | } |
100 | *iovp = iov; | 100 | *iovp = iov; |
101 | *basep = base; | 101 | *basep = base; |
102 | } | 102 | } |