diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2024-09-09 23:38:59 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2024-11-05 12:39:28 +0100 |
commit | ee51baa817eec7c5182c1e4450c4d1e8469faa96 (patch) | |
tree | 814fcde110cb5469e4820c32eeff0d46f9df6e55 /fs/gfs2/glock.h | |
parent | KMSAN: uninit-value in inode_go_dump (5) (diff) | |
download | linux-ee51baa817eec7c5182c1e4450c4d1e8469faa96.tar.xz linux-ee51baa817eec7c5182c1e4450c4d1e8469faa96.zip |
gfs2: Faster gfs2_upgrade_iopen_glock wakeups
Move function needs_demote() to glock.h and rename it to
glock_needs_demote(). In handle_callback(), wake up the glock when
setting the GLF_PENDING_DEMOTE flag as well. (Setting the GLF_DEMOTE
flag already triggered a wake-up.)
With that, check for glock_needs_demote() in gfs2_upgrade_iopen_glock()
to wake up when either of those flags is set for the inode glock: the
faster we can react to contention, the better.
The GLF_PENDING_DEMOTE flag is only used for inode glocks (see
gfs2_glock_cb()) so it's okay to only check for the GLF_DEMOTE flag in
gfs2_drop_inode(). Still, using glock_needs_demote() there as well
makes the code a little easier to read.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.h')
-rw-r--r-- | fs/gfs2/glock.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index 63e101d448e9..c171f745650f 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h @@ -285,4 +285,10 @@ static inline bool gfs2_holder_queued(struct gfs2_holder *gh) void gfs2_inode_remember_delete(struct gfs2_glock *gl, u64 generation); bool gfs2_inode_already_deleted(struct gfs2_glock *gl, u64 generation); +static inline bool glock_needs_demote(struct gfs2_glock *gl) +{ + return (test_bit(GLF_DEMOTE, &gl->gl_flags) || + test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags)); +} + #endif /* __GLOCK_DOT_H__ */ |