Commit eb43e660 authored by Bob Peterson's avatar Bob Peterson Committed by Andreas Gruenbacher
Browse files

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: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent fe5e7ba1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -497,7 +497,7 @@ static int __gfs2_readpage(void *file, struct page *page)
		error = mpage_readpage(page, gfs2_block_map);
	}

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

	return error;
@@ -614,7 +614,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,
	gfs2_glock_dq(&gh);
out_uninit:
	gfs2_holder_uninit(&gh);
	if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags)))
	if (unlikely(gfs2_withdrawn(sdp)))
		ret = -EIO;
	return ret;
}
+1 −1
Original line number Diff line number Diff line
@@ -1194,7 +1194,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
		cmd = F_SETLK;
		fl->fl_type = F_UNLCK;
	}
	if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) {
	if (unlikely(gfs2_withdrawn(sdp))) {
		if (fl->fl_type == F_UNLCK)
			locks_lock_file_wait(file, fl);
		return -EIO;
+3 −4
Original line number Diff line number Diff line
@@ -549,7 +549,7 @@ __acquires(&gl->gl_lockref.lock)
	unsigned int lck_flags = (unsigned int)(gh ? gh->gh_flags : 0);
	int ret;

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

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

	if (test_bit(GLF_LRU, &gl->gl_flags))
+1 −1
Original line number Diff line number Diff line
@@ -540,7 +540,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
			gfs2_consist(sdp);

		/*  Initialize some head of the log stuff  */
		if (!test_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
		if (!gfs2_withdrawn(sdp)) {
			sdp->sd_log_sequence = head.lh_sequence + 1;
			gfs2_log_pointers_init(sdp, head.lh_blkno);
		}
+3 −3
Original line number Diff line number Diff line
@@ -251,7 +251,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
	struct buffer_head *bh, *bhs[2];
	int num = 0;

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

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

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

	return 0;
Loading