mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
gfs2: Get rid of demote_ok checks
The demote_ok glock operation is only still used to prevent the inode glocks of the "jindex" and "rindex" directories from getting recycled while they are still referenced by sdp->sd_jindex and sdp->sd_rindex. However, the LRU walking code will no longer recycle glocks which are referenced, so the demote_ok glock operation is obsolete and can be removed. Each of a glock's holders in the gl_holders list is holding a reference on the glock, so when the list of holders isn't empty in demote_ok(), the existing reference count check will already prevent the glock from getting released. This means that demote_ok() is obsolete as well. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
parent
3f4475bf24
commit
713f883438
@ -61,8 +61,6 @@ Field Purpose
|
|||||||
go_sync Called before remote state change (e.g. to sync dirty data)
|
go_sync Called before remote state change (e.g. to sync dirty data)
|
||||||
go_xmote_bh Called after remote state change (e.g. to refill cache)
|
go_xmote_bh Called after remote state change (e.g. to refill cache)
|
||||||
go_inval Called if remote state change requires invalidating the cache
|
go_inval Called if remote state change requires invalidating the cache
|
||||||
go_demote_ok Returns boolean value of whether its ok to demote a glock
|
|
||||||
(e.g. checks timeout, and that there is no cached data)
|
|
||||||
go_instantiate Called when a glock has been acquired
|
go_instantiate Called when a glock has been acquired
|
||||||
go_held Called every time a glock holder is acquired
|
go_held Called every time a glock holder is acquired
|
||||||
go_dump Called to print content of object for debugfs file, or on
|
go_dump Called to print content of object for debugfs file, or on
|
||||||
@ -95,7 +93,6 @@ Operation GLF_LOCK bit lock held gl_lockref.lock spinlock held
|
|||||||
go_sync Yes No
|
go_sync Yes No
|
||||||
go_xmote_bh Yes No
|
go_xmote_bh Yes No
|
||||||
go_inval Yes No
|
go_inval Yes No
|
||||||
go_demote_ok Sometimes Yes
|
|
||||||
go_instantiate No No
|
go_instantiate No No
|
||||||
go_held No No
|
go_held No No
|
||||||
go_dump Sometimes Yes
|
go_dump Sometimes Yes
|
||||||
|
@ -216,27 +216,6 @@ struct gfs2_glock *gfs2_glock_hold(struct gfs2_glock *gl)
|
|||||||
return gl;
|
return gl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* demote_ok - Check to see if it's ok to unlock a glock
|
|
||||||
* @gl: the glock
|
|
||||||
*
|
|
||||||
* Returns: 1 if it's ok
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int demote_ok(const struct gfs2_glock *gl)
|
|
||||||
{
|
|
||||||
const struct gfs2_glock_operations *glops = gl->gl_ops;
|
|
||||||
|
|
||||||
if (gl->gl_state == LM_ST_UNLOCKED)
|
|
||||||
return 0;
|
|
||||||
if (!list_empty(&gl->gl_holders))
|
|
||||||
return 0;
|
|
||||||
if (glops->go_demote_ok)
|
|
||||||
return glops->go_demote_ok(gl);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
|
static void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
|
||||||
{
|
{
|
||||||
spin_lock(&lru_lock);
|
spin_lock(&lru_lock);
|
||||||
@ -2049,7 +2028,7 @@ __acquires(&lru_lock)
|
|||||||
clear_bit(GLF_LRU, &gl->gl_flags);
|
clear_bit(GLF_LRU, &gl->gl_flags);
|
||||||
freed++;
|
freed++;
|
||||||
gl->gl_lockref.count++;
|
gl->gl_lockref.count++;
|
||||||
if (demote_ok(gl))
|
if (gl->gl_state != LM_ST_UNLOCKED)
|
||||||
request_demote(gl, LM_ST_UNLOCKED, 0, false);
|
request_demote(gl, LM_ST_UNLOCKED, 0, false);
|
||||||
gfs2_glock_queue_work(gl, 0);
|
gfs2_glock_queue_work(gl, 0);
|
||||||
spin_unlock(&gl->gl_lockref.lock);
|
spin_unlock(&gl->gl_lockref.lock);
|
||||||
|
@ -385,23 +385,6 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
|
|||||||
gfs2_clear_glop_pending(ip);
|
gfs2_clear_glop_pending(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* inode_go_demote_ok - Check to see if it's ok to unlock an inode glock
|
|
||||||
* @gl: the glock
|
|
||||||
*
|
|
||||||
* Returns: 1 if it's ok
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int inode_go_demote_ok(const struct gfs2_glock *gl)
|
|
||||||
{
|
|
||||||
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
|
|
||||||
|
|
||||||
if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
|
static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
|
||||||
{
|
{
|
||||||
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
||||||
@ -722,7 +705,6 @@ const struct gfs2_glock_operations gfs2_meta_glops = {
|
|||||||
const struct gfs2_glock_operations gfs2_inode_glops = {
|
const struct gfs2_glock_operations gfs2_inode_glops = {
|
||||||
.go_sync = inode_go_sync,
|
.go_sync = inode_go_sync,
|
||||||
.go_inval = inode_go_inval,
|
.go_inval = inode_go_inval,
|
||||||
.go_demote_ok = inode_go_demote_ok,
|
|
||||||
.go_instantiate = inode_go_instantiate,
|
.go_instantiate = inode_go_instantiate,
|
||||||
.go_held = inode_go_held,
|
.go_held = inode_go_held,
|
||||||
.go_dump = inode_go_dump,
|
.go_dump = inode_go_dump,
|
||||||
|
@ -218,7 +218,6 @@ struct gfs2_glock_operations {
|
|||||||
int (*go_sync) (struct gfs2_glock *gl);
|
int (*go_sync) (struct gfs2_glock *gl);
|
||||||
int (*go_xmote_bh)(struct gfs2_glock *gl);
|
int (*go_xmote_bh)(struct gfs2_glock *gl);
|
||||||
void (*go_inval) (struct gfs2_glock *gl, int flags);
|
void (*go_inval) (struct gfs2_glock *gl, int flags);
|
||||||
int (*go_demote_ok) (const struct gfs2_glock *gl);
|
|
||||||
int (*go_instantiate) (struct gfs2_glock *gl);
|
int (*go_instantiate) (struct gfs2_glock *gl);
|
||||||
int (*go_held)(struct gfs2_holder *gh);
|
int (*go_held)(struct gfs2_holder *gh);
|
||||||
void (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl,
|
void (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl,
|
||||||
|
Loading…
Reference in New Issue
Block a user