/[pkg-src]/trunk/kernel26-magellan/patches-2.6.29-r7/0303-2.6.29-ext4-automatically-allocate-delay-allocated-blocks-on-rename.patch |
Annotation of /trunk/kernel26-magellan/patches-2.6.29-r7/0303-2.6.29-ext4-automatically-allocate-delay-allocated-blocks-on-rename.patch
Parent Directory | Revision Log
Revision 857 -
(hide annotations)
(download)
Tue Jun 30 20:01:52 2009 UTC (15 years, 3 months ago) by niro
File size: 1706 byte(s)
Tue Jun 30 20:01:52 2009 UTC (15 years, 3 months ago) by niro
File size: 1706 byte(s)
-2.6.29-magellan-r7: updated to linux-2.6.29.5
1 | niro | 857 | Added-By: Gordon Malm <gengor@gentoo.org> |
2 | |||
3 | --- | ||
4 | From: Theodore Ts'o <tytso@mit.edu> | ||
5 | Date: Tue, 24 Feb 2009 04:05:27 +0000 (-0500) | ||
6 | Subject: ext4: Automatically allocate delay allocated blocks on rename | ||
7 | X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftytso%2Fext4.git;a=commitdiff_plain;h=dbc85aa9f11d8c13c15527d43a3def8d7beffdc8 | ||
8 | |||
9 | ext4: Automatically allocate delay allocated blocks on rename | ||
10 | |||
11 | When renaming a file such that a link to another inode is overwritten, | ||
12 | force any delay allocated blocks that to be allocated so that if the | ||
13 | filesystem is mounted with data=ordered, the data blocks will be | ||
14 | pushed out to disk along with the journal commit. Many application | ||
15 | programs expect this, so we do this to avoid zero length files if the | ||
16 | system crashes unexpectedly. | ||
17 | |||
18 | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> | ||
19 | --- | ||
20 | |||
21 | diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c | ||
22 | index cb15900..a9a7581 100644 | ||
23 | --- a/fs/ext4/namei.c | ||
24 | +++ b/fs/ext4/namei.c | ||
25 | @@ -2357,7 +2357,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | ||
26 | struct inode *old_inode, *new_inode; | ||
27 | struct buffer_head *old_bh, *new_bh, *dir_bh; | ||
28 | struct ext4_dir_entry_2 *old_de, *new_de; | ||
29 | - int retval; | ||
30 | + int retval, force_da_alloc = 0; | ||
31 | |||
32 | old_bh = new_bh = dir_bh = NULL; | ||
33 | |||
34 | @@ -2497,6 +2497,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | ||
35 | ext4_mark_inode_dirty(handle, new_inode); | ||
36 | if (!new_inode->i_nlink) | ||
37 | ext4_orphan_add(handle, new_inode); | ||
38 | + force_da_alloc = 1; | ||
39 | } | ||
40 | retval = 0; | ||
41 | |||
42 | @@ -2505,6 +2506,8 @@ end_rename: | ||
43 | brelse(old_bh); | ||
44 | brelse(new_bh); | ||
45 | ext4_journal_stop(handle); | ||
46 | + if (retval == 0 && force_da_alloc) | ||
47 | + ext4_alloc_da_blocks(old_inode); | ||
48 | return retval; | ||
49 | } | ||
50 |