Commit c969f58c authored by Steven Whitehouse's avatar Steven Whitehouse

GFS2: Update the rw flags

After Jens recent updates:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a1f242524c3c1f5d40f1c9c343427e34d1aadd6e
et al. this is a patch to bring gfs2 uptodate with the core
code. Also I've managed to squash another call to ll_rw_block()
along the way.

There is still one part of the GFS2 I/O paths which are not correctly
annotated and that is due to the sharing of the writeback code between
the data and metadata address spaces. I would like to change that too,
but this patch is still worth doing on its own, I think.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent a4d7749b
...@@ -120,7 +120,7 @@ __acquires(&sdp->sd_log_lock) ...@@ -120,7 +120,7 @@ __acquires(&sdp->sd_log_lock)
lock_buffer(bh); lock_buffer(bh);
if (test_clear_buffer_dirty(bh)) { if (test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync; bh->b_end_io = end_buffer_write_sync;
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
} else { } else {
unlock_buffer(bh); unlock_buffer(bh);
brelse(bh); brelse(bh);
...@@ -604,7 +604,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) ...@@ -604,7 +604,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)
if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
goto skip_barrier; goto skip_barrier;
get_bh(bh); get_bh(bh);
submit_bh(WRITE_BARRIER | (1 << BIO_RW_META), bh); submit_bh(WRITE_SYNC | (1 << BIO_RW_BARRIER) | (1 << BIO_RW_META), bh);
wait_on_buffer(bh); wait_on_buffer(bh);
if (buffer_eopnotsupp(bh)) { if (buffer_eopnotsupp(bh)) {
clear_buffer_eopnotsupp(bh); clear_buffer_eopnotsupp(bh);
...@@ -664,7 +664,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp) ...@@ -664,7 +664,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
lock_buffer(bh); lock_buffer(bh);
if (buffer_mapped(bh) && test_clear_buffer_dirty(bh)) { if (buffer_mapped(bh) && test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync; bh->b_end_io = end_buffer_write_sync;
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
} else { } else {
unlock_buffer(bh); unlock_buffer(bh);
brelse(bh); brelse(bh);
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/gfs2_ondisk.h> #include <linux/gfs2_ondisk.h>
#include <linux/bio.h>
#include <linux/fs.h>
#include "gfs2.h" #include "gfs2.h"
#include "incore.h" #include "incore.h"
...@@ -189,7 +191,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -189,7 +191,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
} }
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
n = 0; n = 0;
...@@ -199,7 +201,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -199,7 +201,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
gfs2_log_unlock(sdp); gfs2_log_unlock(sdp);
lock_buffer(bd2->bd_bh); lock_buffer(bd2->bd_bh);
bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); bh = gfs2_log_fake_buf(sdp, bd2->bd_bh);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
if (++n >= num) if (++n >= num)
break; break;
...@@ -341,7 +343,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -341,7 +343,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
sdp->sd_log_num_revoke--; sdp->sd_log_num_revoke--;
if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) { if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) {
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
bh = gfs2_log_get_buf(sdp); bh = gfs2_log_get_buf(sdp);
mh = (struct gfs2_meta_header *)bh->b_data; mh = (struct gfs2_meta_header *)bh->b_data;
...@@ -358,7 +360,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) ...@@ -358,7 +360,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
} }
gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
} }
static void revoke_lo_before_scan(struct gfs2_jdesc *jd, static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
...@@ -560,7 +562,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -560,7 +562,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh,
ptr = bh_log_ptr(bh); ptr = bh_log_ptr(bh);
get_bh(bh); get_bh(bh);
submit_bh(WRITE, bh); submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
while(!list_empty(list)) { while(!list_empty(list)) {
bd = list_entry(list->next, struct gfs2_bufdata, bd_le.le_list); bd = list_entry(list->next, struct gfs2_bufdata, bd_le.le_list);
...@@ -586,7 +588,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -586,7 +588,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh,
} else { } else {
bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh); bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh);
} }
submit_bh(WRITE, bh1); submit_bh(WRITE_SYNC_PLUG, bh1);
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
ptr += 2; ptr += 2;
} }
......
...@@ -201,16 +201,32 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) ...@@ -201,16 +201,32 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno)
int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
struct buffer_head **bhp) struct buffer_head **bhp)
{ {
*bhp = gfs2_getbuf(gl, blkno, CREATE); struct gfs2_sbd *sdp = gl->gl_sbd;
if (!buffer_uptodate(*bhp)) { struct buffer_head *bh;
ll_rw_block(READ_META, 1, bhp);
if (flags & DIO_WAIT) { if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
int error = gfs2_meta_wait(gl->gl_sbd, *bhp); return -EIO;
if (error) {
brelse(*bhp); *bhp = bh = gfs2_getbuf(gl, blkno, CREATE);
return error;
} lock_buffer(bh);
} if (buffer_uptodate(bh)) {
unlock_buffer(bh);
return 0;
}
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
submit_bh(READ_SYNC | (1 << BIO_RW_META), bh);
if (!(flags & DIO_WAIT))
return 0;
wait_on_buffer(bh);
if (unlikely(!buffer_uptodate(bh))) {
struct gfs2_trans *tr = current->journal_info;
if (tr && tr->tr_touched)
gfs2_io_error_bh(sdp, bh);
brelse(bh);
return -EIO;
} }
return 0; return 0;
...@@ -404,7 +420,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) ...@@ -404,7 +420,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
if (buffer_uptodate(first_bh)) if (buffer_uptodate(first_bh))
goto out; goto out;
if (!buffer_locked(first_bh)) if (!buffer_locked(first_bh))
ll_rw_block(READ_META, 1, &first_bh); ll_rw_block(READ_SYNC | (1 << BIO_RW_META), 1, &first_bh);
dblock++; dblock++;
extlen--; extlen--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment