aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorTiger Yang <tiger.yang@oracle.com>2008-08-18 05:08:55 -0400
committerMark Fasheh <mfasheh@suse.com>2008-10-13 19:57:02 -0400
commitfdd77704a8b4666a32120fcd1e4a9fedaf3263d8 (patch)
treebfc7ba78487c5c6287354b2b07ee4042bff566bc /fs/ocfs2/alloc.c
parentf56654c435c06f2b2bd5751889b1a08a3add7d6c (diff)
ocfs2: reserve inline space for extended attribute
Add the structures and helper functions we want for handling inline extended attributes. We also update the inline-data handlers so that they properly function in the event that we have both inline data and inline attributes sharing an inode block. Signed-off-by: Tiger Yang <tiger.yang@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c22
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
6580static void ocfs2_zero_dinode_id2(struct inode *inode, struct ocfs2_dinode *di) 6580static 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
6587void ocfs2_dinode_new_extent_list(struct inode *inode, 6595void 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
6596void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di) 6605void 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
6615int ocfs2_convert_inline_data_to_extents(struct inode *inode, 6625int ocfs2_convert_inline_data_to_extents(struct inode *inode,