]> git.karo-electronics.de Git - linux-beck.git/blobdiff - fs/ocfs2/file.c
Merge branch 'linus' into test
[linux-beck.git] / fs / ocfs2 / file.c
index ca3d38addbb9b0d564ad3ac1220a4051d5ee1257..8d3225a78073f86c682ed21e9b3098a1fef6b843 100644 (file)
@@ -185,7 +185,7 @@ static int ocfs2_sync_file(struct file *file,
                goto bail;
 
        journal = osb->journal->j_journal;
-       err = journal_force_commit(journal);
+       err = jbd2_journal_force_commit(journal);
 
 bail:
        mlog_exit(err);
@@ -512,12 +512,11 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
        int ret;
        struct ocfs2_extent_tree et;
 
-       ocfs2_get_dinode_extent_tree(&et, inode, fe_bh);
+       ocfs2_init_dinode_extent_tree(&et, inode, fe_bh);
        ret = ocfs2_add_clusters_in_btree(osb, inode, logical_offset,
                                           clusters_to_add, mark_unwritten,
                                           &et, handle,
                                           data_ac, meta_ac, reason_ret);
-       ocfs2_put_extent_tree(&et);
 
        return ret;
 }
@@ -546,8 +545,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
         */
        BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb));
 
-       status = ocfs2_read_block(osb, OCFS2_I(inode)->ip_blkno, &bh,
-                                 OCFS2_BH_CACHED, inode);
+       status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh);
        if (status < 0) {
                mlog_errno(status);
                goto leave;
@@ -568,10 +566,9 @@ restart_all:
             (unsigned long long)OCFS2_I(inode)->ip_blkno,
             (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters),
             clusters_to_add);
-       ocfs2_get_dinode_extent_tree(&et, inode, bh);
+       ocfs2_init_dinode_extent_tree(&et, inode, bh);
        status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0,
                                       &data_ac, &meta_ac);
-       ocfs2_put_extent_tree(&et);
        if (status) {
                mlog_errno(status);
                goto leave;
@@ -673,10 +670,8 @@ leave:
                restart_func = 0;
                goto restart_all;
        }
-       if (bh) {
-               brelse(bh);
-               bh = NULL;
-       }
+       brelse(bh);
+       bh = NULL;
 
        mlog_exit(status);
        return status;
@@ -943,9 +938,15 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
                        goto bail_unlock;
                }
 
-               if (i_size_read(inode) > attr->ia_size)
+               if (i_size_read(inode) > attr->ia_size) {
+                       if (ocfs2_should_order_data(inode)) {
+                               status = ocfs2_begin_ordered_truncate(inode,
+                                                                     attr->ia_size);
+                               if (status)
+                                       goto bail_unlock;
+                       }
                        status = ocfs2_truncate_file(inode, bh, attr->ia_size);
-               else
+               else
                        status = ocfs2_extend_file(inode, bh, attr->ia_size);
                if (status < 0) {
                        if (status != -ENOSPC)
@@ -987,8 +988,7 @@ bail_unlock_rw:
        if (size_change)
                ocfs2_rw_unlock(inode, 1);
 bail:
-       if (bh)
-               brelse(bh);
+       brelse(bh);
 
        mlog_exit(status);
        return status;
@@ -1131,8 +1131,7 @@ static int ocfs2_write_remove_suid(struct inode *inode)
        struct buffer_head *bh = NULL;
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
 
-       ret = ocfs2_read_block(OCFS2_SB(inode->i_sb),
-                              oi->ip_blkno, &bh, OCFS2_BH_CACHED, inode);
+       ret = ocfs2_read_block(inode, oi->ip_blkno, &bh);
        if (ret < 0) {
                mlog_errno(ret);
                goto out;
@@ -1158,9 +1157,8 @@ static int ocfs2_allocate_unwritten_extents(struct inode *inode,
        struct buffer_head *di_bh = NULL;
 
        if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
-               ret = ocfs2_read_block(OCFS2_SB(inode->i_sb),
-                                      OCFS2_I(inode)->ip_blkno, &di_bh,
-                                      OCFS2_BH_CACHED, inode);
+               ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno,
+                                      &di_bh);
                if (ret) {
                        mlog_errno(ret);
                        goto out;
@@ -1243,11 +1241,10 @@ static int __ocfs2_remove_inode_range(struct inode *inode,
        struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
        struct ocfs2_extent_tree et;
 
-       ocfs2_get_dinode_extent_tree(&et, inode, di_bh);
+       ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
 
        ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac);
        if (ret) {
-               ocfs2_put_extent_tree(&et);
                mlog_errno(ret);
                return ret;
        }
@@ -1304,7 +1301,6 @@ out:
        if (meta_ac)
                ocfs2_free_alloc_context(meta_ac);
 
-       ocfs2_put_extent_tree(&et);
        return ret;
 }
 
@@ -1892,7 +1888,7 @@ out_dio:
                 */
                if (old_size != i_size_read(inode) ||
                    old_clusters != OCFS2_I(inode)->ip_clusters) {
-                       ret = journal_force_commit(osb->journal->j_journal);
+                       ret = jbd2_journal_force_commit(osb->journal->j_journal);
                        if (ret < 0)
                                written = ret;
                }