Skip to content

Commit 124c458

Browse files
author
Andreas Gruenbacher
committed
gfs2: Minor retry logic cleanup
Clean up the retry logic in the read and write functions somewhat. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 52f3f03 commit 124c458

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

fs/gfs2/file.c

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,9 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
852852
leftover = fault_in_iov_iter_writeable(to, window_size);
853853
gfs2_holder_disallow_demote(gh);
854854
if (leftover != window_size) {
855-
if (!gfs2_holder_queued(gh))
856-
goto retry;
857-
goto retry_under_glock;
855+
if (gfs2_holder_queued(gh))
856+
goto retry_under_glock;
857+
goto retry;
858858
}
859859
}
860860
if (gfs2_holder_queued(gh))
@@ -921,9 +921,9 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
921921
leftover = fault_in_iov_iter_readable(from, window_size);
922922
gfs2_holder_disallow_demote(gh);
923923
if (leftover != window_size) {
924-
if (!gfs2_holder_queued(gh))
925-
goto retry;
926-
goto retry_under_glock;
924+
if (gfs2_holder_queued(gh))
925+
goto retry_under_glock;
926+
goto retry;
927927
}
928928
}
929929
out:
@@ -992,12 +992,11 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
992992
leftover = fault_in_iov_iter_writeable(to, window_size);
993993
gfs2_holder_disallow_demote(&gh);
994994
if (leftover != window_size) {
995-
if (!gfs2_holder_queued(&gh)) {
996-
if (written)
997-
goto out_uninit;
998-
goto retry;
999-
}
1000-
goto retry_under_glock;
995+
if (gfs2_holder_queued(&gh))
996+
goto retry_under_glock;
997+
if (written)
998+
goto out_uninit;
999+
goto retry;
10011000
}
10021001
}
10031002
if (gfs2_holder_queued(&gh))
@@ -1071,12 +1070,11 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
10711070
gfs2_holder_disallow_demote(gh);
10721071
if (leftover != window_size) {
10731072
from->count = min(from->count, window_size - leftover);
1074-
if (!gfs2_holder_queued(gh)) {
1075-
if (read)
1076-
goto out_uninit;
1077-
goto retry;
1078-
}
1079-
goto retry_under_glock;
1073+
if (gfs2_holder_queued(gh))
1074+
goto retry_under_glock;
1075+
if (read)
1076+
goto out_uninit;
1077+
goto retry;
10801078
}
10811079
}
10821080
out_unlock:

0 commit comments

Comments
 (0)