aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/xattr.c')
-rw-r--r--fs/ocfs2/xattr.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 185fa3b7f962..016f01df3825 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -369,7 +369,7 @@ static void ocfs2_xattr_bucket_free(struct ocfs2_xattr_bucket *bucket)
369 * them fully. 369 * them fully.
370 */ 370 */
371static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket, 371static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
372 u64 xb_blkno) 372 u64 xb_blkno, int new)
373{ 373{
374 int i, rc = 0; 374 int i, rc = 0;
375 375
@@ -383,9 +383,16 @@ static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
383 } 383 }
384 384
385 if (!ocfs2_buffer_uptodate(INODE_CACHE(bucket->bu_inode), 385 if (!ocfs2_buffer_uptodate(INODE_CACHE(bucket->bu_inode),
386 bucket->bu_bhs[i])) 386 bucket->bu_bhs[i])) {
387 ocfs2_set_new_buffer_uptodate(INODE_CACHE(bucket->bu_inode), 387 if (new)
388 bucket->bu_bhs[i]); 388 ocfs2_set_new_buffer_uptodate(INODE_CACHE(bucket->bu_inode),
389 bucket->bu_bhs[i]);
390 else {
391 set_buffer_uptodate(bucket->bu_bhs[i]);
392 ocfs2_set_buffer_uptodate(INODE_CACHE(bucket->bu_inode),
393 bucket->bu_bhs[i]);
394 }
395 }
389 } 396 }
390 397
391 if (rc) 398 if (rc)
@@ -2602,6 +2609,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
2602 oi->ip_dyn_features &= ~(OCFS2_INLINE_XATTR_FL | OCFS2_HAS_XATTR_FL); 2609 oi->ip_dyn_features &= ~(OCFS2_INLINE_XATTR_FL | OCFS2_HAS_XATTR_FL);
2603 di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); 2610 di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features);
2604 spin_unlock(&oi->ip_lock); 2611 spin_unlock(&oi->ip_lock);
2612 ocfs2_update_inode_fsync_trans(handle, inode, 0);
2605 2613
2606 ocfs2_journal_dirty(handle, di_bh); 2614 ocfs2_journal_dirty(handle, di_bh);
2607out_commit: 2615out_commit:
@@ -3200,8 +3208,15 @@ meta_guess:
3200 clusters_add += 1; 3208 clusters_add += 1;
3201 } 3209 }
3202 } else { 3210 } else {
3203 meta_add += 1;
3204 credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS; 3211 credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;
3212 if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
3213 struct ocfs2_extent_list *el = &def_xv.xv.xr_list;
3214 meta_add += ocfs2_extend_meta_needed(el);
3215 credits += ocfs2_calc_extend_credits(inode->i_sb,
3216 el);
3217 } else {
3218 meta_add += 1;
3219 }
3205 } 3220 }
3206out: 3221out:
3207 if (clusters_need) 3222 if (clusters_need)
@@ -3614,6 +3629,7 @@ int ocfs2_xattr_set(struct inode *inode,
3614 } 3629 }
3615 3630
3616 ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt); 3631 ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt);
3632 ocfs2_update_inode_fsync_trans(ctxt.handle, inode, 0);
3617 3633
3618 ocfs2_commit_trans(osb, ctxt.handle); 3634 ocfs2_commit_trans(osb, ctxt.handle);
3619 3635
@@ -4294,7 +4310,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
4294 4310
4295 trace_ocfs2_xattr_create_index_block((unsigned long long)blkno); 4311 trace_ocfs2_xattr_create_index_block((unsigned long long)blkno);
4296 4312
4297 ret = ocfs2_init_xattr_bucket(xs->bucket, blkno); 4313 ret = ocfs2_init_xattr_bucket(xs->bucket, blkno, 1);
4298 if (ret) { 4314 if (ret) {
4299 mlog_errno(ret); 4315 mlog_errno(ret);
4300 goto out; 4316 goto out;
@@ -4638,7 +4654,7 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
4638 * Even if !new_bucket_head, we're overwriting t_bucket. Thus, 4654 * Even if !new_bucket_head, we're overwriting t_bucket. Thus,
4639 * there's no need to read it. 4655 * there's no need to read it.
4640 */ 4656 */
4641 ret = ocfs2_init_xattr_bucket(t_bucket, new_blk); 4657 ret = ocfs2_init_xattr_bucket(t_bucket, new_blk, new_bucket_head);
4642 if (ret) { 4658 if (ret) {
4643 mlog_errno(ret); 4659 mlog_errno(ret);
4644 goto out; 4660 goto out;
@@ -4804,7 +4820,7 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode,
4804 * Even if !t_is_new, we're overwriting t_bucket. Thus, 4820 * Even if !t_is_new, we're overwriting t_bucket. Thus,
4805 * there's no need to read it. 4821 * there's no need to read it.
4806 */ 4822 */
4807 ret = ocfs2_init_xattr_bucket(t_bucket, t_blkno); 4823 ret = ocfs2_init_xattr_bucket(t_bucket, t_blkno, t_is_new);
4808 if (ret) 4824 if (ret)
4809 goto out; 4825 goto out;
4810 4826
@@ -5476,6 +5492,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
5476 ret = ocfs2_truncate_log_append(osb, handle, blkno, len); 5492 ret = ocfs2_truncate_log_append(osb, handle, blkno, len);
5477 if (ret) 5493 if (ret)
5478 mlog_errno(ret); 5494 mlog_errno(ret);
5495 ocfs2_update_inode_fsync_trans(handle, inode, 0);
5479 5496
5480out_commit: 5497out_commit:
5481 ocfs2_commit_trans(osb, handle); 5498 ocfs2_commit_trans(osb, handle);
@@ -6830,7 +6847,7 @@ static int ocfs2_reflink_xattr_bucket(handle_t *handle,
6830 break; 6847 break;
6831 } 6848 }
6832 6849
6833 ret = ocfs2_init_xattr_bucket(args->new_bucket, new_blkno); 6850 ret = ocfs2_init_xattr_bucket(args->new_bucket, new_blkno, 1);
6834 if (ret) { 6851 if (ret) {
6835 mlog_errno(ret); 6852 mlog_errno(ret);
6836 break; 6853 break;