aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/jfs/jfs_metapage.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index f5cd8d38af7a..b27fa117f229 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -360,6 +360,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
360 struct metapage *mp; 360 struct metapage *mp;
361 int redirty = 0; 361 int redirty = 0;
362 sector_t lblock; 362 sector_t lblock;
363 int nr_underway = 0;
363 sector_t pblock; 364 sector_t pblock;
364 sector_t next_block = 0; 365 sector_t next_block = 0;
365 sector_t page_start; 366 sector_t page_start;
@@ -371,6 +372,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
371 (PAGE_CACHE_SHIFT - inode->i_blkbits); 372 (PAGE_CACHE_SHIFT - inode->i_blkbits);
372 BUG_ON(!PageLocked(page)); 373 BUG_ON(!PageLocked(page));
373 BUG_ON(PageWriteback(page)); 374 BUG_ON(PageWriteback(page));
375 set_page_writeback(page);
374 376
375 for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { 377 for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {
376 mp = page_to_mp(page, offset); 378 mp = page_to_mp(page, offset);
@@ -413,11 +415,10 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
413 if (!bio->bi_size) 415 if (!bio->bi_size)
414 goto dump_bio; 416 goto dump_bio;
415 submit_bio(WRITE, bio); 417 submit_bio(WRITE, bio);
418 nr_underway++;
416 bio = NULL; 419 bio = NULL;
417 } else { 420 } else
418 set_page_writeback(page);
419 inc_io(page); 421 inc_io(page);
420 }
421 xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits; 422 xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits;
422 pblock = metapage_get_blocks(inode, lblock, &xlen); 423 pblock = metapage_get_blocks(inode, lblock, &xlen);
423 if (!pblock) { 424 if (!pblock) {
@@ -449,12 +450,16 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
449 goto dump_bio; 450 goto dump_bio;
450 451
451 submit_bio(WRITE, bio); 452 submit_bio(WRITE, bio);
453 nr_underway++;
452 } 454 }
453 if (redirty) 455 if (redirty)
454 redirty_page_for_writepage(wbc, page); 456 redirty_page_for_writepage(wbc, page);
455 457
456 unlock_page(page); 458 unlock_page(page);
457 459
460 if (nr_underway == 0)
461 end_page_writeback(page);
462
458 return 0; 463 return 0;
459add_failed: 464add_failed:
460 /* We should never reach here, since we're only adding one vec */ 465 /* We should never reach here, since we're only adding one vec */