From 9ef0676805dd89fe8dabec57f0b20b935cbe8c0c Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 29 Mar 2006 09:26:15 +1000 Subject: [PATCH] --- yaml --- r: 24591 b: refs/heads/master c: 3c674e74238cb2484169e3f84f687c66887086b6 h: refs/heads/master i: 24589: 00cd98e940b66a7c9f0bb69e1567a7a4ac6f8854 24587: f85a531f293662885de26425753ba24b03ca28bd 24583: fafb528c0cacaa41ec7559e3b8b691c19667a0a6 24575: 9c716ca855cb7c4f56bde62a7b8bf5ba7306ece1 v: v3 --- [refs] | 2 +- trunk/fs/direct-io.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 11c8ceeb1cbd..9fdad849a93f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e0edd5962bd83d319aaa50b39580dc30299a7fe3 +refs/heads/master: 3c674e74238cb2484169e3f84f687c66887086b6 diff --git a/trunk/fs/direct-io.c b/trunk/fs/direct-io.c index 9d1d2aa73e42..910a8ed74b5d 100644 --- a/trunk/fs/direct-io.c +++ b/trunk/fs/direct-io.c @@ -524,8 +524,6 @@ static int get_more_blocks(struct dio *dio) */ ret = dio->page_errors; if (ret == 0) { - map_bh->b_state = 0; - map_bh->b_size = 0; BUG_ON(dio->block_in_file >= dio->final_block_in_request); fs_startblk = dio->block_in_file >> dio->blkfactor; dio_count = dio->final_block_in_request - dio->block_in_file; @@ -534,6 +532,9 @@ static int get_more_blocks(struct dio *dio) if (dio_count & blkmask) fs_count++; + map_bh->b_state = 0; + map_bh->b_size = fs_count << dio->inode->i_blkbits; + create = dio->rw == WRITE; if (dio->lock_type == DIO_LOCKING) { if (dio->block_in_file < (i_size_read(dio->inode) >> @@ -542,13 +543,13 @@ static int get_more_blocks(struct dio *dio) } else if (dio->lock_type == DIO_NO_LOCKING) { create = 0; } + /* * For writes inside i_size we forbid block creations: only * overwrites are permitted. We fall back to buffered writes * at a higher level for inside-i_size block-instantiating * writes. */ - map_bh->b_size = fs_count << dio->blkbits; ret = (*dio->get_block)(dio->inode, fs_startblk, map_bh, create); }