]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/omfs/file.c
Merge remote branch 'alsa/devel' into topic/misc
[mirror_ubuntu-artful-kernel.git] / fs / omfs / file.c
index 78c9f0c1a2f3d6c9e2b01fe3839f3f40d12b0b09..8a6d34fa668a0715e349000f0706b7d6526bfe61 100644 (file)
@@ -50,7 +50,7 @@ int omfs_shrink_inode(struct inode *inode)
        if (inode->i_size != 0)
                goto out;
 
-       bh = sb_bread(inode->i_sb, clus_to_blk(sbi, next));
+       bh = omfs_bread(inode->i_sb, next);
        if (!bh)
                goto out;
 
@@ -90,7 +90,7 @@ int omfs_shrink_inode(struct inode *inode)
                if (next == ~0)
                        break;
 
-               bh = sb_bread(inode->i_sb, clus_to_blk(sbi, next));
+               bh = omfs_bread(inode->i_sb, next);
                if (!bh)
                        goto out;
                oe = (struct omfs_extent *) (&bh->b_data[OMFS_EXTENT_CONT]);
@@ -222,7 +222,7 @@ static int omfs_get_block(struct inode *inode, sector_t block,
        struct buffer_head *bh;
        sector_t next, offset;
        int ret;
-       u64 new_block;
+       u64 uninitialized_var(new_block);
        u32 max_extents;
        int extent_count;
        struct omfs_extent *oe;
@@ -232,7 +232,7 @@ static int omfs_get_block(struct inode *inode, sector_t block,
        int remain;
 
        ret = -EIO;
-       bh = sb_bread(inode->i_sb, clus_to_blk(sbi, inode->i_ino));
+       bh = omfs_bread(inode->i_sb, inode->i_ino);
        if (!bh)
                goto out;
 
@@ -265,7 +265,7 @@ static int omfs_get_block(struct inode *inode, sector_t block,
                        break;
 
                brelse(bh);
-               bh = sb_bread(inode->i_sb, clus_to_blk(sbi, next));
+               bh = omfs_bread(inode->i_sb, next);
                if (!bh)
                        goto out;
                oe = (struct omfs_extent *) (&bh->b_data[OMFS_EXTENT_CONT]);
@@ -349,7 +349,17 @@ static int omfs_setattr(struct dentry *dentry, struct iattr *attr)
        error = inode_change_ok(inode, attr);
        if (error)
                return error;
-       return inode_setattr(inode, attr);
+
+       if ((attr->ia_valid & ATTR_SIZE) &&
+           attr->ia_size != i_size_read(inode)) {
+               error = vmtruncate(inode, attr->ia_size);
+               if (error)
+                       return error;
+       }
+
+       setattr_copy(inode, attr);
+       mark_inode_dirty(inode);
+       return 0;
 }
 
 const struct inode_operations omfs_file_inops = {