1 |
Author: mpagano |
2 |
Date: 2009-04-06 14:26:48 +0000 (Mon, 06 Apr 2009) |
3 |
New Revision: 1544 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/2.6.29/1918_ext4-fix-discard-of-inode-prealloc-space-with-delayed-allocation.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/2.6.29/0000_README |
9 |
Log: |
10 |
ext4 patch to fix discard of inode prealloc space with delayed allocation |
11 |
|
12 |
Modified: genpatches-2.6/trunk/2.6.29/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/2.6.29/0000_README 2009-04-04 23:49:11 UTC (rev 1543) |
15 |
+++ genpatches-2.6/trunk/2.6.29/0000_README 2009-04-06 14:26:48 UTC (rev 1544) |
16 |
@@ -55,6 +55,10 @@ |
17 |
From: Theodore Ts'o <tytso@×××.edu> |
18 |
Desc: ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl |
19 |
|
20 |
+Patch: 1918_ext4-fix-discard-of-inode-prealloc-space-with-delayed-allocation.patch |
21 |
+From: Aneesh Kumar K.V <aneesh.kumar@××××××××××××××.com> |
22 |
+Desc: ext4: Fix discard of inode prealloc space with delayed allocation |
23 |
+ |
24 |
Patch: 4100_dm-bbr.patch |
25 |
From: EVMS 2.5.2 |
26 |
Desc: Bad block relocation support for LiveCD users |
27 |
|
28 |
Added: genpatches-2.6/trunk/2.6.29/1918_ext4-fix-discard-of-inode-prealloc-space-with-delayed-allocation.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/2.6.29/1918_ext4-fix-discard-of-inode-prealloc-space-with-delayed-allocation.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/2.6.29/1918_ext4-fix-discard-of-inode-prealloc-space-with-delayed-allocation.patch 2009-04-06 14:26:48 UTC (rev 1544) |
32 |
@@ -0,0 +1,53 @@ |
33 |
+Added-By: Gordon Malm <gengor@g.o> |
34 |
+ |
35 |
+--- |
36 |
+From: Aneesh Kumar K.V <aneesh.kumar@××××××××××××××.com> |
37 |
+Date: Thu, 26 Feb 2009 05:54:52 +0000 (-0500) |
38 |
+Subject: ext4: Fix discard of inode prealloc space with delayed allocation. |
39 |
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftytso%2Fext4.git;a=commitdiff_plain;h=3cb5e61547e9ee5f040d7a02c48c7cdf6485eecc |
40 |
+ |
41 |
+ext4: Fix discard of inode prealloc space with delayed allocation. |
42 |
+ |
43 |
+With delayed allocation we should not/cannot discard inode prealloc |
44 |
+space during file close. We would still have dirty pages for which we |
45 |
+haven't allocated blocks yet. With this fix after each get_blocks |
46 |
+request we check whether we have zero reserved blocks and if yes and |
47 |
+we don't have any writers on the file we discard inode prealloc space. |
48 |
+ |
49 |
+Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@××××××××××××××.com> |
50 |
+Signed-off-by: "Theodore Ts'o" <tytso@×××.edu> |
51 |
+--- |
52 |
+ |
53 |
+diff --git a/fs/ext4/file.c b/fs/ext4/file.c |
54 |
+index 06df827..588af8c 100644 |
55 |
+--- a/fs/ext4/file.c |
56 |
++++ b/fs/ext4/file.c |
57 |
+@@ -39,7 +39,8 @@ static int ext4_release_file(struct inode *inode, struct file *filp) |
58 |
+ } |
59 |
+ /* if we are the last writer on the inode, drop the block reservation */ |
60 |
+ if ((filp->f_mode & FMODE_WRITE) && |
61 |
+- (atomic_read(&inode->i_writecount) == 1)) |
62 |
++ (atomic_read(&inode->i_writecount) == 1) && |
63 |
++ !EXT4_I(inode)->i_reserved_data_blocks) |
64 |
+ { |
65 |
+ down_write(&EXT4_I(inode)->i_data_sem); |
66 |
+ ext4_discard_preallocations(inode); |
67 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
68 |
+index 666caa9..8815b9c 100644 |
69 |
+--- a/fs/ext4/inode.c |
70 |
++++ b/fs/ext4/inode.c |
71 |
+@@ -1053,6 +1053,14 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) |
72 |
+ EXT4_I(inode)->i_reserved_data_blocks -= used; |
73 |
+ |
74 |
+ spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
75 |
++ |
76 |
++ /* |
77 |
++ * If have done all the pending block allocation and if the we |
78 |
++ * don't have any writer on the inode, we can discard the |
79 |
++ * inode's preallocations. |
80 |
++ */ |
81 |
++ if (!total && (atomic_read(&inode->i_writecount) == 0)) |
82 |
++ ext4_discard_preallocations(inode); |
83 |
+ } |
84 |
+ |
85 |
+ /* |