]> err.no Git - linux-2.6/commitdiff
Fixes a regression from the recent "remove ->get_blocks() support"
authorNathan Scott <nathans@sgi.com>
Tue, 28 Mar 2006 23:26:15 +0000 (09:26 +1000)
committerNathan Scott <nathans@sgi.com>
Tue, 28 Mar 2006 23:26:15 +0000 (09:26 +1000)
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>
fs/direct-io.c

index 9d1d2aa73e420e17445efa7ace0f6d35155527b8..910a8ed74b5d24f9168533c1f163916792df6eb4 100644 (file)
@@ -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);
        }