glock.c (f1615bbe9be4def59c3b3eaddb60722efeed16c2) glock.c (743162013d40ca612b4cb53d3a200dff2d9ab26e)
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */

--- 842 unchanged lines hidden (view full) ---

851{
852 put_pid(gh->gh_owner_pid);
853 gfs2_glock_put(gh->gh_gl);
854 gh->gh_gl = NULL;
855 gh->gh_ip = 0;
856}
857
858/**
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */

--- 842 unchanged lines hidden (view full) ---

851{
852 put_pid(gh->gh_owner_pid);
853 gfs2_glock_put(gh->gh_gl);
854 gh->gh_gl = NULL;
855 gh->gh_ip = 0;
856}
857
858/**
859 * gfs2_glock_holder_wait
860 * @word: unused
861 *
862 * This function and gfs2_glock_demote_wait both show up in the WCHAN
863 * field. Thus I've separated these otherwise identical functions in
864 * order to be more informative to the user.
865 */
866
867static int gfs2_glock_holder_wait(void *word)
868{
869 schedule();
870 return 0;
871}
872
873static int gfs2_glock_demote_wait(void *word)
874{
875 schedule();
876 return 0;
877}
878
879/**
880 * gfs2_glock_wait - wait on a glock acquisition
881 * @gh: the glock holder
882 *
883 * Returns: 0 on success
884 */
885
886int gfs2_glock_wait(struct gfs2_holder *gh)
887{
888 unsigned long time1 = jiffies;
889
890 might_sleep();
859 * gfs2_glock_wait - wait on a glock acquisition
860 * @gh: the glock holder
861 *
862 * Returns: 0 on success
863 */
864
865int gfs2_glock_wait(struct gfs2_holder *gh)
866{
867 unsigned long time1 = jiffies;
868
869 might_sleep();
891 wait_on_bit(&gh->gh_iflags, HIF_WAIT, gfs2_glock_holder_wait, TASK_UNINTERRUPTIBLE);
870 wait_on_bit(&gh->gh_iflags, HIF_WAIT, TASK_UNINTERRUPTIBLE);
892 if (time_after(jiffies, time1 + HZ)) /* have we waited > a second? */
893 /* Lengthen the minimum hold time. */
894 gh->gh_gl->gl_hold_time = min(gh->gh_gl->gl_hold_time +
895 GL_GLOCK_HOLD_INCR,
896 GL_GLOCK_MAX_HOLD);
897 return gh->gh_error;
898}
899

--- 223 unchanged lines hidden (view full) ---

1123 gfs2_glock_put(gl);
1124}
1125
1126void gfs2_glock_dq_wait(struct gfs2_holder *gh)
1127{
1128 struct gfs2_glock *gl = gh->gh_gl;
1129 gfs2_glock_dq(gh);
1130 might_sleep();
871 if (time_after(jiffies, time1 + HZ)) /* have we waited > a second? */
872 /* Lengthen the minimum hold time. */
873 gh->gh_gl->gl_hold_time = min(gh->gh_gl->gl_hold_time +
874 GL_GLOCK_HOLD_INCR,
875 GL_GLOCK_MAX_HOLD);
876 return gh->gh_error;
877}
878

--- 223 unchanged lines hidden (view full) ---

1102 gfs2_glock_put(gl);
1103}
1104
1105void gfs2_glock_dq_wait(struct gfs2_holder *gh)
1106{
1107 struct gfs2_glock *gl = gh->gh_gl;
1108 gfs2_glock_dq(gh);
1109 might_sleep();
1131 wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait, TASK_UNINTERRUPTIBLE);
1110 wait_on_bit(&gl->gl_flags, GLF_DEMOTE, TASK_UNINTERRUPTIBLE);
1132}
1133
1134/**
1135 * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it
1136 * @gh: the holder structure
1137 *
1138 */
1139

--- 997 unchanged lines hidden ---
1111}
1112
1113/**
1114 * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it
1115 * @gh: the holder structure
1116 *
1117 */
1118

--- 997 unchanged lines hidden ---