Skip to content

Commit 21d9067

Browse files
author
Andreas Gruenbacher
committed
gfs2: Get rid of the gfs2_glock_is_held_* helpers
Those helpers don't add any clarity and are easy to use wrong. Spell them out to make more obvious what's happening. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent b4bf3d5 commit 21d9067

3 files changed

Lines changed: 2 additions & 17 deletions

File tree

fs/gfs2/aops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc
155155
struct gfs2_inode *ip = GFS2_I(inode);
156156
struct gfs2_sbd *sdp = GFS2_SB(inode);
157157

158-
if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl)))
158+
if (gfs2_assert_withdraw(sdp, ip->i_gl->gl_state == LM_ST_EXCLUSIVE))
159159
goto out;
160160
if (folio_test_checked(folio) || current->journal_info)
161161
goto out_ignore;

fs/gfs2/glock.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,6 @@ static inline struct gfs2_holder *gfs2_glock_is_locked_by_me(struct gfs2_glock *
156156
return gh;
157157
}
158158

159-
static inline int gfs2_glock_is_held_excl(struct gfs2_glock *gl)
160-
{
161-
return gl->gl_state == LM_ST_EXCLUSIVE;
162-
}
163-
164-
static inline int gfs2_glock_is_held_dfrd(struct gfs2_glock *gl)
165-
{
166-
return gl->gl_state == LM_ST_DEFERRED;
167-
}
168-
169-
static inline int gfs2_glock_is_held_shrd(struct gfs2_glock *gl)
170-
{
171-
return gl->gl_state == LM_ST_SHARED;
172-
}
173-
174159
static inline struct address_space *gfs2_glock2aspace(struct gfs2_glock *gl)
175160
{
176161
if (gl->gl_ops->go_flags & GLOF_ASPACE) {

fs/gfs2/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ static int gfs2_update_time(struct inode *inode, int flags)
21532153
int error;
21542154

21552155
gh = gfs2_glock_is_locked_by_me(gl);
2156-
if (gh && !gfs2_glock_is_held_excl(gl)) {
2156+
if (gh && gl->gl_state != LM_ST_EXCLUSIVE) {
21572157
gfs2_glock_dq(gh);
21582158
gfs2_holder_reinit(LM_ST_EXCLUSIVE, 0, gh);
21592159
error = gfs2_glock_nq(gh);

0 commit comments

Comments
 (0)