]> git.hungrycats.org Git - linux/commitdiff
[PATCH] return the correct thing from direct-io
authorAndrew Morton <akpm@digeo.com>
Wed, 8 Jan 2003 01:48:21 +0000 (17:48 -0800)
committerTrond Myklebust <trond.myklebust@fys.uio.no>
Wed, 8 Jan 2003 01:48:21 +0000 (17:48 -0800)
If direct-io encounters an error, it currently returns that error even if it
performed some I/O.

Change it so that if there is an error and we read or wrote something, return
the number of bytes written/read.  Only return the error code if zero bytes
were written/read.

fs/direct-io.c

index e94615eb837d82b63e1528ef8a4c1163521300ec..643f03c26d5535dfca4692bab43b1bd916952844 100644 (file)
@@ -837,10 +837,8 @@ direct_io_worker(int rw, struct inode *inode, const struct iovec *iov,
                ret = ret2;
        if (ret == 0)
                ret = dio.page_errors;
-       if (ret == 0)
-               ret = tot_bytes; 
 
-       return ret;
+       return tot_bytes ? tot_bytes : ret;
 }
 
 /*