diff options
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index e45421fee204..ace27d1ca574 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -6577,20 +6577,29 @@ out: | |||
6577 | return ret; | 6577 | return ret; |
6578 | } | 6578 | } |
6579 | 6579 | ||
6580 | static void ocfs2_zero_dinode_id2(struct inode *inode, struct ocfs2_dinode *di) | 6580 | static void ocfs2_zero_dinode_id2_with_xattr(struct inode *inode, |
6581 | struct ocfs2_dinode *di) | ||
6581 | { | 6582 | { |
6582 | unsigned int blocksize = 1 << inode->i_sb->s_blocksize_bits; | 6583 | unsigned int blocksize = 1 << inode->i_sb->s_blocksize_bits; |
6584 | unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size); | ||
6583 | 6585 | ||
6584 | memset(&di->id2, 0, blocksize - offsetof(struct ocfs2_dinode, id2)); | 6586 | if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL) |
6587 | memset(&di->id2, 0, blocksize - | ||
6588 | offsetof(struct ocfs2_dinode, id2) - | ||
6589 | xattrsize); | ||
6590 | else | ||
6591 | memset(&di->id2, 0, blocksize - | ||
6592 | offsetof(struct ocfs2_dinode, id2)); | ||
6585 | } | 6593 | } |
6586 | 6594 | ||
6587 | void ocfs2_dinode_new_extent_list(struct inode *inode, | 6595 | void ocfs2_dinode_new_extent_list(struct inode *inode, |
6588 | struct ocfs2_dinode *di) | 6596 | struct ocfs2_dinode *di) |
6589 | { | 6597 | { |
6590 | ocfs2_zero_dinode_id2(inode, di); | 6598 | ocfs2_zero_dinode_id2_with_xattr(inode, di); |
6591 | di->id2.i_list.l_tree_depth = 0; | 6599 | di->id2.i_list.l_tree_depth = 0; |
6592 | di->id2.i_list.l_next_free_rec = 0; | 6600 | di->id2.i_list.l_next_free_rec = 0; |
6593 | di->id2.i_list.l_count = cpu_to_le16(ocfs2_extent_recs_per_inode(inode->i_sb)); | 6601 | di->id2.i_list.l_count = cpu_to_le16( |
6602 | ocfs2_extent_recs_per_inode_with_xattr(inode->i_sb, di)); | ||
6594 | } | 6603 | } |
6595 | 6604 | ||
6596 | void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di) | 6605 | void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di) |
@@ -6607,9 +6616,10 @@ void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di) | |||
6607 | * We clear the entire i_data structure here so that all | 6616 | * We clear the entire i_data structure here so that all |
6608 | * fields can be properly initialized. | 6617 | * fields can be properly initialized. |
6609 | */ | 6618 | */ |
6610 | ocfs2_zero_dinode_id2(inode, di); | 6619 | ocfs2_zero_dinode_id2_with_xattr(inode, di); |
6611 | 6620 | ||
6612 | idata->id_count = cpu_to_le16(ocfs2_max_inline_data(inode->i_sb)); | 6621 | idata->id_count = cpu_to_le16( |
6622 | ocfs2_max_inline_data_with_xattr(inode->i_sb, di)); | ||
6613 | } | 6623 | } |
6614 | 6624 | ||
6615 | int ocfs2_convert_inline_data_to_extents(struct inode *inode, | 6625 | int ocfs2_convert_inline_data_to_extents(struct inode *inode, |