]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
Revert "[PATCH] generic_file_buffered_write(): handle zero-length iovec segments"
authorAndrew Morton <akpm@osdl.org>
Tue, 16 Oct 2007 08:24:54 +0000 (01:24 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 16 Oct 2007 16:42:54 +0000 (09:42 -0700)
This reverts commit 81b0c8713385ce1b1b9058e916edcf9561ad76d6, which was
a bugfix against 6527c2bdf1f833cc18e8f42bd97973d583e4aa83 ("[PATCH]
generic_file_buffered_write(): deadlock on vectored write"), which we
also revert.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c
mm/filemap.h

index c504db18ac2640d2344e151d6712b94b5f433a96..caaaa7adfdf99fd0413c34561d9bd9f93e0adedb 100644 (file)
@@ -1895,12 +1895,6 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
                        break;
                }
 
-               if (unlikely(bytes == 0)) {
-                       status = 0;
-                       copied = 0;
-                       goto zero_length_segment;
-               }
-
                status = a_ops->prepare_write(file, page, offset, offset+bytes);
                if (unlikely(status)) {
                        loff_t isize = i_size_read(inode);
@@ -1930,8 +1924,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
                        page_cache_release(page);
                        continue;
                }
-zero_length_segment:
-               if (likely(copied >= 0)) {
+               if (likely(copied > 0)) {
                        if (!status)
                                status = copied;
 
index c2bff04c84ed42cfd7b1c85e9819785ae90f6c87..a1e10a232e92a18e8a76c38ebc193c74bc94a1f6 100644 (file)
@@ -87,7 +87,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
        const struct iovec *iov = *iovp;
        size_t base = *basep;
 
-       do {
+       while (bytes) {
                int copy = min(bytes, iov->iov_len - base);
 
                bytes -= copy;
@@ -96,7 +96,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
                        iov++;
                        base = 0;
                }
-       } while (bytes);
+       }
        *iovp = iov;
        *basep = base;
 }