aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/xattr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 3e2e92d70594..73fb9f762512 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -2359,13 +2359,21 @@ meta_guess:
2359 } else 2359 } else
2360 xb = (struct ocfs2_xattr_block *)xbs->xattr_bh->b_data; 2360 xb = (struct ocfs2_xattr_block *)xbs->xattr_bh->b_data;
2361 2361
2362 /*
2363 * If there is already an xattr tree, good, we can calculate
2364 * like other b-trees. Otherwise we may have the chance of
2365 * create a tree, the credit calculation is borrowed from
2366 * ocfs2_calc_extend_credits with root_el = NULL. And the
2367 * new tree will be cluster based, so no meta is needed.
2368 */
2362 if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) { 2369 if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
2363 struct ocfs2_extent_list *el = 2370 struct ocfs2_extent_list *el =
2364 &xb->xb_attrs.xb_root.xt_list; 2371 &xb->xb_attrs.xb_root.xt_list;
2365 meta_add += ocfs2_extend_meta_needed(el); 2372 meta_add += ocfs2_extend_meta_needed(el);
2366 credits += ocfs2_calc_extend_credits(inode->i_sb, 2373 credits += ocfs2_calc_extend_credits(inode->i_sb,
2367 el, 1); 2374 el, 1);
2368 } 2375 } else
2376 credits += OCFS2_SUBALLOC_ALLOC + 1;
2369 2377
2370 /* 2378 /*
2371 * This cluster will be used either for new bucket or for 2379 * This cluster will be used either for new bucket or for