Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137616
b: refs/heads/master
c: 1ad53a9
h: refs/heads/master
v: v3
  • Loading branch information
Dave Kleikamp committed Jan 30, 2009
1 parent 13b62de commit 0e8b3cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b5c816a4f177604ae708892bba074b1d534fcbee
refs/heads/master: 1ad53a98c927a9b5b1b57288ac0edec562fbcf8d
18 changes: 13 additions & 5 deletions trunk/fs/jfs/jfs_metapage.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
unsigned long bio_bytes = 0;
unsigned long bio_offset = 0;
int offset;
int bad_blocks = 0;

page_start = (sector_t)page->index <<
(PAGE_CACHE_SHIFT - inode->i_blkbits);
Expand All @@ -394,6 +395,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
}

clear_bit(META_dirty, &mp->flag);
set_bit(META_io, &mp->flag);
block_offset = offset >> inode->i_blkbits;
lblock = page_start + block_offset;
if (bio) {
Expand All @@ -402,7 +404,6 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
len = min(xlen, blocks_per_mp);
xlen -= len;
bio_bytes += len << inode->i_blkbits;
set_bit(META_io, &mp->flag);
continue;
}
/* Not contiguous */
Expand All @@ -424,12 +425,14 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits;
pblock = metapage_get_blocks(inode, lblock, &xlen);
if (!pblock) {
/* Need better error handling */
printk(KERN_ERR "JFS: metapage_get_blocks failed\n");
dec_io(page, last_write_complete);
/*
* We already called inc_io(), but can't cancel it
* with dec_io() until we're done with the page
*/
bad_blocks++;
continue;
}
set_bit(META_io, &mp->flag);
len = min(xlen, (int)JFS_SBI(inode->i_sb)->nbperpage);

bio = bio_alloc(GFP_NOFS, 1);
Expand Down Expand Up @@ -459,6 +462,9 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)

unlock_page(page);

if (bad_blocks)
goto err_out;

if (nr_underway == 0)
end_page_writeback(page);

Expand All @@ -474,7 +480,9 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
bio_put(bio);
unlock_page(page);
dec_io(page, last_write_complete);

err_out:
while (bad_blocks--)
dec_io(page, last_write_complete);
return -EIO;
}

Expand Down

0 comments on commit 0e8b3cf

Please sign in to comment.