Skip to content

Commit 8daf6c2

Browse files
author
Andreas Gruenbacher
committed
gfs2: Get rid of delayed withdraws
Now that gfs2_withdraw() is asynchronous, is can be called in any context and there is no more need for gfs2_withdraw_delayed() or for turning delayed withdraws into actual withdraws. Remove the now-obsolete code. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 9c4a3de commit 8daf6c2

8 files changed

Lines changed: 16 additions & 74 deletions

File tree

fs/gfs2/glock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ __acquires(&gl->gl_lockref.lock)
756756
* then it's okay to tell dlm to unlock it.
757757
*/
758758
if (unlikely(sdp->sd_log_error) && !gfs2_withdrawing_or_withdrawn(sdp))
759-
gfs2_withdraw_delayed(sdp);
759+
gfs2_withdraw(sdp);
760760
if (glock_blocked_by_withdraw(gl) &&
761761
(target != LM_ST_UNLOCKED ||
762762
test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags))) {

fs/gfs2/glops.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
4545
gl->gl_name.ln_type, gl->gl_name.ln_number,
4646
gfs2_glock2aspace(gl));
4747
gfs2_lm(sdp, "AIL error\n");
48-
gfs2_withdraw_delayed(sdp);
48+
gfs2_withdraw(sdp);
4949
}
5050

5151
/**
@@ -83,9 +83,6 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
8383
GLOCK_BUG_ON(gl, !fsync && atomic_read(&gl->gl_ail_count));
8484
spin_unlock(&sdp->sd_ail_lock);
8585
gfs2_log_unlock(sdp);
86-
87-
if (gfs2_withdrawing(sdp))
88-
gfs2_withdraw(sdp);
8986
}
9087

9188

@@ -608,10 +605,10 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl)
608605
j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
609606

610607
error = gfs2_find_jhead(sdp->sd_jdesc, &head);
611-
if (gfs2_assert_withdraw_delayed(sdp, !error))
608+
if (gfs2_assert_withdraw(sdp, !error))
612609
return error;
613-
if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags &
614-
GFS2_LOG_HEAD_UNMOUNT))
610+
if (gfs2_assert_withdraw(sdp, head.lh_flags &
611+
GFS2_LOG_HEAD_UNMOUNT))
615612
return -EIO;
616613
gfs2_log_pointers_init(sdp, &head);
617614
}

fs/gfs2/incore.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ enum {
599599
SDF_SKIP_DLM_UNLOCK = 8,
600600
SDF_FORCE_AIL_FLUSH = 9,
601601
SDF_FREEZE_INITIATOR = 10,
602-
SDF_WITHDRAWING = 11, /* Will withdraw eventually */
603602
SDF_WITHDRAW_IN_PROG = 12, /* Withdraw is in progress */
604603
SDF_REMOTE_WITHDRAW = 13, /* Performing remote recovery */
605604
SDF_WITHDRAW_RECOVERY = 14, /* Wait for journal recovery when we are

fs/gfs2/log.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ __acquires(&sdp->sd_ail_lock)
114114
}
115115
if (!cmpxchg(&sdp->sd_log_error, 0, -EIO)) {
116116
gfs2_io_error_bh(sdp, bh);
117-
gfs2_withdraw_delayed(sdp);
117+
gfs2_withdraw(sdp);
118118
}
119119
}
120120

@@ -326,7 +326,7 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_trans *tr,
326326
if (!buffer_uptodate(bh) &&
327327
!cmpxchg(&sdp->sd_log_error, 0, -EIO)) {
328328
gfs2_io_error_bh(sdp, bh);
329-
gfs2_withdraw_delayed(sdp);
329+
gfs2_withdraw(sdp);
330330
}
331331
/*
332332
* If we have space for revokes and the bd is no longer on any
@@ -807,9 +807,6 @@ void gfs2_flush_revokes(struct gfs2_sbd *sdp)
807807
gfs2_log_lock(sdp);
808808
gfs2_ail1_empty(sdp, max_revokes);
809809
gfs2_log_unlock(sdp);
810-
811-
if (gfs2_withdrawing(sdp))
812-
gfs2_withdraw(sdp);
813810
}
814811

815812
/**
@@ -987,9 +984,6 @@ static void empty_ail1_list(struct gfs2_sbd *sdp)
987984
if (gfs2_withdrawing_or_withdrawn(sdp))
988985
break;
989986
}
990-
991-
if (gfs2_withdrawing(sdp))
992-
gfs2_withdraw(sdp);
993987
}
994988

995989
/**
@@ -1071,7 +1065,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
10711065
sdp->sd_log_tr = NULL;
10721066
tr->tr_first = first_log_head;
10731067
if (unlikely(frozen)) {
1074-
if (gfs2_assert_withdraw_delayed(sdp,
1068+
if (gfs2_assert_withdraw(sdp,
10751069
!tr->tr_num_buf_new && !tr->tr_num_databuf_new))
10761070
goto out_withdraw;
10771071
}
@@ -1096,7 +1090,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
10961090
clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
10971091

10981092
if (unlikely(frozen))
1099-
if (gfs2_assert_withdraw_delayed(sdp, !reserved_revokes))
1093+
if (gfs2_assert_withdraw(sdp, !reserved_revokes))
11001094
goto out_withdraw;
11011095

11021096
gfs2_ordered_write(sdp);
@@ -1151,13 +1145,11 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
11511145
reserved_blocks += (reserved_revokes - sdp->sd_ldptrs) / sdp->sd_inptrs;
11521146
out:
11531147
if (used_blocks != reserved_blocks) {
1154-
gfs2_assert_withdraw_delayed(sdp, used_blocks < reserved_blocks);
1148+
gfs2_assert_withdraw(sdp, used_blocks < reserved_blocks);
11551149
gfs2_log_release(sdp, reserved_blocks - used_blocks);
11561150
}
11571151
up_write(&sdp->sd_log_flush_lock);
11581152
gfs2_trans_free(sdp, tr);
1159-
if (gfs2_withdrawing(sdp))
1160-
gfs2_withdraw(sdp);
11611153
trace_gfs2_log_flush(sdp, 0, flags);
11621154
return;
11631155

@@ -1346,9 +1338,6 @@ int gfs2_logd(void *data)
13461338
t);
13471339
}
13481340

1349-
if (gfs2_withdrawing(sdp))
1350-
gfs2_withdraw(sdp);
1351-
13521341
return 0;
13531342
}
13541343

fs/gfs2/lops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static void gfs2_end_log_write(struct bio *bio)
209209
if (!cmpxchg(&sdp->sd_log_error, 0, err))
210210
fs_err(sdp, "Error %d writing to journal, jid=%u\n",
211211
err, sdp->sd_jdesc->jd_jid);
212-
gfs2_withdraw_delayed(sdp);
212+
gfs2_withdraw(sdp);
213213
/* prevent more writes to the journal */
214214
clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
215215
wake_up(&sdp->sd_logd_waitq);

