Skip to content

Commit

Permalink
gfs2: Minor retry logic cleanup
Browse files Browse the repository at this point in the history
[ Upstream commit 124c458 ]

Clean up the retry logic in the read and write functions somewhat.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Andreas Gruenbacher authored and gregkh committed May 9, 2022
1 parent 66d9659 commit a55715f
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions fs/gfs2/file.c
Expand Up @@ -851,9 +851,9 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
leftover = fault_in_iov_iter_writeable(to, window_size);
gfs2_holder_disallow_demote(gh);
if (leftover != window_size) {
if (!gfs2_holder_queued(gh))
goto retry;
goto retry_under_glock;
if (gfs2_holder_queued(gh))
goto retry_under_glock;
goto retry;
}
}
if (gfs2_holder_queued(gh))
Expand Down Expand Up @@ -920,9 +920,9 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
leftover = fault_in_iov_iter_readable(from, window_size);
gfs2_holder_disallow_demote(gh);
if (leftover != window_size) {
if (!gfs2_holder_queued(gh))
goto retry;
goto retry_under_glock;
if (gfs2_holder_queued(gh))
goto retry_under_glock;
goto retry;
}
}
out:
Expand Down Expand Up @@ -989,12 +989,11 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
leftover = fault_in_iov_iter_writeable(to, window_size);
gfs2_holder_disallow_demote(&gh);
if (leftover != window_size) {
if (!gfs2_holder_queued(&gh)) {
if (written)
goto out_uninit;
goto retry;
}
goto retry_under_glock;
if (gfs2_holder_queued(&gh))
goto retry_under_glock;
if (written)
goto out_uninit;
goto retry;
}
}
if (gfs2_holder_queued(&gh))
Expand Down Expand Up @@ -1068,12 +1067,11 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
gfs2_holder_disallow_demote(gh);
if (leftover != window_size) {
from->count = min(from->count, window_size - leftover);
if (!gfs2_holder_queued(gh)) {
if (read)
goto out_uninit;
goto retry;
}
goto retry_under_glock;
if (gfs2_holder_queued(gh))
goto retry_under_glock;
if (read)
goto out_uninit;
goto retry;
}
}
out_unlock:
Expand Down

0 comments on commit a55715f

Please sign in to comment.