Commit 47106428 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Minor gfs2_ail1_empty cleanup

Change gfs2_ail1_empty() to return %true when the ail1 list is empty.

Based on that, make the loop in empty_ail1_list() more obvious.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 34d63b81
...@@ -352,14 +352,15 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_trans *tr, ...@@ -352,14 +352,15 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_trans *tr,
* @sdp: The superblock * @sdp: The superblock
* @max_revokes: If non-zero, add revokes where appropriate * @max_revokes: If non-zero, add revokes where appropriate
* *
* Tries to empty the ail1 lists, starting with the oldest first * Tries to empty the ail1 lists, starting with the oldest first.
* Returns %true if the ail1 list is now empty.
*/ */
static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes) static bool gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
{ {
struct gfs2_trans *tr, *s; struct gfs2_trans *tr, *s;
int oldest_tr = 1; int oldest_tr = 1;
int ret; bool empty;
spin_lock(&sdp->sd_ail_lock); spin_lock(&sdp->sd_ail_lock);
list_for_each_entry_safe_reverse(tr, s, &sdp->sd_ail1_list, tr_list) { list_for_each_entry_safe_reverse(tr, s, &sdp->sd_ail1_list, tr_list) {
...@@ -369,7 +370,7 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes) ...@@ -369,7 +370,7 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
oldest_tr = 0; oldest_tr = 0;
} }
gfs2_log_update_flush_tail(sdp); gfs2_log_update_flush_tail(sdp);
ret = list_empty(&sdp->sd_ail1_list); empty = list_empty(&sdp->sd_ail1_list);
spin_unlock(&sdp->sd_ail_lock); spin_unlock(&sdp->sd_ail_lock);
if (test_bit(SDF_WITHDRAWING, &sdp->sd_flags)) { if (test_bit(SDF_WITHDRAWING, &sdp->sd_flags)) {
...@@ -377,7 +378,7 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes) ...@@ -377,7 +378,7 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
gfs2_withdraw(sdp); gfs2_withdraw(sdp);
} }
return ret; return empty;
} }
static void gfs2_ail1_wait(struct gfs2_sbd *sdp) static void gfs2_ail1_wait(struct gfs2_sbd *sdp)
...@@ -974,8 +975,9 @@ void gfs2_ail_drain(struct gfs2_sbd *sdp) ...@@ -974,8 +975,9 @@ void gfs2_ail_drain(struct gfs2_sbd *sdp)
static void empty_ail1_list(struct gfs2_sbd *sdp) static void empty_ail1_list(struct gfs2_sbd *sdp)
{ {
unsigned long start = jiffies; unsigned long start = jiffies;
bool empty = false;
for (;;) { while (!empty) {
if (time_after(jiffies, start + (HZ * 600))) { if (time_after(jiffies, start + (HZ * 600))) {
fs_err(sdp, "Error: In %s for 10 minutes! t=%d\n", fs_err(sdp, "Error: In %s for 10 minutes! t=%d\n",
__func__, current->journal_info ? 1 : 0); __func__, current->journal_info ? 1 : 0);
...@@ -984,8 +986,7 @@ static void empty_ail1_list(struct gfs2_sbd *sdp) ...@@ -984,8 +986,7 @@ static void empty_ail1_list(struct gfs2_sbd *sdp)
} }
gfs2_ail1_start(sdp); gfs2_ail1_start(sdp);
gfs2_ail1_wait(sdp); gfs2_ail1_wait(sdp);
if (gfs2_ail1_empty(sdp, 0)) empty = gfs2_ail1_empty(sdp, 0);
return;
} }
} }
......
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