]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/ocfs2/xattr.c
ocfs2: ocfs2_claim_*() don't need an ocfs2_super argument.
[karo-tx-linux.git] / fs / ocfs2 / xattr.c
index d1b0d386f6d1c43c58b8e0016530f7830ea6eddf..2f6fd48c0ba4d54e56af2de1d234498f18753710 100644 (file)
@@ -739,11 +739,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
                goto leave;
        }
 
-       status = ocfs2_journal_dirty(handle, vb->vb_bh);
-       if (status < 0) {
-               mlog_errno(status);
-               goto leave;
-       }
+       ocfs2_journal_dirty(handle, vb->vb_bh);
 
        clusters_to_add -= le32_to_cpu(vb->vb_xv->xr_clusters) - prev_clusters;
 
@@ -786,12 +782,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
        }
 
        le32_add_cpu(&vb->vb_xv->xr_clusters, -len);
-
-       ret = ocfs2_journal_dirty(handle, vb->vb_bh);
-       if (ret) {
-               mlog_errno(ret);
-               goto out;
-       }
+       ocfs2_journal_dirty(handle, vb->vb_bh);
 
        if (ext_flags & OCFS2_EXT_REFCOUNTED)
                ret = ocfs2_decrease_refcount(inode, handle,
@@ -1374,11 +1365,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
                                memset(bh->b_data + cp_len, 0,
                                       blocksize - cp_len);
 
-                       ret = ocfs2_journal_dirty(handle, bh);
-                       if (ret < 0) {
-                               mlog_errno(ret);
-                               goto out;
-                       }
+                       ocfs2_journal_dirty(handle, bh);
                        brelse(bh);
                        bh = NULL;
 
@@ -1622,7 +1609,7 @@ static void ocfs2_xa_block_wipe_namevalue(struct ocfs2_xa_loc *loc)
        /* Now tell xh->xh_entries about it */
        for (i = 0; i < count; i++) {
                offset = le16_to_cpu(xh->xh_entries[i].xe_name_offset);
-               if (offset < namevalue_offset)
+               if (offset <= namevalue_offset)
                        le16_add_cpu(&xh->xh_entries[i].xe_name_offset,
                                     namevalue_size);
        }
@@ -2594,9 +2581,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
        di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features);
        spin_unlock(&oi->ip_lock);
 
-       ret = ocfs2_journal_dirty(handle, di_bh);
-       if (ret < 0)
-               mlog_errno(ret);
+       ocfs2_journal_dirty(handle, di_bh);
 out_commit:
        ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
 out:
@@ -2724,9 +2709,7 @@ static int ocfs2_xattr_ibody_init(struct inode *inode,
        di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features);
        spin_unlock(&oi->ip_lock);
 
-       ret = ocfs2_journal_dirty(ctxt->handle, di_bh);
-       if (ret < 0)
-               mlog_errno(ret);
+       ocfs2_journal_dirty(ctxt->handle, di_bh);
 
 out:
        return ret;
