aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2013-10-04 06:31:05 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2013-10-04 06:39:21 -0400
commitaabd7c72f52145fcf13f9251770b0b0246b5e406 (patch)
tree99268cd27ed66cff7bb1dfcde031afa5b11e1995 /fs/gfs2
parent1bf59bf6ded8411058b4c9acc45d9dd8d6965464 (diff)
GFS2: Inline qd_trylock into gfs2_quota_unlock
The function qd_trylock was not a trylock despite its name and can be inlined into gfs2_quota_unlock in order to make the code a bit clearer. There should be no functional change as a result of this patch. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Cc: Abhijith Das <adas@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/quota.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 75414e773ab4..cfb4cdeddacb 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -442,29 +442,6 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp)
442 return 0; 442 return 0;
443} 443}
444 444
445static int qd_trylock(struct gfs2_quota_data *qd)
446{
447 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
448 int found;
449
450 spin_lock(&qd_lru_lock);
451 found = qd_check_sync(sdp, qd, NULL);
452 spin_unlock(&qd_lru_lock);
453
454 if (!found)
455 return 0;
456
457 gfs2_assert_warn(sdp, qd->qd_change_sync);
458 if (bh_get(qd)) {
459 clear_bit(QDF_LOCKED, &qd->qd_flags);
460 slot_put(qd);
461 qd_put(qd);
462 return 0;
463 }
464
465 return 1;
466}
467
468static void qd_unlock(struct gfs2_quota_data *qd) 445static void qd_unlock(struct gfs2_quota_data *qd)
469{ 446{
470 gfs2_assert_warn(qd->qd_gl->gl_sbd, 447 gfs2_assert_warn(qd->qd_gl->gl_sbd,
@@ -1015,9 +992,11 @@ static int need_sync(struct gfs2_quota_data *qd)
1015 992
1016void gfs2_quota_unlock(struct gfs2_inode *ip) 993void gfs2_quota_unlock(struct gfs2_inode *ip)
1017{ 994{
995 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1018 struct gfs2_quota_data *qda[4]; 996 struct gfs2_quota_data *qda[4];
1019 unsigned int count = 0; 997 unsigned int count = 0;
1020 unsigned int x; 998 unsigned int x;
999 int found;
1021 1000
1022 if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags)) 1001 if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags))
1023 goto out; 1002 goto out;
@@ -1030,9 +1009,25 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
1030 sync = need_sync(qd); 1009 sync = need_sync(qd);
1031 1010
1032 gfs2_glock_dq_uninit(&ip->i_res->rs_qa_qd_ghs[x]); 1011 gfs2_glock_dq_uninit(&ip->i_res->rs_qa_qd_ghs[x]);
1012 if (!sync)
1013 continue;
1014
1015 spin_lock(&qd_lru_lock);
1016 found = qd_check_sync(sdp, qd, NULL);
1017 spin_unlock(&qd_lru_lock);
1018
1019 if (!found)
1020 continue;
1021
1022 gfs2_assert_warn(sdp, qd->qd_change_sync);
1023 if (bh_get(qd)) {
1024 clear_bit(QDF_LOCKED, &qd->qd_flags);
1025 slot_put(qd);
1026 qd_put(qd);
1027 continue;
1028 }
1033 1029
1034 if (sync && qd_trylock(qd)) 1030 qda[count++] = qd;
1035 qda[count++] = qd;
1036 } 1031 }
1037 1032
1038 if (count) { 1033 if (count) {