1 |
Author: asn |
2 |
Date: 2009-03-31 20:45:18 +0000 (Tue, 31 Mar 2009) |
3 |
New Revision: 1540 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/2.6.29/1915_ext4-automatically-allocate-delay-allocated-blocks-on-rename.patch |
7 |
genpatches-2.6/trunk/2.6.29/1916_ext4-automatically-allocate-delay-allocated-blocks-on-close.patch |
8 |
genpatches-2.6/trunk/2.6.29/1917_ext4-add-EXT4_IOC_ALLOC_DA_BLKS-ioctl.patch |
9 |
Modified: |
10 |
genpatches-2.6/trunk/2.6.29/0000_README |
11 |
Log: |
12 |
adding 3 ext4 patches that are still needed in 2.6.29 |
13 |
|
14 |
Modified: genpatches-2.6/trunk/2.6.29/0000_README |
15 |
=================================================================== |
16 |
--- genpatches-2.6/trunk/2.6.29/0000_README 2009-03-29 20:45:07 UTC (rev 1539) |
17 |
+++ genpatches-2.6/trunk/2.6.29/0000_README 2009-03-31 20:45:18 UTC (rev 1540) |
18 |
@@ -39,6 +39,18 @@ |
19 |
Individual Patch Descriptions: |
20 |
-------------------------------------------------------------------------- |
21 |
|
22 |
+Patch: 1915_ext4-automatically-allocate-delay-allocated-blocks-on-rename.patch |
23 |
+From: Theodore Ts'o <tytso@×××.edu> |
24 |
+Desc: ext4: Automatically allocate delay allocated blocks on rename |
25 |
+ |
26 |
+Patch: 1916_ext4-automatically-allocate-delay-allocated-blocks-on-close.patch |
27 |
+From: Theodore Ts'o <tytso@×××.edu> |
28 |
+Desc: ext4: Automatically allocate delay allocated blocks on close |
29 |
+ |
30 |
+Patch: 1917_ext4-add-EXT4_IOC_ALLOC_DA_BLKS-ioctl.patch |
31 |
+From: Theodore Ts'o <tytso@×××.edu> |
32 |
+Desc: ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl |
33 |
+ |
34 |
Patch: 4100_dm-bbr.patch |
35 |
From: EVMS 2.5.2 |
36 |
Desc: Bad block relocation support for LiveCD users |
37 |
|
38 |
Added: genpatches-2.6/trunk/2.6.29/1915_ext4-automatically-allocate-delay-allocated-blocks-on-rename.patch |
39 |
=================================================================== |
40 |
--- genpatches-2.6/trunk/2.6.29/1915_ext4-automatically-allocate-delay-allocated-blocks-on-rename.patch (rev 0) |
41 |
+++ genpatches-2.6/trunk/2.6.29/1915_ext4-automatically-allocate-delay-allocated-blocks-on-rename.patch 2009-03-31 20:45:18 UTC (rev 1540) |
42 |
@@ -0,0 +1,50 @@ |
43 |
+Added-By: Gordon Malm <gengor@g.o> |
44 |
+ |
45 |
+--- |
46 |
+From: Theodore Ts'o <tytso@×××.edu> |
47 |
+Date: Tue, 24 Feb 2009 04:05:27 +0000 (-0500) |
48 |
+Subject: ext4: Automatically allocate delay allocated blocks on rename |
49 |
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftytso%2Fext4.git;a=commitdiff_plain;h=dbc85aa9f11d8c13c15527d43a3def8d7beffdc8 |
50 |
+ |
51 |
+ext4: Automatically allocate delay allocated blocks on rename |
52 |
+ |
53 |
+When renaming a file such that a link to another inode is overwritten, |
54 |
+force any delay allocated blocks that to be allocated so that if the |
55 |
+filesystem is mounted with data=ordered, the data blocks will be |
56 |
+pushed out to disk along with the journal commit. Many application |
57 |
+programs expect this, so we do this to avoid zero length files if the |
58 |
+system crashes unexpectedly. |
59 |
+ |
60 |
+Signed-off-by: "Theodore Ts'o" <tytso@×××.edu> |
61 |
+--- |
62 |
+ |
63 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
64 |
+index cb15900..a9a7581 100644 |
65 |
+--- a/fs/ext4/namei.c |
66 |
++++ b/fs/ext4/namei.c |
67 |
+@@ -2357,7 +2357,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
68 |
+ struct inode *old_inode, *new_inode; |
69 |
+ struct buffer_head *old_bh, *new_bh, *dir_bh; |
70 |
+ struct ext4_dir_entry_2 *old_de, *new_de; |
71 |
+- int retval; |
72 |
++ int retval, force_da_alloc = 0; |
73 |
+ |
74 |
+ old_bh = new_bh = dir_bh = NULL; |
75 |
+ |
76 |
+@@ -2497,6 +2497,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
77 |
+ ext4_mark_inode_dirty(handle, new_inode); |
78 |
+ if (!new_inode->i_nlink) |
79 |
+ ext4_orphan_add(handle, new_inode); |
80 |
++ force_da_alloc = 1; |
81 |
+ } |
82 |
+ retval = 0; |
83 |
+ |
84 |
+@@ -2505,6 +2506,8 @@ end_rename: |
85 |
+ brelse(old_bh); |
86 |
+ brelse(new_bh); |
87 |
+ ext4_journal_stop(handle); |
88 |
++ if (retval == 0 && force_da_alloc) |
89 |
++ ext4_alloc_da_blocks(old_inode); |
90 |
+ return retval; |
91 |
+ } |
92 |
+ |
93 |
|
94 |
Added: genpatches-2.6/trunk/2.6.29/1916_ext4-automatically-allocate-delay-allocated-blocks-on-close.patch |
95 |
=================================================================== |
96 |
--- genpatches-2.6/trunk/2.6.29/1916_ext4-automatically-allocate-delay-allocated-blocks-on-close.patch (rev 0) |
97 |
+++ genpatches-2.6/trunk/2.6.29/1916_ext4-automatically-allocate-delay-allocated-blocks-on-close.patch 2009-03-31 20:45:18 UTC (rev 1540) |
98 |
@@ -0,0 +1,61 @@ |
99 |
+Added-By: Gordon Malm <gengor@g.o> |
100 |
+ |
101 |
+--- |
102 |
+From: Theodore Ts'o <tytso@×××.edu> |
103 |
+Date: Tue, 24 Feb 2009 13:21:14 +0000 (-0500) |
104 |
+Subject: ext4: Automatically allocate delay allocated blocks on close |
105 |
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftytso%2Fext4.git;a=commitdiff_plain;h=6645f8c3bc3cdaa7de4aaa3d34d40c2e8e5f09ae |
106 |
+ |
107 |
+ext4: Automatically allocate delay allocated blocks on close |
108 |
+ |
109 |
+When closing a file that had been previously truncated, force any |
110 |
+delay allocated blocks that to be allocated so that if the filesystem |
111 |
+is mounted with data=ordered, the data blocks will be pushed out to |
112 |
+disk along with the journal commit. Many application programs expect |
113 |
+this, so we do this to avoid zero length files if the system crashes |
114 |
+unexpectedly. |
115 |
+ |
116 |
+Signed-off-by: "Theodore Ts'o" <tytso@×××.edu> |
117 |
+--- |
118 |
+ |
119 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
120 |
+index ea51c89..234c731 100644 |
121 |
+--- a/fs/ext4/ext4.h |
122 |
++++ b/fs/ext4/ext4.h |
123 |
+@@ -269,6 +269,7 @@ static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags) |
124 |
+ #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ |
125 |
+ #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ |
126 |
+ #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ |
127 |
++#define EXT4_STATE_DA_ALLOC_CLOSE 0x00000010 /* Alloc DA blks on close */ |
128 |
+ |
129 |
+ /* Used to pass group descriptor data when online resize is done */ |
130 |
+ struct ext4_new_group_input { |
131 |
+diff --git a/fs/ext4/file.c b/fs/ext4/file.c |
132 |
+index f731cb5..06df827 100644 |
133 |
+--- a/fs/ext4/file.c |
134 |
++++ b/fs/ext4/file.c |
135 |
+@@ -33,6 +33,10 @@ |
136 |
+ */ |
137 |
+ static int ext4_release_file(struct inode *inode, struct file *filp) |
138 |
+ { |
139 |
++ if (EXT4_I(inode)->i_state & EXT4_STATE_DA_ALLOC_CLOSE) { |
140 |
++ ext4_alloc_da_blocks(inode); |
141 |
++ EXT4_I(inode)->i_state &= ~EXT4_STATE_DA_ALLOC_CLOSE; |
142 |
++ } |
143 |
+ /* if we are the last writer on the inode, drop the block reservation */ |
144 |
+ if ((filp->f_mode & FMODE_WRITE) && |
145 |
+ (atomic_read(&inode->i_writecount) == 1)) |
146 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
147 |
+index ead57ab..666caa9 100644 |
148 |
+--- a/fs/ext4/inode.c |
149 |
++++ b/fs/ext4/inode.c |
150 |
+@@ -3871,6 +3871,9 @@ void ext4_truncate(struct inode *inode) |
151 |
+ if (!ext4_can_truncate(inode)) |
152 |
+ return; |
153 |
+ |
154 |
++ if (inode->i_size == 0) |
155 |
++ ei->i_state |= EXT4_STATE_DA_ALLOC_CLOSE; |
156 |
++ |
157 |
+ if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { |
158 |
+ ext4_ext_truncate(inode); |
159 |
+ return; |
160 |
|
161 |
Added: genpatches-2.6/trunk/2.6.29/1917_ext4-add-EXT4_IOC_ALLOC_DA_BLKS-ioctl.patch |
162 |
=================================================================== |
163 |
--- genpatches-2.6/trunk/2.6.29/1917_ext4-add-EXT4_IOC_ALLOC_DA_BLKS-ioctl.patch (rev 0) |
164 |
+++ genpatches-2.6/trunk/2.6.29/1917_ext4-add-EXT4_IOC_ALLOC_DA_BLKS-ioctl.patch 2009-03-31 20:45:18 UTC (rev 1540) |
165 |
@@ -0,0 +1,118 @@ |
166 |
+Added-By: Gordon Malm <gengor@g.o> |
167 |
+ |
168 |
+--- |
169 |
+From: Theodore Ts'o <tytso@×××.edu> |
170 |
+Date: Thu, 26 Feb 2009 06:04:07 +0000 (-0500) |
171 |
+Subject: ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl |
172 |
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftytso%2Fext4.git;a=commitdiff_plain;h=3bf3342f394d72ed2ec7e77b5b39e1b50fad8284 |
173 |
+ |
174 |
+ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl |
175 |
+ |
176 |
+Add an ioctl which forces all of the delay allocated blocks to be |
177 |
+allocated. This also provides a function ext4_alloc_da_blocks() which |
178 |
+will be used by the following commits to force files to be fully |
179 |
+allocated to preserve application-expected ext3 behaviour. |
180 |
+ |
181 |
+Signed-off-by: "Theodore Ts'o" <tytso@×××.edu> |
182 |
+--- |
183 |
+ |
184 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
185 |
+index 684a063..ea51c89 100644 |
186 |
+--- a/fs/ext4/ext4.h |
187 |
++++ b/fs/ext4/ext4.h |
188 |
+@@ -316,7 +316,9 @@ struct ext4_new_group_data { |
189 |
+ #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) |
190 |
+ #define EXT4_IOC_GROUP_ADD _IOW('f', 8, struct ext4_new_group_input) |
191 |
+ #define EXT4_IOC_MIGRATE _IO('f', 9) |
192 |
++ /* note ioctl 10 reserved for an early version of the FIEMAP ioctl */ |
193 |
+ /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */ |
194 |
++#define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12) |
195 |
+ |
196 |
+ /* |
197 |
+ * ioctl commands in 32 bit emulation |
198 |
+@@ -1093,6 +1095,7 @@ extern int ext4_can_truncate(struct inode *inode); |
199 |
+ extern void ext4_truncate(struct inode *); |
200 |
+ extern void ext4_set_inode_flags(struct inode *); |
201 |
+ extern void ext4_get_inode_flags(struct ext4_inode_info *); |
202 |
++extern int ext4_alloc_da_blocks(struct inode *inode); |
203 |
+ extern void ext4_set_aops(struct inode *inode); |
204 |
+ extern int ext4_writepage_trans_blocks(struct inode *); |
205 |
+ extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks); |
206 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
207 |
+index c67f46e..ead57ab 100644 |
208 |
+--- a/fs/ext4/inode.c |
209 |
++++ b/fs/ext4/inode.c |
210 |
+@@ -2807,6 +2807,48 @@ out: |
211 |
+ return; |
212 |
+ } |
213 |
+ |
214 |
++/* |
215 |
++ * Force all delayed allocation blocks to be allocated for a given inode. |
216 |
++ */ |
217 |
++int ext4_alloc_da_blocks(struct inode *inode) |
218 |
++{ |
219 |
++ if (!EXT4_I(inode)->i_reserved_data_blocks && |
220 |
++ !EXT4_I(inode)->i_reserved_meta_blocks) |
221 |
++ return 0; |
222 |
++ |
223 |
++ /* |
224 |
++ * We do something simple for now. The filemap_flush() will |
225 |
++ * also start triggering a write of the data blocks, which is |
226 |
++ * not strictly speaking necessary (and for users of |
227 |
++ * laptop_mode, not even desirable). However, to do otherwise |
228 |
++ * would require replicating code paths in: |
229 |
++ * |
230 |
++ * ext4_da_writepages() -> |
231 |
++ * write_cache_pages() ---> (via passed in callback function) |
232 |
++ * __mpage_da_writepage() --> |
233 |
++ * mpage_add_bh_to_extent() |
234 |
++ * mpage_da_map_blocks() |
235 |
++ * |
236 |
++ * The problem is that write_cache_pages(), located in |
237 |
++ * mm/page-writeback.c, marks pages clean in preparation for |
238 |
++ * doing I/O, which is not desirable if we're not planning on |
239 |
++ * doing I/O at all. |
240 |
++ * |
241 |
++ * We could call write_cache_pages(), and then redirty all of |
242 |
++ * the pages by calling redirty_page_for_writeback() but that |
243 |
++ * would be ugly in the extreme. So instead we would need to |
244 |
++ * replicate parts of the code in the above functions, |
245 |
++ * simplifying them becuase we wouldn't actually intend to |
246 |
++ * write out the pages, but rather only collect contiguous |
247 |
++ * logical block extents, call the multi-block allocator, and |
248 |
++ * then update the buffer heads with the block allocations. |
249 |
++ * |
250 |
++ * For now, though, we'll cheat by calling filemap_flush(), |
251 |
++ * which will map the blocks, and start the I/O, but not |
252 |
++ * actually wait for the I/O to complete. |
253 |
++ */ |
254 |
++ return filemap_flush(inode->i_mapping); |
255 |
++} |
256 |
+ |
257 |
+ /* |
258 |
+ * bmap() is special. It gets used by applications such as lilo and by |
259 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
260 |
+index 22dd29f..91e75f7 100644 |
261 |
+--- a/fs/ext4/ioctl.c |
262 |
++++ b/fs/ext4/ioctl.c |
263 |
+@@ -262,6 +262,20 @@ setversion_out: |
264 |
+ return err; |
265 |
+ } |
266 |
+ |
267 |
++ case EXT4_IOC_ALLOC_DA_BLKS: |
268 |
++ { |
269 |
++ int err; |
270 |
++ if (!is_owner_or_cap(inode)) |
271 |
++ return -EACCES; |
272 |
++ |
273 |
++ err = mnt_want_write(filp->f_path.mnt); |
274 |
++ if (err) |
275 |
++ return err; |
276 |
++ err = ext4_alloc_da_blocks(inode); |
277 |
++ mnt_drop_write(filp->f_path.mnt); |
278 |
++ return err; |
279 |
++ } |
280 |
++ |
281 |
+ default: |
282 |
+ return -ENOTTY; |
283 |
+ } |