Commit 6d22ff47 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Clean up use of fault_in_iov_iter_{read,write}able

No need to store the return value of the fault_in functions in separate
variables.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 42e4c3bd
......@@ -846,12 +846,10 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
read = ret;
if (should_fault_in_pages(ret, to, &prev_count, &window_size)) {
size_t leftover;
gfs2_holder_allow_demote(gh);
leftover = fault_in_iov_iter_writeable(to, window_size);
window_size -= fault_in_iov_iter_writeable(to, window_size);
gfs2_holder_disallow_demote(gh);
if (leftover != window_size) {
if (window_size) {
if (gfs2_holder_queued(gh))
goto retry_under_glock;
goto retry;
......@@ -915,12 +913,10 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
written = ret;
if (should_fault_in_pages(ret, from, &prev_count, &window_size)) {
size_t leftover;
gfs2_holder_allow_demote(gh);
leftover = fault_in_iov_iter_readable(from, window_size);
window_size -= fault_in_iov_iter_readable(from, window_size);
gfs2_holder_disallow_demote(gh);
if (leftover != window_size) {
if (window_size) {
if (gfs2_holder_queued(gh))
goto retry_under_glock;
goto retry;
......@@ -983,12 +979,10 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
read += ret;
if (should_fault_in_pages(ret, to, &prev_count, &window_size)) {
size_t leftover;
gfs2_holder_allow_demote(&gh);
leftover = fault_in_iov_iter_writeable(to, window_size);
window_size -= fault_in_iov_iter_writeable(to, window_size);
gfs2_holder_disallow_demote(&gh);
if (leftover != window_size) {
if (window_size) {
if (gfs2_holder_queued(&gh))
goto retry_under_glock;
goto retry;
......@@ -1058,13 +1052,11 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
from->count = orig_count - written;
if (should_fault_in_pages(ret, from, &prev_count, &window_size)) {
size_t leftover;
gfs2_holder_allow_demote(gh);
leftover = fault_in_iov_iter_readable(from, window_size);
window_size -= fault_in_iov_iter_readable(from, window_size);
gfs2_holder_disallow_demote(gh);
if (leftover != window_size) {
from->count = min(from->count, window_size - leftover);
if (window_size) {
from->count = min(from->count, window_size);
if (gfs2_holder_queued(gh))
goto retry_under_glock;
goto retry;
......
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