diff options
author | Bob Peterson <rpeterso@redhat.com> | 2008-01-29 14:56:15 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:40:23 -0400 |
commit | ab0d756681c9502a2ab9e2e4ab3685bc0567f4ee (patch) | |
tree | 6c308961e3976b6dc30809d9efc17adc6e685711 /fs/gfs2/glock.c | |
parent | 110acf38377b5b341b11644bfe98389eccec627d (diff) |
[GFS2] Eliminate gl_req_bh
This patch further reduces the memory needs of GFS2 by
eliminating the gl_req_bh variable from struct gfs2_glock.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 107 |
1 files changed, 51 insertions, 56 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 951cb91e7ddb..a8387e0b5068 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -338,7 +338,6 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
338 | gl->gl_ip = 0; | 338 | gl->gl_ip = 0; |
339 | gl->gl_ops = glops; | 339 | gl->gl_ops = glops; |
340 | gl->gl_req_gh = NULL; | 340 | gl->gl_req_gh = NULL; |
341 | gl->gl_req_bh = NULL; | ||
342 | gl->gl_vn = 0; | 341 | gl->gl_vn = 0; |
343 | gl->gl_stamp = jiffies; | 342 | gl->gl_stamp = jiffies; |
344 | gl->gl_tchange = jiffies; | 343 | gl->gl_tchange = jiffies; |
@@ -744,6 +743,50 @@ static void state_change(struct gfs2_glock *gl, unsigned int new_state) | |||
744 | } | 743 | } |
745 | 744 | ||
746 | /** | 745 | /** |
746 | * drop_bh - Called after a lock module unlock completes | ||
747 | * @gl: the glock | ||
748 | * @ret: the return status | ||
749 | * | ||
750 | * Doesn't wake up the process waiting on the struct gfs2_holder (if any) | ||
751 | * Doesn't drop the reference on the glock the top half took out | ||
752 | * | ||
753 | */ | ||
754 | |||
755 | static void drop_bh(struct gfs2_glock *gl, unsigned int ret) | ||
756 | { | ||
757 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
758 | const struct gfs2_glock_operations *glops = gl->gl_ops; | ||
759 | struct gfs2_holder *gh = gl->gl_req_gh; | ||
760 | |||
761 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | ||
762 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | ||
763 | gfs2_assert_warn(sdp, !ret); | ||
764 | |||
765 | state_change(gl, LM_ST_UNLOCKED); | ||
766 | |||
767 | if (glops->go_inval) | ||
768 | glops->go_inval(gl, DIO_METADATA); | ||
769 | |||
770 | if (gh) { | ||
771 | spin_lock(&gl->gl_spin); | ||
772 | list_del_init(&gh->gh_list); | ||
773 | gh->gh_error = 0; | ||
774 | spin_unlock(&gl->gl_spin); | ||
775 | } | ||
776 | |||
777 | spin_lock(&gl->gl_spin); | ||
778 | gfs2_demote_wake(gl); | ||
779 | gl->gl_req_gh = NULL; | ||
780 | clear_bit(GLF_LOCK, &gl->gl_flags); | ||
781 | spin_unlock(&gl->gl_spin); | ||
782 | |||
783 | gfs2_glock_put(gl); | ||
784 | |||
785 | if (gh) | ||
786 | gfs2_holder_wake(gh); | ||
787 | } | ||
788 | |||
789 | /** | ||
747 | * xmote_bh - Called after the lock module is done acquiring a lock | 790 | * xmote_bh - Called after the lock module is done acquiring a lock |
748 | * @gl: The glock in question | 791 | * @gl: The glock in question |
749 | * @ret: the int returned from the lock module | 792 | * @ret: the int returned from the lock module |
@@ -758,6 +801,11 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) | |||
758 | int prev_state = gl->gl_state; | 801 | int prev_state = gl->gl_state; |
759 | int op_done = 1; | 802 | int op_done = 1; |
760 | 803 | ||
804 | if ((ret & LM_OUT_ST_MASK) == LM_ST_UNLOCKED) { | ||
805 | drop_bh(gl, ret); | ||
806 | return; | ||
807 | } | ||
808 | |||
761 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | 809 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); |
762 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | 810 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); |
763 | gfs2_assert_warn(sdp, !(ret & LM_OUT_ASYNC)); | 811 | gfs2_assert_warn(sdp, !(ret & LM_OUT_ASYNC)); |
@@ -783,7 +831,6 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) | |||
783 | } else { | 831 | } else { |
784 | spin_lock(&gl->gl_spin); | 832 | spin_lock(&gl->gl_spin); |
785 | if (gl->gl_state != gl->gl_demote_state) { | 833 | if (gl->gl_state != gl->gl_demote_state) { |
786 | gl->gl_req_bh = NULL; | ||
787 | spin_unlock(&gl->gl_spin); | 834 | spin_unlock(&gl->gl_spin); |
788 | gfs2_glock_drop_th(gl); | 835 | gfs2_glock_drop_th(gl); |
789 | gfs2_glock_put(gl); | 836 | gfs2_glock_put(gl); |
@@ -825,7 +872,6 @@ out: | |||
825 | if (op_done) { | 872 | if (op_done) { |
826 | spin_lock(&gl->gl_spin); | 873 | spin_lock(&gl->gl_spin); |
827 | gl->gl_req_gh = NULL; | 874 | gl->gl_req_gh = NULL; |
828 | gl->gl_req_bh = NULL; | ||
829 | clear_bit(GLF_LOCK, &gl->gl_flags); | 875 | clear_bit(GLF_LOCK, &gl->gl_flags); |
830 | spin_unlock(&gl->gl_spin); | 876 | spin_unlock(&gl->gl_spin); |
831 | } | 877 | } |
@@ -864,7 +910,6 @@ static void gfs2_glock_xmote_th(struct gfs2_glock *gl, struct gfs2_holder *gh) | |||
864 | gfs2_assert_warn(sdp, state != gl->gl_state); | 910 | gfs2_assert_warn(sdp, state != gl->gl_state); |
865 | 911 | ||
866 | gfs2_glock_hold(gl); | 912 | gfs2_glock_hold(gl); |
867 | gl->gl_req_bh = xmote_bh; | ||
868 | 913 | ||
869 | lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state, lck_flags); | 914 | lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state, lck_flags); |
870 | 915 | ||
@@ -878,51 +923,6 @@ static void gfs2_glock_xmote_th(struct gfs2_glock *gl, struct gfs2_holder *gh) | |||
878 | } | 923 | } |
879 | 924 | ||
880 | /** | 925 | /** |
881 | * drop_bh - Called after a lock module unlock completes | ||
882 | * @gl: the glock | ||
883 | * @ret: the return status | ||
884 | * | ||
885 | * Doesn't wake up the process waiting on the struct gfs2_holder (if any) | ||
886 | * Doesn't drop the reference on the glock the top half took out | ||
887 | * | ||
888 | */ | ||
889 | |||
890 | static void drop_bh(struct gfs2_glock *gl, unsigned int ret) | ||
891 | { | ||
892 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
893 | const struct gfs2_glock_operations *glops = gl->gl_ops; | ||
894 | struct gfs2_holder *gh = gl->gl_req_gh; | ||
895 | |||
896 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | ||
897 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | ||
898 | gfs2_assert_warn(sdp, !ret); | ||
899 | |||
900 | state_change(gl, LM_ST_UNLOCKED); | ||
901 | |||
902 | if (glops->go_inval) | ||
903 | glops->go_inval(gl, DIO_METADATA); | ||
904 | |||
905 | if (gh) { | ||
906 | spin_lock(&gl->gl_spin); | ||
907 | list_del_init(&gh->gh_list); | ||
908 | gh->gh_error = 0; | ||
909 | spin_unlock(&gl->gl_spin); | ||
910 | } | ||
911 | |||
912 | spin_lock(&gl->gl_spin); | ||
913 | gfs2_demote_wake(gl); | ||
914 | gl->gl_req_gh = NULL; | ||
915 | gl->gl_req_bh = NULL; | ||
916 | clear_bit(GLF_LOCK, &gl->gl_flags); | ||
917 | spin_unlock(&gl->gl_spin); | ||
918 | |||
919 | gfs2_glock_put(gl); | ||
920 | |||
921 | if (gh) | ||
922 | gfs2_holder_wake(gh); | ||
923 | } | ||
924 | |||
925 | /** | ||
926 | * gfs2_glock_drop_th - call into the lock module to unlock a lock | 926 | * gfs2_glock_drop_th - call into the lock module to unlock a lock |
927 | * @gl: the glock | 927 | * @gl: the glock |
928 | * | 928 | * |
@@ -942,7 +942,6 @@ static void gfs2_glock_drop_th(struct gfs2_glock *gl) | |||
942 | gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED); | 942 | gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED); |
943 | 943 | ||
944 | gfs2_glock_hold(gl); | 944 | gfs2_glock_hold(gl); |
945 | gl->gl_req_bh = drop_bh; | ||
946 | 945 | ||
947 | ret = gfs2_lm_unlock(sdp, gl->gl_lock, gl->gl_state); | 946 | ret = gfs2_lm_unlock(sdp, gl->gl_lock, gl->gl_state); |
948 | 947 | ||
@@ -971,8 +970,7 @@ static void do_cancels(struct gfs2_holder *gh) | |||
971 | while (gl->gl_req_gh != gh && | 970 | while (gl->gl_req_gh != gh && |
972 | !test_bit(HIF_HOLDER, &gh->gh_iflags) && | 971 | !test_bit(HIF_HOLDER, &gh->gh_iflags) && |
973 | !list_empty(&gh->gh_list)) { | 972 | !list_empty(&gh->gh_list)) { |
974 | if (gl->gl_req_bh && !(gl->gl_req_gh && | 973 | if (!(gl->gl_req_gh && (gl->gl_req_gh->gh_flags & GL_NOCANCEL))) { |
975 | (gl->gl_req_gh->gh_flags & GL_NOCANCEL))) { | ||
976 | spin_unlock(&gl->gl_spin); | 974 | spin_unlock(&gl->gl_spin); |
977 | gfs2_lm_cancel(gl->gl_sbd, gl->gl_lock); | 975 | gfs2_lm_cancel(gl->gl_sbd, gl->gl_lock); |
978 | msleep(100); | 976 | msleep(100); |
@@ -1042,7 +1040,6 @@ static int glock_wait_internal(struct gfs2_holder *gh) | |||
1042 | 1040 | ||
1043 | spin_lock(&gl->gl_spin); | 1041 | spin_lock(&gl->gl_spin); |
1044 | gl->gl_req_gh = NULL; | 1042 | gl->gl_req_gh = NULL; |
1045 | gl->gl_req_bh = NULL; | ||
1046 | clear_bit(GLF_LOCK, &gl->gl_flags); | 1043 | clear_bit(GLF_LOCK, &gl->gl_flags); |
1047 | run_queue(gl); | 1044 | run_queue(gl); |
1048 | spin_unlock(&gl->gl_spin); | 1045 | spin_unlock(&gl->gl_spin); |
@@ -1535,8 +1532,7 @@ void gfs2_glock_cb(void *cb_data, unsigned int type, void *data) | |||
1535 | gl = gfs2_glock_find(sdp, &async->lc_name); | 1532 | gl = gfs2_glock_find(sdp, &async->lc_name); |
1536 | if (gfs2_assert_warn(sdp, gl)) | 1533 | if (gfs2_assert_warn(sdp, gl)) |
1537 | return; | 1534 | return; |
1538 | if (!gfs2_assert_warn(sdp, gl->gl_req_bh)) | 1535 | xmote_bh(gl, async->lc_ret); |
1539 | gl->gl_req_bh(gl, async->lc_ret); | ||
1540 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) | 1536 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) |
1541 | gfs2_glock_put(gl); | 1537 | gfs2_glock_put(gl); |
1542 | up_read(&gfs2_umount_flush_sem); | 1538 | up_read(&gfs2_umount_flush_sem); |
@@ -1898,7 +1894,6 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl) | |||
1898 | print_dbg(gi, " gl_owner = -1\n"); | 1894 | print_dbg(gi, " gl_owner = -1\n"); |
1899 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); | 1895 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); |
1900 | print_dbg(gi, " req_gh = %s\n", (gl->gl_req_gh) ? "yes" : "no"); | 1896 | print_dbg(gi, " req_gh = %s\n", (gl->gl_req_gh) ? "yes" : "no"); |
1901 | print_dbg(gi, " req_bh = %s\n", (gl->gl_req_bh) ? "yes" : "no"); | ||
1902 | print_dbg(gi, " lvb_count = %d\n", atomic_read(&gl->gl_lvb_count)); | 1897 | print_dbg(gi, " lvb_count = %d\n", atomic_read(&gl->gl_lvb_count)); |
1903 | print_dbg(gi, " object = %s\n", (gl->gl_object) ? "yes" : "no"); | 1898 | print_dbg(gi, " object = %s\n", (gl->gl_object) ? "yes" : "no"); |
1904 | print_dbg(gi, " reclaim = %s\n", | 1899 | print_dbg(gi, " reclaim = %s\n", |