diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-28 18:26:15 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-28 18:26:15 -0500 |
commit | 3c674e74238cb2484169e3f84f687c66887086b6 (patch) | |
tree | 07964918e0948a42bf787b37fc970c4b137fce53 /fs/direct-io.c | |
parent | e0edd5962bd83d319aaa50b39580dc30299a7fe3 (diff) |
Fixes a regression from the recent "remove ->get_blocks() support"
change. inode->i_blkbits should be used when making a get_block_t
request of a filesystem instead of dio->blkbits, as that does not
indicate the filesystem block size all the time (depends on request
alignment - see start of __blockdev_direct_IO).
Signed-off-by: Nathan Scott <nathans@sgi.com>
Acked-by: Badari Pulavarty <pbadari@us.ibm.com>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r-- | fs/direct-io.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 9d1d2aa73e42..910a8ed74b5d 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -524,8 +524,6 @@ static int get_more_blocks(struct dio *dio) | |||
524 | */ | 524 | */ |
525 | ret = dio->page_errors; | 525 | ret = dio->page_errors; |
526 | if (ret == 0) { | 526 | if (ret == 0) { |
527 | map_bh->b_state = 0; | ||
528 | map_bh->b_size = 0; | ||
529 | BUG_ON(dio->block_in_file >= dio->final_block_in_request); | 527 | BUG_ON(dio->block_in_file >= dio->final_block_in_request); |
530 | fs_startblk = dio->block_in_file >> dio->blkfactor; | 528 | fs_startblk = dio->block_in_file >> dio->blkfactor; |
531 | dio_count = dio->final_block_in_request - dio->block_in_file; | 529 | dio_count = dio->final_block_in_request - dio->block_in_file; |
@@ -534,6 +532,9 @@ static int get_more_blocks(struct dio *dio) | |||
534 | if (dio_count & blkmask) | 532 | if (dio_count & blkmask) |
535 | fs_count++; | 533 | fs_count++; |
536 | 534 | ||
535 | map_bh->b_state = 0; | ||
536 | map_bh->b_size = fs_count << dio->inode->i_blkbits; | ||
537 | |||
537 | create = dio->rw == WRITE; | 538 | create = dio->rw == WRITE; |
538 | if (dio->lock_type == DIO_LOCKING) { | 539 | if (dio->lock_type == DIO_LOCKING) { |
539 | if (dio->block_in_file < (i_size_read(dio->inode) >> | 540 | if (dio->block_in_file < (i_size_read(dio->inode) >> |
@@ -542,13 +543,13 @@ static int get_more_blocks(struct dio *dio) | |||
542 | } else if (dio->lock_type == DIO_NO_LOCKING) { | 543 | } else if (dio->lock_type == DIO_NO_LOCKING) { |
543 | create = 0; | 544 | create = 0; |
544 | } | 545 | } |
546 | |||
545 | /* | 547 | /* |
546 | * For writes inside i_size we forbid block creations: only | 548 | * For writes inside i_size we forbid block creations: only |
547 | * overwrites are permitted. We fall back to buffered writes | 549 | * overwrites are permitted. We fall back to buffered writes |
548 | * at a higher level for inside-i_size block-instantiating | 550 | * at a higher level for inside-i_size block-instantiating |
549 | * writes. | 551 | * writes. |
550 | */ | 552 | */ |
551 | map_bh->b_size = fs_count << dio->blkbits; | ||
552 | ret = (*dio->get_block)(dio->inode, fs_startblk, | 553 | ret = (*dio->get_block)(dio->inode, fs_startblk, |
553 | map_bh, create); | 554 | map_bh, create); |
554 | } | 555 | } |