]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Tao Ma <tao.ma@oracle.com> |
2 | Date: Fri, 9 Jan 2009 07:32:48 +0800 | |
3 | Subject: [PATCH] ocfs2: Access and dirty the buffer_head in mark_written. | |
4 | Patch-mainline: 2.6.29 | |
5 | ||
6 | In __ocfs2_mark_extent_written, when we meet with the situation | |
7 | of c_split_covers_rec, the old solution just replace the extent | |
8 | record and forget to access and dirty the buffer_head. This will | |
9 | cause a problem when the unwritten extent is in an extent block. | |
10 | So access and dirty it. | |
11 | ||
12 | Signed-off-by: Tao Ma <tao.ma@oracle.com> | |
13 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
14 | --- | |
15 | fs/ocfs2/alloc.c | 27 ++++++++++++++++++++++++++- | |
16 | 1 files changed, 26 insertions(+), 1 deletions(-) | |
17 | ||
18 | Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/alloc.c | |
19 | =================================================================== | |
20 | --- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/alloc.c | |
21 | +++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/alloc.c | |
22 | @@ -4708,6 +4708,29 @@ out: | |
23 | return ret; | |
24 | } | |
25 | ||
26 | +static int ocfs2_replace_extent_rec(struct inode *inode, | |
27 | + handle_t *handle, | |
28 | + struct ocfs2_path *path, | |
29 | + struct ocfs2_extent_list *el, | |
30 | + int split_index, | |
31 | + struct ocfs2_extent_rec *split_rec) | |
32 | +{ | |
33 | + int ret; | |
34 | + | |
35 | + ret = ocfs2_journal_access(handle, inode, path_leaf_bh(path), | |
36 | + OCFS2_JOURNAL_ACCESS_WRITE); | |
37 | + if (ret) { | |
38 | + mlog_errno(ret); | |
39 | + goto out; | |
40 | + } | |
41 | + | |
42 | + el->l_recs[split_index] = *split_rec; | |
43 | + | |
44 | + ocfs2_journal_dirty(handle, path_leaf_bh(path)); | |
45 | +out: | |
46 | + return ret; | |
47 | +} | |
48 | + | |
49 | /* | |
50 | * Mark part or all of the extent record at split_index in the leaf | |
51 | * pointed to by path as written. This removes the unwritten | |
52 | @@ -4802,7 +4825,9 @@ static int __ocfs2_mark_extent_written(s | |
53 | ||
54 | if (ctxt.c_contig_type == CONTIG_NONE) { | |
55 | if (ctxt.c_split_covers_rec) | |
56 | - el->l_recs[split_index] = *split_rec; | |
57 | + ret = ocfs2_replace_extent_rec(inode, handle, | |
58 | + path, el, | |
59 | + split_index, split_rec); | |
60 | else | |
61 | ret = ocfs2_split_and_insert(inode, handle, path, et, | |
62 | &last_eb_bh, split_index, |