Skip to content

Commit eb43e66

Browse files
AstralBobagruenba
authored andcommitted
gfs2: Introduce function gfs2_withdrawn
Add function gfs2_withdrawn and replace all checks for the SDF_WITHDRAWN bit to call it. This does not change the logic or function of gfs2, and it facilitates later improvements to the withdraw sequence. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent fe5e7ba commit eb43e66

11 files changed

Lines changed: 26 additions & 19 deletions

File tree

‎fs/gfs2/aops.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static int __gfs2_readpage(void *file, struct page *page)
497497
error = mpage_readpage(page, gfs2_block_map);
498498
}
499499

500-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
500+
if (unlikely(gfs2_withdrawn(sdp)))
501501
return -EIO;
502502

503503
return error;
@@ -614,7 +614,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,
614614
gfs2_glock_dq(&gh);
615615
out_uninit:
616616
gfs2_holder_uninit(&gh);
617-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
617+
if (unlikely(gfs2_withdrawn(sdp)))
618618
ret = -EIO;
619619
return ret;
620620
}

‎fs/gfs2/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
11941194
cmd = F_SETLK;
11951195
fl->fl_type = F_UNLCK;
11961196
}
1197-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) {
1197+
if (unlikely(gfs2_withdrawn(sdp))) {
11981198
if (fl->fl_type == F_UNLCK)
11991199
locks_lock_file_wait(file, fl);
12001200
return -EIO;

‎fs/gfs2/glock.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ __acquires(&gl->gl_lockref.lock)
549549
unsigned int lck_flags = (unsigned int)(gh ? gh->gh_flags : 0);
550550
int ret;
551551

552-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) &&
552+
if (unlikely(gfs2_withdrawn(sdp)) &&
553553
target != LM_ST_UNLOCKED)
554554
return;
555555
lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP |
@@ -586,8 +586,7 @@ __acquires(&gl->gl_lockref.lock)
586586
}
587587
else if (ret) {
588588
fs_err(sdp, "lm_lock ret %d\n", ret);
589-
GLOCK_BUG_ON(gl, !test_bit(SDF_WITHDRAWN,
590-
&sdp->sd_flags));
589+
GLOCK_BUG_ON(gl, !gfs2_withdrawn(sdp));
591590
}
592591
} else { /* lock_nolock */
593592
finish_xmote(gl, target);
@@ -1191,7 +1190,7 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
11911190
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
11921191
int error = 0;
11931192

1194-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
1193+
if (unlikely(gfs2_withdrawn(sdp)))
11951194
return -EIO;
11961195

11971196
if (test_bit(GLF_LRU, &gl->gl_flags))

‎fs/gfs2/glops.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
540540
gfs2_consist(sdp);
541541

542542
/* Initialize some head of the log stuff */
543-
if (!test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
543+
if (!gfs2_withdrawn(sdp)) {
544544
sdp->sd_log_sequence = head.lh_sequence + 1;
545545
gfs2_log_pointers_init(sdp, head.lh_blkno);
546546
}

‎fs/gfs2/meta_io.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
251251
struct buffer_head *bh, *bhs[2];
252252
int num = 0;
253253

254-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) {
254+
if (unlikely(gfs2_withdrawn(sdp))) {
255255
*bhp = NULL;
256256
return -EIO;
257257
}
@@ -309,7 +309,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
309309

310310
int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
311311
{
312-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
312+
if (unlikely(gfs2_withdrawn(sdp)))
313313
return -EIO;
314314

315315
wait_on_buffer(bh);
@@ -320,7 +320,7 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
320320
gfs2_io_error_bh_wd(sdp, bh);
321321
return -EIO;
322322
}
323-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
323+
if (unlikely(gfs2_withdrawn(sdp)))
324324
return -EIO;
325325

326326
return 0;

‎fs/gfs2/ops_fstype.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
10061006
void gfs2_lm_unmount(struct gfs2_sbd *sdp)
10071007
{
10081008
const struct lm_lockops *lm = sdp->sd_lockstruct.ls_ops;
1009-
if (likely(!test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) &&
1010-
lm->lm_unmount)
1009+
if (likely(!gfs2_withdrawn(sdp)) && lm->lm_unmount)
10111010
lm->lm_unmount(sdp);
10121011
}
10131012

‎fs/gfs2/quota.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ static void quotad_error(struct gfs2_sbd *sdp, const char *msg, int error)
14751475
{
14761476
if (error == 0 || error == -EROFS)
14771477
return;
1478-
if (!test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
1478+
if (!gfs2_withdrawn(sdp)) {
14791479
fs_err(sdp, "gfs2_quotad: %s error %d\n", msg, error);
14801480
sdp->sd_log_error = error;
14811481
wake_up(&sdp->sd_logd_waitq);

‎fs/gfs2/super.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static void gfs2_dirty_inode(struct inode *inode, int flags)
553553

554554
if (!(flags & I_DIRTY_INODE))
555555
return;
556-
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
556+
if (unlikely(gfs2_withdrawn(sdp)))
557557
return;
558558
if (!gfs2_glock_is_locked_by_me(ip->i_gl)) {
559559
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
@@ -602,7 +602,7 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
602602

603603
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, GL_NOCACHE,
604604
&freeze_gh);
605-
if (error && !test_bit(SDF_WITHDRAWN, &sdp->sd_flags))
605+
if (error && !gfs2_withdrawn(sdp))
606606
return error;
607607

608608
flush_workqueue(gfs2_delete_workqueue);
@@ -761,7 +761,7 @@ static int gfs2_freeze(struct super_block *sb)
761761
if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN)
762762
goto out;
763763

764-
if (test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
764+
if (gfs2_withdrawn(sdp)) {
765765
error = -EINVAL;
766766
goto out;
767767
}

‎fs/gfs2/sys.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
118118

119119
static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf)
120120
{
121-
unsigned int b = test_bit(SDF_WITHDRAWN, &sdp->sd_flags);
121+
unsigned int b = gfs2_withdrawn(sdp);
122122
return snprintf(buf, PAGE_SIZE, "%u\n", b);
123123
}
124124

‎fs/gfs2/util.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh,
258258
const char *function, char *file, unsigned int line,
259259
bool withdraw)
260260
{
261-
if (!test_bit(SDF_WITHDRAWN, &sdp->sd_flags))
261+
if (!gfs2_withdrawn(sdp))
262262
fs_err(sdp,
263263
"fatal: I/O error\n"
264264
" block = %llu\n"

0 commit comments

Comments
 (0)