diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-04-07 09:13:01 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-05-11 07:36:41 -0400 |
commit | c969f58ca43fc403c75f5d3da4cf1e21de7afaa0 (patch) | |
tree | d38b579882f89c222937530c527224e2a77548b0 /fs/gfs2 | |
parent | a4d7749be5de4a7261bcbe3c7d96c748792ec455 (diff) |
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: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/log.c | 6 | ||||
-rw-r--r-- | fs/gfs2/lops.c | 14 | ||||
-rw-r--r-- | fs/gfs2/meta_io.c | 38 |
3 files changed, 38 insertions, 20 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 98918a756410..aa62cf5976e8 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -120,7 +120,7 @@ __acquires(&sdp->sd_log_lock) | |||
120 | lock_buffer(bh); | 120 | lock_buffer(bh); |
121 | if (test_clear_buffer_dirty(bh)) { | 121 | if (test_clear_buffer_dirty(bh)) { |
122 | bh->b_end_io = end_buffer_write_sync; | 122 | bh->b_end_io = end_buffer_write_sync; |
123 | submit_bh(WRITE, bh); | 123 | submit_bh(WRITE_SYNC_PLUG, bh); |
124 | } else { | 124 | } else { |
125 | unlock_buffer(bh); | 125 | unlock_buffer(bh); |
126 | brelse(bh); | 126 | brelse(bh); |
@@ -604,7 +604,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) | |||
604 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) | 604 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) |
605 | goto skip_barrier; | 605 | goto skip_barrier; |
606 | get_bh(bh); | 606 | get_bh(bh); |
607 | submit_bh(WRITE_BARRIER | (1 << BIO_RW_META), bh); | 607 | submit_bh(WRITE_SYNC | (1 << BIO_RW_BARRIER) | (1 << BIO_RW_META), bh); |
608 | wait_on_buffer(bh); | 608 | wait_on_buffer(bh); |
609 | if (buffer_eopnotsupp(bh)) { | 609 | if (buffer_eopnotsupp(bh)) { |
610 | clear_buffer_eopnotsupp(bh); | 610 | clear_buffer_eopnotsupp(bh); |
@@ -664,7 +664,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp) | |||
664 | lock_buffer(bh); | 664 | lock_buffer(bh); |
665 | if (buffer_mapped(bh) && test_clear_buffer_dirty(bh)) { | 665 | if (buffer_mapped(bh) && test_clear_buffer_dirty(bh)) { |
666 | bh->b_end_io = end_buffer_write_sync; | 666 | bh->b_end_io = end_buffer_write_sync; |
667 | submit_bh(WRITE, bh); | 667 | submit_bh(WRITE_SYNC_PLUG, bh); |
668 | } else { | 668 | } else { |
669 | unlock_buffer(bh); | 669 | unlock_buffer(bh); |
670 | brelse(bh); | 670 | brelse(bh); |
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 80e4f5f898bb..00315f50fa46 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/gfs2_ondisk.h> | 15 | #include <linux/gfs2_ondisk.h> |
16 | #include <linux/bio.h> | ||
17 | #include <linux/fs.h> | ||
16 | 18 | ||
17 | #include "gfs2.h" | 19 | #include "gfs2.h" |
18 | #include "incore.h" | 20 | #include "incore.h" |
@@ -189,7 +191,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) | |||
189 | } | 191 | } |
190 | 192 | ||
191 | gfs2_log_unlock(sdp); | 193 | gfs2_log_unlock(sdp); |
192 | submit_bh(WRITE, bh); | 194 | submit_bh(WRITE_SYNC_PLUG, bh); |
193 | gfs2_log_lock(sdp); | 195 | gfs2_log_lock(sdp); |
194 | 196 | ||
195 | n = 0; | 197 | n = 0; |
@@ -199,7 +201,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) | |||
199 | gfs2_log_unlock(sdp); | 201 | gfs2_log_unlock(sdp); |
200 | lock_buffer(bd2->bd_bh); | 202 | lock_buffer(bd2->bd_bh); |
201 | bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); | 203 | bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); |
202 | submit_bh(WRITE, bh); | 204 | submit_bh(WRITE_SYNC_PLUG, bh); |
203 | gfs2_log_lock(sdp); | 205 | gfs2_log_lock(sdp); |
204 | if (++n >= num) | 206 | if (++n >= num) |
205 | break; | 207 | break; |
@@ -341,7 +343,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) | |||
341 | sdp->sd_log_num_revoke--; | 343 | sdp->sd_log_num_revoke--; |
342 | 344 | ||
343 | if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) { | 345 | if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) { |
344 | submit_bh(WRITE, bh); | 346 | submit_bh(WRITE_SYNC_PLUG, bh); |
345 | 347 | ||
346 | bh = gfs2_log_get_buf(sdp); | 348 | bh = gfs2_log_get_buf(sdp); |
347 | mh = (struct gfs2_meta_header *)bh->b_data; | 349 | mh = (struct gfs2_meta_header *)bh->b_data; |
@@ -358,7 +360,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) | |||
358 | } | 360 | } |
359 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); | 361 | gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); |
360 | 362 | ||
361 | submit_bh(WRITE, bh); | 363 | submit_bh(WRITE_SYNC_PLUG, bh); |
362 | } | 364 | } |
363 | 365 | ||
364 | static void revoke_lo_before_scan(struct gfs2_jdesc *jd, | 366 | 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 | ptr = bh_log_ptr(bh); | 562 | ptr = bh_log_ptr(bh); |
561 | 563 | ||
562 | get_bh(bh); | 564 | get_bh(bh); |
563 | submit_bh(WRITE, bh); | 565 | submit_bh(WRITE_SYNC_PLUG, bh); |
564 | gfs2_log_lock(sdp); | 566 | gfs2_log_lock(sdp); |
565 | while(!list_empty(list)) { | 567 | while(!list_empty(list)) { |
566 | bd = list_entry(list->next, struct gfs2_bufdata, bd_le.le_list); | 568 | 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 | } else { | 588 | } else { |
587 | bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh); | 589 | bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh); |
588 | } | 590 | } |
589 | submit_bh(WRITE, bh1); | 591 | submit_bh(WRITE_SYNC_PLUG, bh1); |
590 | gfs2_log_lock(sdp); | 592 | gfs2_log_lock(sdp); |
591 | ptr += 2; | 593 | ptr += 2; |
592 | } | 594 | } |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 8d6f13256b26..75b2aec06f85 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -201,16 +201,32 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) | |||
201 | int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, | 201 | int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, |
202 | struct buffer_head **bhp) | 202 | struct buffer_head **bhp) |
203 | { | 203 | { |
204 | *bhp = gfs2_getbuf(gl, blkno, CREATE); | 204 | struct gfs2_sbd *sdp = gl->gl_sbd; |
205 | if (!buffer_uptodate(*bhp)) { | 205 | struct buffer_head *bh; |
206 | ll_rw_block(READ_META, 1, bhp); | 206 | |
207 | if (flags & DIO_WAIT) { | 207 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
208 | int error = gfs2_meta_wait(gl->gl_sbd, *bhp); | 208 | return -EIO; |
209 | if (error) { | 209 | |
210 | brelse(*bhp); | 210 | *bhp = bh = gfs2_getbuf(gl, blkno, CREATE); |
211 | return error; | 211 | |
212 | } | 212 | lock_buffer(bh); |
213 | } | 213 | if (buffer_uptodate(bh)) { |
214 | unlock_buffer(bh); | ||
215 | return 0; | ||
216 | } | ||
217 | bh->b_end_io = end_buffer_read_sync; | ||
218 | get_bh(bh); | ||
219 | submit_bh(READ_SYNC | (1 << BIO_RW_META), bh); | ||
220 | if (!(flags & DIO_WAIT)) | ||
221 | return 0; | ||
222 | |||
223 | wait_on_buffer(bh); | ||
224 | if (unlikely(!buffer_uptodate(bh))) { | ||
225 | struct gfs2_trans *tr = current->journal_info; | ||
226 | if (tr && tr->tr_touched) | ||
227 | gfs2_io_error_bh(sdp, bh); | ||
228 | brelse(bh); | ||
229 | return -EIO; | ||
214 | } | 230 | } |
215 | 231 | ||
216 | return 0; | 232 | return 0; |
@@ -404,7 +420,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
404 | if (buffer_uptodate(first_bh)) | 420 | if (buffer_uptodate(first_bh)) |
405 | goto out; | 421 | goto out; |
406 | if (!buffer_locked(first_bh)) | 422 | if (!buffer_locked(first_bh)) |
407 | ll_rw_block(READ_META, 1, &first_bh); | 423 | ll_rw_block(READ_SYNC | (1 << BIO_RW_META), 1, &first_bh); |
408 | 424 | ||
409 | dblock++; | 425 | dblock++; |
410 | extlen--; | 426 | extlen--; |