aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-09-13 19:33:54 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2007-10-12 14:54:41 -0400
commit5b6a3a2b4a5f071d170f8122038dd647a84810a8 (patch)
treedd50e12c6670f950889e24401d0bcee900bbba2a /fs/ocfs2/alloc.c
parent23193e513d1cd69411469f028d56fd175d4a6b07 (diff)
ocfs2: Write support for directories with inline data
Create all new directories with OCFS2_INLINE_DATA_FL and the inline data bytes formatted as an empty directory. Inode size field reflects the actual amount of inline data available, which makes searching for dirent space very similar to the regular directory search. Inline-data directories are automatically pushed out to extents on any insert request which is too large for the available space. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com> Reviewed-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 72cefe25382b..4ba7f0bdc248 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -5835,6 +5835,15 @@ static void ocfs2_zero_dinode_id2(struct inode *inode, struct ocfs2_dinode *di)
5835 memset(&di->id2, 0, blocksize - offsetof(struct ocfs2_dinode, id2)); 5835 memset(&di->id2, 0, blocksize - offsetof(struct ocfs2_dinode, id2));
5836} 5836}
5837 5837
5838void ocfs2_dinode_new_extent_list(struct inode *inode,
5839 struct ocfs2_dinode *di)
5840{
5841 ocfs2_zero_dinode_id2(inode, di);
5842 di->id2.i_list.l_tree_depth = 0;
5843 di->id2.i_list.l_next_free_rec = 0;
5844 di->id2.i_list.l_count = cpu_to_le16(ocfs2_extent_recs_per_inode(inode->i_sb));
5845}
5846
5838void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di) 5847void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di)
5839{ 5848{
5840 struct ocfs2_inode_info *oi = OCFS2_I(inode); 5849 struct ocfs2_inode_info *oi = OCFS2_I(inode);
@@ -5863,7 +5872,6 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
5863 struct ocfs2_inode_info *oi = OCFS2_I(inode); 5872 struct ocfs2_inode_info *oi = OCFS2_I(inode);
5864 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 5873 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
5865 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 5874 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
5866 struct ocfs2_extent_list *el = &di->id2.i_list;
5867 struct ocfs2_alloc_context *data_ac = NULL; 5875 struct ocfs2_alloc_context *data_ac = NULL;
5868 struct page **pages = NULL; 5876 struct page **pages = NULL;
5869 loff_t end = osb->s_clustersize; 5877 loff_t end = osb->s_clustersize;
@@ -5956,11 +5964,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
5956 di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); 5964 di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features);
5957 spin_unlock(&oi->ip_lock); 5965 spin_unlock(&oi->ip_lock);
5958 5966
5959 ocfs2_zero_dinode_id2(inode, di); 5967 ocfs2_dinode_new_extent_list(inode, di);
5960
5961 el->l_tree_depth = 0;
5962 el->l_next_free_rec = 0;
5963 el->l_count = cpu_to_le16(ocfs2_extent_recs_per_inode(inode->i_sb));
5964 5968
5965 ocfs2_journal_dirty(handle, di_bh); 5969 ocfs2_journal_dirty(handle, di_bh);
5966 5970