• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/gfs2/

Lines Matching defs:gh

60 static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target);
297 * @gh: The lock request which we wish to grant
302 static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holder *gh)
305 if ((gh->gh_state == LM_ST_EXCLUSIVE ||
306 gh_head->gh_state == LM_ST_EXCLUSIVE) && gh != gh_head)
308 if (gl->gl_state == gh->gh_state)
310 if (gh->gh_flags & GL_EXACT)
313 if (gh->gh_state == LM_ST_SHARED && gh_head->gh_state == LM_ST_SHARED)
315 if (gh->gh_state == LM_ST_DEFERRED && gh_head->gh_state == LM_ST_DEFERRED)
318 if (gl->gl_state != LM_ST_UNLOCKED && (gh->gh_flags & LM_FLAG_ANY))
323 static void gfs2_holder_wake(struct gfs2_holder *gh)
325 clear_bit(HIF_WAIT, &gh->gh_iflags);
327 wake_up_bit(&gh->gh_iflags, HIF_WAIT);
337 struct gfs2_holder *gh, *tmp;
339 list_for_each_entry_safe(gh, tmp, &gl->gl_holders, gh_list) {
340 if (test_bit(HIF_HOLDER, &gh->gh_iflags))
343 gh->gh_error = -EIO;
344 else if (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))
345 gh->gh_error = GLR_TRYFAILED;
348 list_del_init(&gh->gh_list);
349 trace_gfs2_glock_queue(gh, 0);
350 gfs2_holder_wake(gh);
367 struct gfs2_holder *gh, *tmp;
371 list_for_each_entry_safe(gh, tmp, &gl->gl_holders, gh_list) {
372 if (test_bit(HIF_HOLDER, &gh->gh_iflags))
374 if (may_grant(gl, gh)) {
375 if (gh->gh_list.prev == &gl->gl_holders &&
378 ret = glops->go_lock(gh);
383 gh->gh_error = ret;
384 list_del_init(&gh->gh_list);
385 trace_gfs2_glock_queue(gh, 0);
386 gfs2_holder_wake(gh);
389 set_bit(HIF_HOLDER, &gh->gh_iflags);
390 trace_gfs2_promote(gh, 1);
391 gfs2_holder_wake(gh);
394 set_bit(HIF_HOLDER, &gh->gh_iflags);
395 trace_gfs2_promote(gh, 0);
396 gfs2_holder_wake(gh);
399 if (gh->gh_list.prev == &gl->gl_holders)
408 * find_first_waiter - find the first gh that's waiting for the glock
414 struct gfs2_holder *gh;
416 list_for_each_entry(gh, &gl->gl_holders, gh_list) {
417 if (!test_bit(HIF_HOLDER, &gh->gh_iflags))
418 return gh;
466 struct gfs2_holder *gh;
473 gh = find_first_waiter(gl);
482 if (gh && !test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) {
485 if ((gh->gh_flags & LM_FLAG_PRIORITY) == 0)
486 list_move_tail(&gh->gh_list, &gl->gl_holders);
487 gh = find_first_waiter(gl);
488 gl->gl_target = gh->gh_state;
493 (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) {
503 do_xmote(gl, gh, gl->gl_target);
508 do_xmote(gl, gh, LM_ST_UNLOCKED);
524 rv = glops->go_xmote_bh(gl, gh);
559 * @gh: The holder (only for promotes)
564 static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target)
570 unsigned int lck_flags = gh ? gh->gh_flags : 0;
607 * find_first_holder - find the first "holder" gh
613 struct gfs2_holder *gh;
616 gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list);
617 if (test_bit(HIF_HOLDER, &gh->gh_iflags))
618 return gh;
634 struct gfs2_holder *gh = NULL;
659 gh = find_first_waiter(gl);
660 gl->gl_target = gh->gh_state;
661 if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
664 do_xmote(gl, gh, gl->gl_target);
824 * @gh: the holder structure
829 struct gfs2_holder *gh)
831 INIT_LIST_HEAD(&gh->gh_list);
832 gh->gh_gl = gl;
833 gh->gh_ip = (unsigned long)__builtin_return_address(0);
834 gh->gh_owner_pid = get_pid(task_pid(current));
835 gh->gh_state = state;
836 gh->gh_flags = flags;
837 gh->gh_error = 0;
838 gh->gh_iflags = 0;
846 * @gh: the holder structure
852 void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder *gh)
854 gh->gh_state = state;
855 gh->gh_flags = flags;
856 gh->gh_iflags = 0;
857 gh->gh_ip = (unsigned long)__builtin_return_address(0);
858 if (gh->gh_owner_pid)
859 put_pid(gh->gh_owner_pid);
860 gh->gh_owner_pid = get_pid(task_pid(current));
865 * @gh: the holder structure
869 void gfs2_holder_uninit(struct gfs2_holder *gh)
871 put_pid(gh->gh_owner_pid);
872 gfs2_glock_put(gh->gh_gl);
873 gh->gh_gl = NULL;
874 gh->gh_ip = 0;
898 static void wait_on_holder(struct gfs2_holder *gh)
901 wait_on_bit(&gh->gh_iflags, HIF_WAIT, gfs2_glock_holder_wait, TASK_UNINTERRUPTIBLE);
939 * @gh: the glock holder
944 int gfs2_glock_wait(struct gfs2_holder *gh)
946 wait_on_holder(gh);
947 return gh->gh_error;
968 * @gh: the holder structure to add
976 static inline void add_to_queue(struct gfs2_holder *gh)
980 struct gfs2_glock *gl = gh->gh_gl;
986 BUG_ON(gh->gh_owner_pid == NULL);
987 if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags))
990 if (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)) {
998 if (unlikely(gh2->gh_owner_pid == gh->gh_owner_pid &&
999 (gh->gh_gl->gl_ops->go_type != LM_TYPE_FLOCK)))
1003 !may_grant(gl, gh)) {
1005 gh->gh_error = GLR_TRYFAILED;
1006 gfs2_holder_wake(gh);
1011 if (unlikely((gh->gh_flags & LM_FLAG_PRIORITY) && !insert_pt))
1015 list_add_tail(&gh->gh_list, &gl->gl_holders);
1016 if (unlikely(gh->gh_flags & LM_FLAG_PRIORITY))
1020 trace_gfs2_glock_queue(gh, 1);
1021 list_add_tail(&gh->gh_list, insert_pt);
1023 gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list);
1024 if (!(gh->gh_flags & LM_FLAG_PRIORITY)) {
1037 print_symbol(KERN_ERR "new: %s\n", gh->gh_ip);
1038 printk(KERN_ERR "pid: %d\n", pid_nr(gh->gh_owner_pid));
1040 gh->gh_gl->gl_name.ln_type, gh->gh_state);
1047 * @gh: the holder structure
1049 * if (gh->gh_flags & GL_ASYNC), this never returns an error
1054 int gfs2_glock_nq(struct gfs2_holder *gh)
1056 struct gfs2_glock *gl = gh->gh_gl;
1064 add_to_queue(gh);
1065 if ((LM_FLAG_NOEXP & gh->gh_flags) &&
1071 if (!(gh->gh_flags & GL_ASYNC))
1072 error = gfs2_glock_wait(gh);
1079 * @gh: the holder
1084 int gfs2_glock_poll(struct gfs2_holder *gh)
1086 return test_bit(HIF_WAIT, &gh->gh_iflags) ? 0 : 1;
1091 * @gh: the glock holder
1095 void gfs2_glock_dq(struct gfs2_holder *gh)
1097 struct gfs2_glock *gl = gh->gh_gl;
1103 if (gh->gh_flags & GL_NOCACHE)
1106 list_del_init(&gh->gh_list);
1111 glops->go_unlock(gh);
1120 trace_gfs2_glock_queue(gh, 0);
1133 void gfs2_glock_dq_wait(struct gfs2_holder *gh)
1135 struct gfs2_glock *gl = gh->gh_gl;
1136 gfs2_glock_dq(gh);
1142 * @gh: the holder structure
1146 void gfs2_glock_dq_uninit(struct gfs2_holder *gh)
1148 gfs2_glock_dq(gh);
1149 gfs2_holder_uninit(gh);
1159 * @gh: the struct gfs2_holder
1166 unsigned int state, int flags, struct gfs2_holder *gh)
1173 error = gfs2_glock_nq_init(gl, state, flags, gh);
1337 const struct gfs2_holder *gh;
1344 list_for_each_entry(gh, &gl->gl_holders, gh_list) {
1345 if (test_bit(HIF_HOLDER, &gh->gh_iflags))
1347 if (LM_FLAG_NOEXP & gh->gh_flags)
1616 * @gh: the glock holder
1621 static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
1627 sprint_symbol(buffer, gh->gh_ip);
1628 if (gh->gh_owner_pid)
1629 gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID);
1631 state2str(gh->gh_state),
1632 hflags2str(flags_buf, gh->gh_flags, gh->gh_iflags),
1633 gh->gh_error,
1634 gh->gh_owner_pid ? (long)pid_nr(gh->gh_owner_pid) : -1,
1688 const struct gfs2_holder *gh;
1706 list_for_each_entry(gh, &gl->gl_holders, gh_list) {
1707 error = dump_holder(seq, gh);