]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.suse/ocfs2-Modify-ocfs2_num_free_extents-f.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.suse / ocfs2-Modify-ocfs2_num_free_extents-f.patch
1 From: Tao Ma <tao.ma@oracle.com>
2 Subject: [PATCH 01/16] ocfs2: Modify ocfs2_num_free_extents for future xattr usage.
3 Patch-mainline: 2.6.28?
4 References: FATE302067
5
6 ocfs2_num_free_extents() is used to find the number of free extent records
7 in an inode btree. Hence, it takes an "ocfs2_dinode" parameter. We want to
8 use this for extended attribute trees in the future, so genericize the
9 interface the take a buffer head. A future patch will allow that buffer_head
10 to contain any structure rooting an ocfs2 btree.
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 | 3 ++-
16 fs/ocfs2/alloc.h | 2 +-
17 fs/ocfs2/aops.c | 5 +++--
18 fs/ocfs2/dir.c | 3 ++-
19 fs/ocfs2/file.c | 11 ++++++-----
20 fs/ocfs2/file.h | 2 +-
21 6 files changed, 15 insertions(+), 11 deletions(-)
22
23 --- a/fs/ocfs2/alloc.c
24 +++ b/fs/ocfs2/alloc.c
25 @@ -368,12 +368,13 @@ struct ocfs2_merge_ctxt {
26 */
27 int ocfs2_num_free_extents(struct ocfs2_super *osb,
28 struct inode *inode,
29 - struct ocfs2_dinode *fe)
30 + struct buffer_head *bh)
31 {
32 int retval;
33 struct ocfs2_extent_list *el;
34 struct ocfs2_extent_block *eb;
35 struct buffer_head *eb_bh = NULL;
36 + struct ocfs2_dinode *fe = (struct ocfs2_dinode *)bh->b_data;
37
38 mlog_entry_void();
39
40 --- a/fs/ocfs2/alloc.h
41 +++ b/fs/ocfs2/alloc.h
42 @@ -47,7 +47,7 @@ int ocfs2_remove_extent(struct inode *in
43 struct ocfs2_cached_dealloc_ctxt *dealloc);
44 int ocfs2_num_free_extents(struct ocfs2_super *osb,
45 struct inode *inode,
46 - struct ocfs2_dinode *fe);
47 + struct buffer_head *bh);
48 /* how many new metadata chunks would an allocation need at maximum? */
49 static inline int ocfs2_extend_meta_needed(struct ocfs2_dinode *fe)
50 {
51 --- a/fs/ocfs2/aops.c
52 +++ b/fs/ocfs2/aops.c
53 @@ -1712,8 +1712,9 @@ int ocfs2_write_begin_nolock(struct addr
54 * ocfs2_lock_allocators(). It greatly over-estimates
55 * the work to be done.
56 */
57 - ret = ocfs2_lock_allocators(inode, di, clusters_to_alloc,
58 - extents_to_split, &data_ac, &meta_ac);
59 + ret = ocfs2_lock_allocators(inode, wc->w_di_bh,
60 + clusters_to_alloc, extents_to_split,
61 + &data_ac, &meta_ac);
62 if (ret) {
63 mlog_errno(ret);
64 goto out;
65 --- a/fs/ocfs2/dir.c
66 +++ b/fs/ocfs2/dir.c
67 @@ -1479,7 +1479,8 @@ static int ocfs2_extend_dir(struct ocfs2
68 spin_lock(&OCFS2_I(dir)->ip_lock);
69 if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) {
70 spin_unlock(&OCFS2_I(dir)->ip_lock);
71 - num_free_extents = ocfs2_num_free_extents(osb, dir, fe);
72 + num_free_extents = ocfs2_num_free_extents(osb, dir,
73 + parent_fe_bh);
74 if (num_free_extents < 0) {
75 status = num_free_extents;
76 mlog_errno(status);
77 --- a/fs/ocfs2/file.c
78 +++ b/fs/ocfs2/file.c
79 @@ -521,7 +521,7 @@ int ocfs2_do_extend_allocation(struct oc
80 if (mark_unwritten)
81 flags = OCFS2_EXT_UNWRITTEN;
82
83 - free_extents = ocfs2_num_free_extents(osb, inode, fe);
84 + free_extents = ocfs2_num_free_extents(osb, inode, fe_bh);
85 if (free_extents < 0) {
86 status = free_extents;
87 mlog_errno(status);
88 @@ -609,7 +609,7 @@ leave:
89 * File systems which don't support holes call this from
90 * ocfs2_extend_allocation().
91 */
92 -int ocfs2_lock_allocators(struct inode *inode, struct ocfs2_dinode *di,
93 +int ocfs2_lock_allocators(struct inode *inode, struct buffer_head *di_bh,
94 u32 clusters_to_add, u32 extents_to_split,
95 struct ocfs2_alloc_context **data_ac,
96 struct ocfs2_alloc_context **meta_ac)
97 @@ -617,6 +617,7 @@ int ocfs2_lock_allocators(struct inode *
98 int ret = 0, num_free_extents;
99 unsigned int max_recs_needed = clusters_to_add + 2 * extents_to_split;
100 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
101 + struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
102
103 *meta_ac = NULL;
104 if (data_ac)
105 @@ -629,7 +630,7 @@ int ocfs2_lock_allocators(struct inode *
106 (unsigned long long)OCFS2_I(inode)->ip_blkno, (long long)i_size_read(inode),
107 le32_to_cpu(di->i_clusters), clusters_to_add, extents_to_split);
108
109 - num_free_extents = ocfs2_num_free_extents(osb, inode, di);
110 + num_free_extents = ocfs2_num_free_extents(osb, inode, di_bh);
111 if (num_free_extents < 0) {
112 ret = num_free_extents;
113 mlog_errno(ret);
114 @@ -724,7 +725,7 @@ static int __ocfs2_extend_allocation(str
115 restart_all:
116 BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters);
117
118 - status = ocfs2_lock_allocators(inode, fe, clusters_to_add, 0, &data_ac,
119 + status = ocfs2_lock_allocators(inode, bh, clusters_to_add, 0, &data_ac,
120 &meta_ac);
121 if (status) {
122 mlog_errno(status);
123 @@ -1395,7 +1396,7 @@ static int __ocfs2_remove_inode_range(st
124 struct ocfs2_alloc_context *meta_ac = NULL;
125 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
126
127 - ret = ocfs2_lock_allocators(inode, di, 0, 1, NULL, &meta_ac);
128 + ret = ocfs2_lock_allocators(inode, di_bh, 0, 1, NULL, &meta_ac);
129 if (ret) {
130 mlog_errno(ret);
131 return ret;
132 --- a/fs/ocfs2/file.h
133 +++ b/fs/ocfs2/file.h
134 @@ -55,7 +55,7 @@ int ocfs2_do_extend_allocation(struct oc
135 enum ocfs2_alloc_restarted *reason_ret);
136 int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size,
137 u64 zero_to);
138 -int ocfs2_lock_allocators(struct inode *inode, struct ocfs2_dinode *di,
139 +int ocfs2_lock_allocators(struct inode *inode, struct buffer_head *fe,
140 u32 clusters_to_add, u32 extents_to_split,
141 struct ocfs2_alloc_context **data_ac,
142 struct ocfs2_alloc_context **meta_ac);