@@ -2848,7 +2831,6 @@ static int ocfs2_create_xattr_block(struct inode *inode,
        u32 num_got;
        u64 first_blkno;
        struct ocfs2_dinode *di =  (struct ocfs2_dinode *)inode_bh->b_data;
-       struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        struct buffer_head *new_bh = NULL;
        struct ocfs2_xattr_block *xblk;
 
@@ -2859,7 +2841,7 @@ static int ocfs2_create_xattr_block(struct inode *inode,
                goto end;
        }
 
-       ret = ocfs2_claim_metadata(osb, ctxt->handle, ctxt->meta_ac, 1,
+       ret = ocfs2_claim_metadata(ctxt->handle, ctxt->meta_ac, 1,
                                   &suballoc_bit_start, &num_got,
                                   &first_blkno);
        if (ret < 0) {
@@ -2884,7 +2866,8 @@ static int ocfs2_create_xattr_block(struct inode *inode,
        strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE);
        xblk->xb_suballoc_slot = cpu_to_le16(ctxt->meta_ac->ac_alloc_slot);
        xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start);
-       xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation);
+       xblk->xb_fs_generation =
+               cpu_to_le32(OCFS2_SB(inode->i_sb)->fs_generation);
        xblk->xb_blkno = cpu_to_le64(first_blkno);
        if (indexed) {
                struct ocfs2_xattr_tree_root *xr = &xblk->xb_attrs.xb_root;
@@ -3312,8 +3295,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
                                goto out;
                        }
 
-                       ret = ocfs2_extend_trans(ctxt->handle, credits +
-                                       ctxt->handle->h_buffer_credits);
+                       ret = ocfs2_extend_trans(ctxt->handle, credits);
                        if (ret) {
                                mlog_errno(ret);
                                goto out;
@@ -3343,8 +3325,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
                                        goto out;
                                }
 
-                               ret = ocfs2_extend_trans(ctxt->handle, credits +
-                                       ctxt->handle->h_buffer_credits);
+                               ret = ocfs2_extend_trans(ctxt->handle, credits);
                                if (ret) {
                                        mlog_errno(ret);
                                        goto out;
@@ -3378,8 +3359,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
                                        goto out;
                                }
 
-                               ret = ocfs2_extend_trans(ctxt->handle, credits +
-                                               ctxt->handle->h_buffer_credits);
+                               ret = ocfs2_extend_trans(ctxt->handle, credits);
                                if (ret) {
                                        mlog_errno(ret);
                                        goto out;
@@ -4249,7 +4229,6 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
        u32 bit_off, len;
        u64 blkno;
        handle_t *handle = ctxt->handle;
-       struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
        struct buffer_head *xb_bh = xs->xattr_bh;
        struct ocfs2_xattr_block *xb =
@@ -4277,7 +4256,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
                goto out;
        }
 
-       ret = __ocfs2_claim_clusters(osb, handle, ctxt->data_ac,
+       ret = __ocfs2_claim_clusters(handle, ctxt->data_ac,
                                     1, 1, &bit_off, &len);
        if (ret) {
                mlog_errno(ret);
@@ -4887,8 +4866,7 @@ static int ocfs2_mv_xattr_buckets(struct inode *inode, handle_t *handle,
         * We need to update the first bucket of the old extent and all
         * the buckets going to the new extent.
         */
-       credits = ((num_buckets + 1) * blks_per_bucket) +
-               handle->h_buffer_credits;
+       credits = ((num_buckets + 1) * blks_per_bucket);
        ret = ocfs2_extend_trans(handle, credits);
        if (ret) {
                mlog_errno(ret);
@@ -4958,7 +4936,7 @@ static int ocfs2_divide_xattr_cluster(struct inode *inode,
                                      u32 *first_hash)
 {
        u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
-       int ret, credits = 2 * blk_per_bucket + handle->h_buffer_credits;
+       int ret, credits = 2 * blk_per_bucket;
 
        BUG_ON(OCFS2_XATTR_BUCKET_SIZE < OCFS2_SB(inode->i_sb)->s_clustersize);
 
@@ -5099,7 +5077,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
                goto leave;
        }
 
-       ret = __ocfs2_claim_clusters(osb, handle, ctxt->data_ac, 1,
+       ret = __ocfs2_claim_clusters(handle, ctxt->data_ac, 1,
                                     clusters_to_add, &bit_off, &num_bits);
        if (ret < 0) {
                if (ret != -ENOSPC)
@@ -5153,9 +5131,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
                goto leave;
        }
 
-       ret = ocfs2_journal_dirty(handle, root_bh);
-       if (ret < 0)
-               mlog_errno(ret);
+       ocfs2_journal_dirty(handle, root_bh);
 
 leave:
        return ret;
@@ -5200,8 +5176,7 @@ static int ocfs2_extend_xattr_bucket(struct inode *inode,
         * existing bucket.  Then we add the last existing bucket, the
         * new bucket, and the first bucket (3 * blk_per_bucket).
         */
-       credits = (end_blk - target_blk) + (3 * blk_per_bucket) +
-                 handle->h_buffer_credits;
+       credits = (end_blk - target_blk) + (3 * blk_per_bucket);
        ret = ocfs2_extend_trans(handle, credits);
        if (ret) {
                mlog_errno(ret);
@@ -5477,12 +5452,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
        }
 
        le32_add_cpu(&xb->xb_attrs.xb_root.xt_clusters, -len);
-
-       ret = ocfs2_journal_dirty(handle, root_bh);
-       if (ret) {
-               mlog_errno(ret);
-               goto out_commit;
-       }
+       ocfs2_journal_dirty(handle, root_bh);
 
        ret = ocfs2_truncate_log_append(osb, handle, blkno, len);
        if (ret)
@@ -6528,13 +6498,11 @@ static int ocfs2_create_empty_xattr_block(struct inode *inode,
                                          int indexed)
 {
        int ret;
-       struct ocfs2_alloc_context *meta_ac;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-       struct ocfs2_xattr_set_ctxt ctxt = {
-               .meta_ac = meta_ac,
-       };
+       struct ocfs2_xattr_set_ctxt ctxt;
 
-       ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac);
+       memset(&ctxt, 0, sizeof(ctxt));
+       ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &ctxt.meta_ac);
        if (ret < 0) {
                mlog_errno(ret);
                return ret;
@@ -6556,7 +6524,7 @@ static int ocfs2_create_empty_xattr_block(struct inode *inode,
 
        ocfs2_commit_trans(osb, ctxt.handle);
 out:
-       ocfs2_free_alloc_context(meta_ac);
+       ocfs2_free_alloc_context(ctxt.meta_ac);
        return ret;
 }
 
@@ -6937,7 +6905,7 @@ static int ocfs2_reflink_xattr_rec(struct inode *inode,
                goto out;
        }
 
-       ret = ocfs2_claim_clusters(osb, handle, data_ac,
+       ret = ocfs2_claim_clusters(handle, data_ac,
                                   len, &p_cluster, &num_clusters);
        if (ret) {
                mlog_errno(ret);