diff options
Diffstat (limited to 'fs/gfs2/lops.c')
-rw-r--r-- | fs/gfs2/lops.c | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 3d792f81e48c..4bd89c0781e7 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -137,7 +137,8 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) | |||
137 | memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved)); | 137 | memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved)); |
138 | 138 | ||
139 | n = 0; | 139 | n = 0; |
140 | list_for_each_entry_continue(bd1, &sdp->sd_log_le_buf, bd_le.le_list) { | 140 | list_for_each_entry_continue(bd1, &sdp->sd_log_le_buf, |
141 | bd_le.le_list) { | ||
141 | *ptr++ = cpu_to_be64(bd1->bd_bh->b_blocknr); | 142 | *ptr++ = cpu_to_be64(bd1->bd_bh->b_blocknr); |
142 | if (++n >= num) | 143 | if (++n >= num) |
143 | break; | 144 | break; |
@@ -147,7 +148,8 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) | |||
147 | ll_rw_block(WRITE, 1, &bh); | 148 | ll_rw_block(WRITE, 1, &bh); |
148 | 149 | ||
149 | n = 0; | 150 | n = 0; |
150 | list_for_each_entry_continue(bd2, &sdp->sd_log_le_buf, bd_le.le_list) { | 151 | list_for_each_entry_continue(bd2, &sdp->sd_log_le_buf, |
152 | bd_le.le_list) { | ||
151 | bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); | 153 | bh = gfs2_log_fake_buf(sdp, bd2->bd_bh); |
152 | set_buffer_dirty(bh); | 154 | set_buffer_dirty(bh); |
153 | ll_rw_block(WRITE, 1, &bh); | 155 | ll_rw_block(WRITE, 1, &bh); |
@@ -239,7 +241,8 @@ static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | |||
239 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 241 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; |
240 | 242 | ||
241 | if (error) { | 243 | if (error) { |
242 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT); | 244 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, |
245 | DIO_START | DIO_WAIT); | ||
243 | return; | 246 | return; |
244 | } | 247 | } |
245 | if (pass != 1) | 248 | if (pass != 1) |
@@ -283,7 +286,8 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) | |||
283 | ld->ld_header.mh_type = cpu_to_be16(GFS2_METATYPE_LD); | 286 | ld->ld_header.mh_type = cpu_to_be16(GFS2_METATYPE_LD); |
284 | ld->ld_header.mh_format = cpu_to_be16(GFS2_FORMAT_LD); | 287 | ld->ld_header.mh_format = cpu_to_be16(GFS2_FORMAT_LD); |
285 | ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_REVOKE); | 288 | ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_REVOKE); |
286 | ld->ld_length = cpu_to_be32(gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, sizeof(uint64_t))); | 289 | ld->ld_length = cpu_to_be32(gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, |
290 | sizeof(uint64_t))); | ||
287 | ld->ld_data1 = cpu_to_be32(sdp->sd_log_num_revoke); | 291 | ld->ld_data1 = cpu_to_be32(sdp->sd_log_num_revoke); |
288 | ld->ld_data2 = cpu_to_be32(0); | 292 | ld->ld_data2 = cpu_to_be32(0); |
289 | memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved)); | 293 | memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved)); |
@@ -515,19 +519,24 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
515 | * into the log along with a header | 519 | * into the log along with a header |
516 | */ | 520 | */ |
517 | gfs2_log_lock(sdp); | 521 | gfs2_log_lock(sdp); |
518 | bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf, bd_le.le_list); | 522 | bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf, |
523 | bd_le.le_list); | ||
519 | while(total_dbuf) { | 524 | while(total_dbuf) { |
520 | num = total_jdata; | 525 | num = total_jdata; |
521 | if (num > limit) | 526 | if (num > limit) |
522 | num = limit; | 527 | num = limit; |
523 | n = 0; | 528 | n = 0; |
524 | list_for_each_entry_safe_continue(bd1, bdt, &sdp->sd_log_le_databuf, bd_le.le_list) { | 529 | list_for_each_entry_safe_continue(bd1, bdt, |
530 | &sdp->sd_log_le_databuf, | ||
531 | bd_le.le_list) { | ||
525 | /* An ordered write buffer */ | 532 | /* An ordered write buffer */ |
526 | if (bd1->bd_bh && !buffer_pinned(bd1->bd_bh)) { | 533 | if (bd1->bd_bh && !buffer_pinned(bd1->bd_bh)) { |
527 | list_move(&bd1->bd_le.le_list, &started); | 534 | list_move(&bd1->bd_le.le_list, &started); |
528 | if (bd1 == bd2) { | 535 | if (bd1 == bd2) { |
529 | bd2 = NULL; | 536 | bd2 = NULL; |
530 | bd2 = list_prepare_entry(bd2, &sdp->sd_log_le_databuf, bd_le.le_list); | 537 | bd2 = list_prepare_entry(bd2, |
538 | &sdp->sd_log_le_databuf, | ||
539 | bd_le.le_list); | ||
531 | } | 540 | } |
532 | total_dbuf--; | 541 | total_dbuf--; |
533 | if (bd1->bd_bh) { | 542 | if (bd1->bd_bh) { |
@@ -535,7 +544,8 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
535 | if (buffer_dirty(bd1->bd_bh)) { | 544 | if (buffer_dirty(bd1->bd_bh)) { |
536 | gfs2_log_unlock(sdp); | 545 | gfs2_log_unlock(sdp); |
537 | wait_on_buffer(bd1->bd_bh); | 546 | wait_on_buffer(bd1->bd_bh); |
538 | ll_rw_block(WRITE, 1, &bd1->bd_bh); | 547 | ll_rw_block(WRITE, 1, |
548 | &bd1->bd_bh); | ||
539 | gfs2_log_lock(sdp); | 549 | gfs2_log_lock(sdp); |
540 | } | 550 | } |
541 | brelse(bd1->bd_bh); | 551 | brelse(bd1->bd_bh); |
@@ -547,12 +557,17 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
547 | gfs2_log_unlock(sdp); | 557 | gfs2_log_unlock(sdp); |
548 | if (!bh) { | 558 | if (!bh) { |
549 | bh = gfs2_log_get_buf(sdp); | 559 | bh = gfs2_log_get_buf(sdp); |
550 | ld = (struct gfs2_log_descriptor *)bh->b_data; | 560 | ld = (struct gfs2_log_descriptor *) |
561 | bh->b_data; | ||
551 | ptr = (__be64 *)(bh->b_data + offset); | 562 | ptr = (__be64 *)(bh->b_data + offset); |
552 | ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC); | 563 | ld->ld_header.mh_magic = |
553 | ld->ld_header.mh_type = cpu_to_be16(GFS2_METATYPE_LD); | 564 | cpu_to_be32(GFS2_MAGIC); |
554 | ld->ld_header.mh_format = cpu_to_be16(GFS2_FORMAT_LD); | 565 | ld->ld_header.mh_type = |
555 | ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_JDATA); | 566 | cpu_to_be16(GFS2_METATYPE_LD); |
567 | ld->ld_header.mh_format = | ||
568 | cpu_to_be16(GFS2_FORMAT_LD); | ||
569 | ld->ld_type = | ||
570 | cpu_to_be32(GFS2_LOG_DESC_JDATA); | ||
556 | ld->ld_length = cpu_to_be32(num + 1); | 571 | ld->ld_length = cpu_to_be32(num + 1); |
557 | ld->ld_data1 = cpu_to_be32(num); | 572 | ld->ld_data1 = cpu_to_be32(num); |
558 | ld->ld_data2 = cpu_to_be32(0); | 573 | ld->ld_data2 = cpu_to_be32(0); |
@@ -577,7 +592,8 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
577 | } | 592 | } |
578 | n = 0; | 593 | n = 0; |
579 | gfs2_log_lock(sdp); | 594 | gfs2_log_lock(sdp); |
580 | list_for_each_entry_continue(bd2, &sdp->sd_log_le_databuf, bd_le.le_list) { | 595 | list_for_each_entry_continue(bd2, &sdp->sd_log_le_databuf, |
596 | bd_le.le_list) { | ||
581 | if (!bd2->bd_bh) | 597 | if (!bd2->bd_bh) |
582 | continue; | 598 | continue; |
583 | /* copy buffer if it needs escaping */ | 599 | /* copy buffer if it needs escaping */ |
@@ -587,7 +603,9 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
587 | struct page *page = bd2->bd_bh->b_page; | 603 | struct page *page = bd2->bd_bh->b_page; |
588 | bh = gfs2_log_get_buf(sdp); | 604 | bh = gfs2_log_get_buf(sdp); |
589 | kaddr = kmap_atomic(page, KM_USER0); | 605 | kaddr = kmap_atomic(page, KM_USER0); |
590 | memcpy(bh->b_data, kaddr + bh_offset(bd2->bd_bh), sdp->sd_sb.sb_bsize); | 606 | memcpy(bh->b_data, |
607 | kaddr + bh_offset(bd2->bd_bh), | ||
608 | sdp->sd_sb.sb_bsize); | ||
591 | kunmap_atomic(page, KM_USER0); | 609 | kunmap_atomic(page, KM_USER0); |
592 | *(__be32 *)bh->b_data = 0; | 610 | *(__be32 *)bh->b_data = 0; |
593 | } else { | 611 | } else { |
@@ -608,7 +626,8 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
608 | /* Wait on all ordered buffers */ | 626 | /* Wait on all ordered buffers */ |
609 | while (!list_empty(&started)) { | 627 | while (!list_empty(&started)) { |
610 | gfs2_log_lock(sdp); | 628 | gfs2_log_lock(sdp); |
611 | bd1 = list_entry(started.next, struct gfs2_bufdata, bd_le.le_list); | 629 | bd1 = list_entry(started.next, struct gfs2_bufdata, |
630 | bd_le.le_list); | ||
612 | list_del(&bd1->bd_le.le_list); | 631 | list_del(&bd1->bd_le.le_list); |
613 | sdp->sd_log_num_databuf--; | 632 | sdp->sd_log_num_databuf--; |
614 | 633 | ||
@@ -685,7 +704,8 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | |||
685 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 704 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; |
686 | 705 | ||
687 | if (error) { | 706 | if (error) { |
688 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT); | 707 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, |
708 | DIO_START | DIO_WAIT); | ||
689 | return; | 709 | return; |
690 | } | 710 | } |
691 | if (pass != 1) | 711 | if (pass != 1) |