linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / hfsplus / inode.c
index 0eb1a60..12ed2b7 100644 (file)
@@ -93,6 +93,17 @@ static int hfsplus_releasepage(struct page *page, gfp_t mask)
        return res ? try_to_free_buffers(page) : 0;
 }
 
+static int hfsplus_get_blocks(struct inode *inode, sector_t iblock, unsigned long max_blocks,
+                             struct buffer_head *bh_result, int create)
+{
+       int ret;
+
+       ret = hfsplus_get_block(inode, iblock, bh_result, create);
+       if (!ret)
+               bh_result->b_size = (1 << inode->i_blkbits);
+       return ret;
+}
+
 static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
                const struct iovec *iov, loff_t offset, unsigned long nr_segs)
 {
@@ -100,7 +111,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
        struct inode *inode = file->f_dentry->d_inode->i_mapping->host;
 
        return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                                 offset, nr_segs, hfsplus_get_block, NULL);
+                                 offset, nr_segs, hfsplus_get_blocks, NULL);
 }
 
 static int hfsplus_writepages(struct address_space *mapping,
@@ -109,7 +120,7 @@ static int hfsplus_writepages(struct address_space *mapping,
        return mpage_writepages(mapping, wbc, hfsplus_get_block);
 }
 
-const struct address_space_operations hfsplus_btree_aops = {
+struct address_space_operations hfsplus_btree_aops = {
        .readpage       = hfsplus_readpage,
        .writepage      = hfsplus_writepage,
        .sync_page      = block_sync_page,
@@ -119,7 +130,7 @@ const struct address_space_operations hfsplus_btree_aops = {
        .releasepage    = hfsplus_releasepage,
 };
 
-const struct address_space_operations hfsplus_aops = {
+struct address_space_operations hfsplus_aops = {
        .readpage       = hfsplus_readpage,
        .writepage      = hfsplus_writepage,
        .sync_page      = block_sync_page,
@@ -280,7 +291,7 @@ static struct inode_operations hfsplus_file_inode_operations = {
        .listxattr      = hfsplus_listxattr,
 };
 
-static const struct file_operations hfsplus_file_operations = {
+static struct file_operations hfsplus_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = generic_file_read,
        .write          = generic_file_write,
@@ -304,6 +315,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode)
        inode->i_gid = current->fsgid;
        inode->i_nlink = 1;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+       inode->i_blksize = HFSPLUS_SB(sb).alloc_blksz;
        INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list);
        init_MUTEX(&HFSPLUS_I(inode).extents_lock);
        atomic_set(&HFSPLUS_I(inode).opencnt, 0);
@@ -406,6 +418,7 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
        type = hfs_bnode_read_u16(fd->bnode, fd->entryoffset);
 
        HFSPLUS_I(inode).dev = 0;
+       inode->i_blksize = HFSPLUS_SB(inode->i_sb).alloc_blksz;
        if (type == HFSPLUS_FOLDER) {
                struct hfsplus_cat_folder *folder = &entry.folder;