/[pkg-src]/trunk/kernel26-magellan/patches-2.6.29-r7/0306-2.6.29-ext4-fix-discard-of-inode-prealloc-space-with-delayed-allocation.patch |
Annotation of /trunk/kernel26-magellan/patches-2.6.29-r7/0306-2.6.29-ext4-fix-discard-of-inode-prealloc-space-with-delayed-allocation.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: 2045 byte(s)
Tue Jun 30 20:01:52 2009 UTC (15 years, 3 months ago) by niro
File size: 2045 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: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | ||
5 | Date: Thu, 26 Feb 2009 05:54:52 +0000 (-0500) | ||
6 | Subject: ext4: Fix discard of inode prealloc space with delayed allocation. | ||
7 | X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftytso%2Fext4.git;a=commitdiff_plain;h=3cb5e61547e9ee5f040d7a02c48c7cdf6485eecc | ||
8 | |||
9 | ext4: Fix discard of inode prealloc space with delayed allocation. | ||
10 | |||
11 | With delayed allocation we should not/cannot discard inode prealloc | ||
12 | space during file close. We would still have dirty pages for which we | ||
13 | haven't allocated blocks yet. With this fix after each get_blocks | ||
14 | request we check whether we have zero reserved blocks and if yes and | ||
15 | we don't have any writers on the file we discard inode prealloc space. | ||
16 | |||
17 | Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | ||
18 | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> | ||
19 | --- | ||
20 | |||
21 | diff --git a/fs/ext4/file.c b/fs/ext4/file.c | ||
22 | index 06df827..588af8c 100644 | ||
23 | --- a/fs/ext4/file.c | ||
24 | +++ b/fs/ext4/file.c | ||
25 | @@ -39,7 +39,8 @@ static int ext4_release_file(struct inode *inode, struct file *filp) | ||
26 | } | ||
27 | /* if we are the last writer on the inode, drop the block reservation */ | ||
28 | if ((filp->f_mode & FMODE_WRITE) && | ||
29 | - (atomic_read(&inode->i_writecount) == 1)) | ||
30 | + (atomic_read(&inode->i_writecount) == 1) && | ||
31 | + !EXT4_I(inode)->i_reserved_data_blocks) | ||
32 | { | ||
33 | down_write(&EXT4_I(inode)->i_data_sem); | ||
34 | ext4_discard_preallocations(inode); | ||
35 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c | ||
36 | index 666caa9..8815b9c 100644 | ||
37 | --- a/fs/ext4/inode.c | ||
38 | +++ b/fs/ext4/inode.c | ||
39 | @@ -1053,6 +1053,14 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) | ||
40 | EXT4_I(inode)->i_reserved_data_blocks -= used; | ||
41 | |||
42 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | ||
43 | + | ||
44 | + /* | ||
45 | + * If have done all the pending block allocation and if the we | ||
46 | + * don't have any writer on the inode, we can discard the | ||
47 | + * inode's preallocations. | ||
48 | + */ | ||
49 | + if (!total && (atomic_read(&inode->i_writecount) == 0)) | ||
50 | + ext4_discard_preallocations(inode); | ||
51 | } | ||
52 | |||
53 | /* |