Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+16 -74
+1 -1
fs/gfs2/glock.c
··· 756 756 * then it's okay to tell dlm to unlock it. 757 757 */ 758 758 if (unlikely(sdp->sd_log_error) && !gfs2_withdrawing_or_withdrawn(sdp)) 759 - gfs2_withdraw_delayed(sdp); 759 + gfs2_withdraw(sdp); 760 760 if (glock_blocked_by_withdraw(gl) && 761 761 (target != LM_ST_UNLOCKED || 762 762 test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags))) {
+4 -7
fs/gfs2/glops.c
··· 45 45 gl->gl_name.ln_type, gl->gl_name.ln_number, 46 46 gfs2_glock2aspace(gl)); 47 47 gfs2_lm(sdp, "AIL error\n"); 48 - gfs2_withdraw_delayed(sdp); 48 + gfs2_withdraw(sdp); 49 49 } 50 50 51 51 /** ··· 83 83 GLOCK_BUG_ON(gl, !fsync && atomic_read(&gl->gl_ail_count)); 84 84 spin_unlock(&sdp->sd_ail_lock); 85 85 gfs2_log_unlock(sdp); 86 - 87 - if (gfs2_withdrawing(sdp)) 88 - gfs2_withdraw(sdp); 89 86 } 90 87 91 88 ··· 605 608 j_gl->gl_ops->go_inval(j_gl, DIO_METADATA); 606 609 607 610 error = gfs2_find_jhead(sdp->sd_jdesc, &head); 608 - if (gfs2_assert_withdraw_delayed(sdp, !error)) 611 + if (gfs2_assert_withdraw(sdp, !error)) 609 612 return error; 610 - if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags & 611 - GFS2_LOG_HEAD_UNMOUNT)) 613 + if (gfs2_assert_withdraw(sdp, head.lh_flags & 614 + GFS2_LOG_HEAD_UNMOUNT)) 612 615 return -EIO; 613 616 gfs2_log_pointers_init(sdp, &head); 614 617 }
-1
fs/gfs2/incore.h
··· 599 599 SDF_SKIP_DLM_UNLOCK = 8, 600 600 SDF_FORCE_AIL_FLUSH = 9, 601 601 SDF_FREEZE_INITIATOR = 10, 602 - SDF_WITHDRAWING = 11, /* Will withdraw eventually */ 603 602 SDF_WITHDRAW_IN_PROG = 12, /* Withdraw is in progress */ 604 603 SDF_REMOTE_WITHDRAW = 13, /* Performing remote recovery */ 605 604 SDF_WITHDRAW_RECOVERY = 14, /* Wait for journal recovery when we are
+5 -16
fs/gfs2/log.c
··· 114 114 } 115 115 if (!cmpxchg(&sdp->sd_log_error, 0, -EIO)) { 116 116 gfs2_io_error_bh(sdp, bh); 117 - gfs2_withdraw_delayed(sdp); 117 + gfs2_withdraw(sdp); 118 118 } 119 119 } 120 120 ··· 326 326 if (!buffer_uptodate(bh) && 327 327 !cmpxchg(&sdp->sd_log_error, 0, -EIO)) { 328 328 gfs2_io_error_bh(sdp, bh); 329 - gfs2_withdraw_delayed(sdp); 329 + gfs2_withdraw(sdp); 330 330 } 331 331 /* 332 332 * If we have space for revokes and the bd is no longer on any ··· 807 807 gfs2_log_lock(sdp); 808 808 gfs2_ail1_empty(sdp, max_revokes); 809 809 gfs2_log_unlock(sdp); 810 - 811 - if (gfs2_withdrawing(sdp)) 812 - gfs2_withdraw(sdp); 813 810 } 814 811 815 812 /** ··· 984 987 if (gfs2_withdrawing_or_withdrawn(sdp)) 985 988 break; 986 989 } 987 - 988 - if (gfs2_withdrawing(sdp)) 989 - gfs2_withdraw(sdp); 990 990 } 991 991 992 992 /** ··· 1065 1071 sdp->sd_log_tr = NULL; 1066 1072 tr->tr_first = first_log_head; 1067 1073 if (unlikely(frozen)) { 1068 - if (gfs2_assert_withdraw_delayed(sdp, 1074 + if (gfs2_assert_withdraw(sdp, 1069 1075 !tr->tr_num_buf_new && !tr->tr_num_databuf_new)) 1070 1076 goto out_withdraw; 1071 1077 } ··· 1090 1096 clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); 1091 1097 1092 1098 if (unlikely(frozen)) 1093 - if (gfs2_assert_withdraw_delayed(sdp, !reserved_revokes)) 1099 + if (gfs2_assert_withdraw(sdp, !reserved_revokes)) 1094 1100 goto out_withdraw; 1095 1101 1096 1102 gfs2_ordered_write(sdp); ··· 1145 1151 reserved_blocks += (reserved_revokes - sdp->sd_ldptrs) / sdp->sd_inptrs; 1146 1152 out: 1147 1153 if (used_blocks != reserved_blocks) { 1148 - gfs2_assert_withdraw_delayed(sdp, used_blocks < reserved_blocks); 1154 + gfs2_assert_withdraw(sdp, used_blocks < reserved_blocks); 1149 1155 gfs2_log_release(sdp, reserved_blocks - used_blocks); 1150 1156 } 1151 1157 up_write(&sdp->sd_log_flush_lock); 1152 1158 gfs2_trans_free(sdp, tr); 1153 - if (gfs2_withdrawing(sdp)) 1154 - gfs2_withdraw(sdp); 1155 1159 trace_gfs2_log_flush(sdp, 0, flags); 1156 1160 return; 1157 1161 ··· 1337 1345 kthread_should_stop(), 1338 1346 t); 1339 1347 } 1340 - 1341 - if (gfs2_withdrawing(sdp)) 1342 - gfs2_withdraw(sdp); 1343 1348 1344 1349 return 0; 1345 1350 }
+1 -1
fs/gfs2/lops.c
··· 209 209 if (!cmpxchg(&sdp->sd_log_error, 0, err)) 210 210 fs_err(sdp, "Error %d writing to journal, jid=%u\n", 211 211 err, sdp->sd_jdesc->jd_jid); 212 - gfs2_withdraw_delayed(sdp); 212 + gfs2_withdraw(sdp); 213 213 /* prevent more writes to the journal */ 214 214 clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); 215 215 wake_up(&sdp->sd_logd_waitq);
-2
fs/gfs2/sys.c
··· 84 84 "Force AIL Flush: %d\n" 85 85 "FS Freeze Initiator: %d\n" 86 86 "FS Frozen: %d\n" 87 - "Withdrawing: %d\n" 88 87 "Withdraw In Prog: %d\n" 89 88 "Remote Withdraw: %d\n" 90 89 "Withdraw Recovery: %d\n" ··· 116 117 test_bit(SDF_FORCE_AIL_FLUSH, &f), 117 118 test_bit(SDF_FREEZE_INITIATOR, &f), 118 119 test_bit(SDF_FROZEN, &f), 119 - test_bit(SDF_WITHDRAWING, &f), 120 120 test_bit(SDF_WITHDRAW_IN_PROG, &f), 121 121 test_bit(SDF_REMOTE_WITHDRAW, &f), 122 122 test_bit(SDF_WITHDRAW_RECOVERY, &f),
+2 -13
fs/gfs2/util.c
··· 364 364 */ 365 365 366 366 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) 369 368 { 370 369 if (gfs2_withdrawing_or_withdrawn(sdp)) 371 370 return; ··· 374 375 "function = %s, file = %s, line = %u\n", 375 376 assertion, function, file, line); 376 377 377 - /* 378 - * If errors=panic was specified on mount, it won't help to delay the 379 - * withdraw. 380 - */ 381 - if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC) 382 - delayed = false; 383 - 384 - if (delayed) 385 - gfs2_withdraw_delayed(sdp); 386 - else 387 - gfs2_withdraw(sdp); 378 + gfs2_withdraw(sdp); 388 379 dump_stack(); 389 380 } 390 381
+3 -33
fs/gfs2/util.h
··· 37 37 38 38 39 39 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); 42 41 43 42 #define gfs2_assert_withdraw(sdp, assertion) \ 44 43 ({ \ 45 44 bool _bool = (assertion); \ 46 45 if (unlikely(!_bool)) \ 47 46 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__); \ 58 48 !_bool; \ 59 49 }) 60 50 ··· 183 193 } 184 194 185 195 /** 186 - * gfs2_withdraw_delayed - withdraw as soon as possible without deadlocks 187 - * @sdp: the superblock 188 - */ 189 - static inline void gfs2_withdraw_delayed(struct gfs2_sbd *sdp) 190 - { 191 - set_bit(SDF_WITHDRAWING, &sdp->sd_flags); 192 - } 193 - 194 - /** 195 196 * gfs2_withdrawing_or_withdrawn - test whether the file system is withdrawing 196 197 * or withdrawn 197 198 * @sdp: the superblock 198 199 */ 199 200 static inline bool gfs2_withdrawing_or_withdrawn(struct gfs2_sbd *sdp) 200 201 { 201 - return unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags) || 202 - test_bit(SDF_WITHDRAWING, &sdp->sd_flags)); 203 - } 204 - 205 - /** 206 - * gfs2_withdrawing - check if a withdraw is pending 207 - * @sdp: the superblock 208 - */ 209 - static inline bool gfs2_withdrawing(struct gfs2_sbd *sdp) 210 - { 211 - return unlikely(test_bit(SDF_WITHDRAWING, &sdp->sd_flags) && 212 - !test_bit(SDF_WITHDRAWN, &sdp->sd_flags)); 202 + return unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)); 213 203 } 214 204 215 205 static inline bool gfs2_withdraw_in_prog(struct gfs2_sbd *sdp)