Commit 9ab7b78a authored by Bob Peterson's avatar Bob Peterson Committed by Andreas Gruenbacher

gfs2: simplify slot_get

Simplify function slot_get and get rid of the goto that jumps into the
middle of an else branch.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 8f190c97
...@@ -342,20 +342,19 @@ static int slot_get(struct gfs2_quota_data *qd) ...@@ -342,20 +342,19 @@ static int slot_get(struct gfs2_quota_data *qd)
int error = 0; int error = 0;
spin_lock(&sdp->sd_bitmap_lock); spin_lock(&sdp->sd_bitmap_lock);
if (qd->qd_slot_count != 0) if (qd->qd_slot_count == 0) {
goto out; bit = find_first_zero_bit(sdp->sd_quota_bitmap,
sdp->sd_quota_slots);
error = -ENOSPC; if (bit >= sdp->sd_quota_slots) {
bit = find_first_zero_bit(sdp->sd_quota_bitmap, sdp->sd_quota_slots); error = -ENOSPC;
if (bit < sdp->sd_quota_slots) { goto out;
}
set_bit(bit, sdp->sd_quota_bitmap); set_bit(bit, sdp->sd_quota_bitmap);
qd->qd_slot = bit; qd->qd_slot = bit;
error = 0;
out:
qd->qd_slot_count++;
} }
qd->qd_slot_count++;
out:
spin_unlock(&sdp->sd_bitmap_lock); spin_unlock(&sdp->sd_bitmap_lock);
return error; return error;
} }
......
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