linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / ext2 / inode.c
index 2f0c404..3e00095 100644 (file)
@@ -668,6 +668,18 @@ static sector_t ext2_bmap(struct address_space *mapping, sector_t block)
        return generic_block_bmap(mapping,block,ext2_get_block);
 }
 
+static int
+ext2_get_blocks(struct inode *inode, sector_t iblock, unsigned long max_blocks,
+                       struct buffer_head *bh_result, int create)
+{
+       int ret;
+
+       ret = ext2_get_block(inode, iblock, bh_result, create);
+       if (ret == 0)
+               bh_result->b_size = (1 << inode->i_blkbits);
+       return ret;
+}
+
 static ssize_t
 ext2_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
                        loff_t offset, unsigned long nr_segs)
@@ -676,7 +688,7 @@ ext2_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
        struct inode *inode = file->f_mapping->host;
 
        return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                               offset, nr_segs, ext2_get_block, NULL);
+                               offset, nr_segs, ext2_get_blocks, NULL);
 }
 
 static int
@@ -685,7 +697,7 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
        return mpage_writepages(mapping, wbc, ext2_get_block);
 }
 
-const struct address_space_operations ext2_aops = {
+struct address_space_operations ext2_aops = {
        .readpage               = ext2_readpage,
        .readpages              = ext2_readpages,
        .writepage              = ext2_writepage,
@@ -698,12 +710,12 @@ const struct address_space_operations ext2_aops = {
        .migratepage            = buffer_migrate_page,
 };
 
-const struct address_space_operations ext2_aops_xip = {
+struct address_space_operations ext2_aops_xip = {
        .bmap                   = ext2_bmap,
        .get_xip_page           = ext2_get_xip_page,
 };
 
-const struct address_space_operations ext2_nobh_aops = {
+struct address_space_operations ext2_nobh_aops = {
        .readpage               = ext2_readpage,
        .readpages              = ext2_readpages,
        .writepage              = ext2_nobh_writepage,
@@ -1145,6 +1157,7 @@ void ext2_read_inode (struct inode * inode)
                brelse (bh);
                goto bad_inode;
        }
+       inode->i_blksize = PAGE_SIZE;   /* This is the optimal IO size (for stat), not the fs block size */
        inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
        ei->i_flags = le32_to_cpu(raw_inode->i_flags);
        ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);