fs/gfs2/sys.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
8484
"Force AIL Flush: %d\n"
8585
"FS Freeze Initiator: %d\n"
8686
"FS Frozen: %d\n"
87-
"Withdrawing: %d\n"
8887
"Withdraw In Prog: %d\n"
8988
"Remote Withdraw: %d\n"
9089
"Withdraw Recovery: %d\n"
@@ -117,7 +116,6 @@ static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
117116
test_bit(SDF_FORCE_AIL_FLUSH, &f),
118117
test_bit(SDF_FREEZE_INITIATOR, &f),
119118
test_bit(SDF_FROZEN, &f),
120-
test_bit(SDF_WITHDRAWING, &f),
121119
test_bit(SDF_WITHDRAW_IN_PROG, &f),
122120
test_bit(SDF_REMOTE_WITHDRAW, &f),
123121
test_bit(SDF_WITHDRAW_RECOVERY, &f),

fs/gfs2/util.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ void gfs2_withdraw(struct gfs2_sbd *sdp)
364364
*/
365365

366366
void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
367-
const char *function, char *file, unsigned int line,
368-
bool delayed)
367+
const char *function, char *file, unsigned int line)
369368
{
370369
if (gfs2_withdrawing_or_withdrawn(sdp))
371370
return;
@@ -375,17 +374,7 @@ void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
375374
"function = %s, file = %s, line = %u\n",
376375
assertion, function, file, line);
377376

378-
/*
379-
* If errors=panic was specified on mount, it won't help to delay the
380-
* withdraw.
381-
*/
382-
if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
383-
delayed = false;
384-
385-
if (delayed)
386-
gfs2_withdraw_delayed(sdp);
387-
else
388-
gfs2_withdraw(sdp);
377+
gfs2_withdraw(sdp);
389378
dump_stack();
390379
}
391380

fs/gfs2/util.h

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,14 @@ do { \
3737

3838

3939
void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
40-
const char *function, char *file, unsigned int line,
41-
bool delayed);
40+
const char *function, char *file, unsigned int line);
4241

4342
#define gfs2_assert_withdraw(sdp, assertion) \
4443
({ \
4544
bool _bool = (assertion); \
4645
if (unlikely(!_bool)) \
4746
gfs2_assert_withdraw_i((sdp), #assertion, \
48-
__func__, __FILE__, __LINE__, false); \
49-
!_bool; \
50-
})
51-
52-
#define gfs2_assert_withdraw_delayed(sdp, assertion) \
53-
({ \
54-
bool _bool = (assertion); \
55-
if (unlikely(!_bool)) \
56-
gfs2_assert_withdraw_i((sdp), #assertion, \
57-
__func__, __FILE__, __LINE__, true); \
47+
__func__, __FILE__, __LINE__); \
5848
!_bool; \
5949
})
6050

@@ -192,34 +182,14 @@ static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
192182
return x;
193183
}
194184

195-
/**
196-
* gfs2_withdraw_delayed - withdraw as soon as possible without deadlocks
197-
* @sdp: the superblock
198-
*/
199-
static inline void gfs2_withdraw_delayed(struct gfs2_sbd *sdp)
200-
{
201-
set_bit(SDF_WITHDRAWING, &sdp->sd_flags);
202-
}
203-
204185
/**
205186
* gfs2_withdrawing_or_withdrawn - test whether the file system is withdrawing
206187
* or withdrawn
207188
* @sdp: the superblock
208189
*/
209190
static inline bool gfs2_withdrawing_or_withdrawn(struct gfs2_sbd *sdp)
210191
{
211-
return unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags) ||
212-
test_bit(SDF_WITHDRAWING, &sdp->sd_flags));
213-
}
214-
215-
/**
216-
* gfs2_withdrawing - check if a withdraw is pending
217-
* @sdp: the superblock
218-
*/
219-
static inline bool gfs2_withdrawing(struct gfs2_sbd *sdp)
220-
{
221-
return unlikely(test_bit(SDF_WITHDRAWING, &sdp->sd_flags) &&
222-
!test_bit(SDF_WITHDRAWN, &sdp->sd_flags));
192+
return unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags));
223193
}
224194

225195
static inline bool gfs2_withdraw_in_prog(struct gfs2_sbd *sdp)

0 commit comments

Comments
 (0)