glock.c (1a14d3a68f04527546121eb7b45187ff6af63151) glock.c (b004157ab5b374a498a5874cda68c389219d23e7)
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 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 */

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

780
781out:
782 spin_unlock(&gl->gl_spin);
783
784 if (new_gh)
785 gfs2_holder_put(new_gh);
786}
787
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 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 */

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

780
781out:
782 spin_unlock(&gl->gl_spin);
783
784 if (new_gh)
785 gfs2_holder_put(new_gh);
786}
787
788void gfs2_glock_inode_squish(struct inode *inode)
789{
790 struct gfs2_holder gh;
791 struct gfs2_glock *gl = GFS2_I(inode)->i_gl;
792 gfs2_holder_init(gl, LM_ST_UNLOCKED, 0, &gh);
793 set_bit(HIF_DEMOTE, &gh.gh_iflags);
794 spin_lock(&gl->gl_spin);
795 gfs2_assert(inode->i_sb->s_fs_info, list_empty(&gl->gl_holders));
796 list_add_tail(&gh.gh_list, &gl->gl_waiters2);
797 run_queue(gl);
798 spin_unlock(&gl->gl_spin);
799 wait_for_completion(&gh.gh_wait);
800 gfs2_holder_uninit(&gh);
801}
802
803/**
804 * state_change - record that the glock is now in a different state
805 * @gl: the glock
806 * @new_state the new state
807 *
808 */
809
810static void state_change(struct gfs2_glock *gl, unsigned int new_state)

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

1915/**
1916 * scan_glock - look at a glock and see if we can reclaim it
1917 * @gl: the glock to look at
1918 *
1919 */
1920
1921static void scan_glock(struct gfs2_glock *gl)
1922{
788/**
789 * state_change - record that the glock is now in a different state
790 * @gl: the glock
791 * @new_state the new state
792 *
793 */
794
795static void state_change(struct gfs2_glock *gl, unsigned int new_state)

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

1900/**
1901 * scan_glock - look at a glock and see if we can reclaim it
1902 * @gl: the glock to look at
1903 *
1904 */
1905
1906static void scan_glock(struct gfs2_glock *gl)
1907{
1923 if (gl->gl_ops == &gfs2_inode_glops)
1908 if (gl->gl_ops == &gfs2_inode_glops && gl->gl_object)
1924 return;
1925
1926 if (gfs2_glmutex_trylock(gl)) {
1927 if (queue_empty(gl, &gl->gl_holders) &&
1928 gl->gl_state != LM_ST_UNLOCKED && demote_ok(gl))
1929 goto out_schedule;
1930 gfs2_glmutex_unlock(gl);
1931 }

--- 297 unchanged lines hidden ---
1909 return;
1910
1911 if (gfs2_glmutex_trylock(gl)) {
1912 if (queue_empty(gl, &gl->gl_holders) &&
1913 gl->gl_state != LM_ST_UNLOCKED && demote_ok(gl))
1914 goto out_schedule;
1915 gfs2_glmutex_unlock(gl);
1916 }

--- 297 unchanged lines hidden ---