Commit 53bb540f authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Explain some direct I/O oddities

Add some comments explaining the oddities of partial direct I/O reads
and writes.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent b846f2d7
......@@ -840,6 +840,7 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
pagefault_enable();
if (ret <= 0 && ret != -EFAULT)
goto out_unlock;
/* No increment (+=) because iomap_dio_rw returns a cumulative value. */
if (ret > 0)
read = ret;
......@@ -854,6 +855,7 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
gfs2_glock_dq(gh);
out_uninit:
gfs2_holder_uninit(gh);
/* User space doesn't expect partial success. */
if (ret < 0)
return ret;
return read;
......@@ -906,6 +908,7 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
if (ret != -EFAULT)
goto out_unlock;
}
/* No increment (+=) because iomap_dio_rw returns a cumulative value. */
if (ret > 0)
written = ret;
......@@ -920,6 +923,7 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
gfs2_glock_dq(gh);
out_uninit:
gfs2_holder_uninit(gh);
/* User space doesn't expect partial success. */
if (ret < 0)
return ret;
return written;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment