diff options
Diffstat (limited to 'fs/ocfs2/alloc.c')
| -rw-r--r-- | fs/ocfs2/alloc.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 60fe74035db5..19e3a96aa02c 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
| @@ -176,7 +176,8 @@ static int ocfs2_dinode_insert_check(struct inode *inode, | |||
| 176 | 176 | ||
| 177 | BUG_ON(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL); | 177 | BUG_ON(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL); |
| 178 | mlog_bug_on_msg(!ocfs2_sparse_alloc(osb) && | 178 | mlog_bug_on_msg(!ocfs2_sparse_alloc(osb) && |
| 179 | (OCFS2_I(inode)->ip_clusters != rec->e_cpos), | 179 | (OCFS2_I(inode)->ip_clusters != |
| 180 | le32_to_cpu(rec->e_cpos)), | ||
| 180 | "Device %s, asking for sparse allocation: inode %llu, " | 181 | "Device %s, asking for sparse allocation: inode %llu, " |
| 181 | "cpos %u, clusters %u\n", | 182 | "cpos %u, clusters %u\n", |
| 182 | osb->dev_str, | 183 | osb->dev_str, |
| @@ -4796,6 +4797,29 @@ out: | |||
| 4796 | return ret; | 4797 | return ret; |
| 4797 | } | 4798 | } |
| 4798 | 4799 | ||
| 4800 | static int ocfs2_replace_extent_rec(struct inode *inode, | ||
| 4801 | handle_t *handle, | ||
| 4802 | struct ocfs2_path *path, | ||
| 4803 | struct ocfs2_extent_list *el, | ||
| 4804 | int split_index, | ||
| 4805 | struct ocfs2_extent_rec *split_rec) | ||
| 4806 | { | ||
| 4807 | int ret; | ||
| 4808 | |||
| 4809 | ret = ocfs2_path_bh_journal_access(handle, inode, path, | ||
| 4810 | path_num_items(path) - 1); | ||
| 4811 | if (ret) { | ||
| 4812 | mlog_errno(ret); | ||
| 4813 | goto out; | ||
| 4814 | } | ||
| 4815 | |||
| 4816 | el->l_recs[split_index] = *split_rec; | ||
| 4817 | |||
| 4818 | ocfs2_journal_dirty(handle, path_leaf_bh(path)); | ||
| 4819 | out: | ||
| 4820 | return ret; | ||
| 4821 | } | ||
| 4822 | |||
| 4799 | /* | 4823 | /* |
| 4800 | * Mark part or all of the extent record at split_index in the leaf | 4824 | * Mark part or all of the extent record at split_index in the leaf |
| 4801 | * pointed to by path as written. This removes the unwritten | 4825 | * pointed to by path as written. This removes the unwritten |
| @@ -4885,7 +4909,9 @@ static int __ocfs2_mark_extent_written(struct inode *inode, | |||
| 4885 | 4909 | ||
| 4886 | if (ctxt.c_contig_type == CONTIG_NONE) { | 4910 | if (ctxt.c_contig_type == CONTIG_NONE) { |
| 4887 | if (ctxt.c_split_covers_rec) | 4911 | if (ctxt.c_split_covers_rec) |
| 4888 | el->l_recs[split_index] = *split_rec; | 4912 | ret = ocfs2_replace_extent_rec(inode, handle, |
| 4913 | path, el, | ||
| 4914 | split_index, split_rec); | ||
| 4889 | else | 4915 | else |
| 4890 | ret = ocfs2_split_and_insert(inode, handle, path, et, | 4916 | ret = ocfs2_split_and_insert(inode, handle, path, et, |
| 4891 | &last_eb_bh, split_index, | 4917 | &last_eb_bh, split_index, |
