add patch fix-return-value-of-ext4_do_update_inode
[ext4-patch-queue.git] / drop-ext4_state-delalloc-reserved
blobcde26b63e9d5974fad7b24f4ab71aad1c3d6335b
1 ext4: drop the EXT4_STATE_DELALLOC_RESERVED flag
3 Having done a full regression test, we can now drop the
4 DELALLOC_RESERVED state flag.
6 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 Reviewed-by: Jan Kara <jack@suse.cz>
8 ---
9  fs/ext4/ext4.h    |  1 -
10  fs/ext4/inode.c   | 20 ++++----------------
11  fs/ext4/mballoc.c | 10 ----------
12  3 files changed, 4 insertions(+), 27 deletions(-)
14 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
15 index 00fd822..4855800 100644
16 --- a/fs/ext4/ext4.h
17 +++ b/fs/ext4/ext4.h
18 @@ -1400,7 +1400,6 @@ enum {
19         EXT4_STATE_EXT_MIGRATE,         /* Inode is migrating */
20         EXT4_STATE_DIO_UNWRITTEN,       /* need convert on dio done*/
21         EXT4_STATE_NEWENTRY,            /* File just added to dir */
22 -       EXT4_STATE_DELALLOC_RESERVED,   /* blks already reserved for delalloc */
23         EXT4_STATE_DIOREAD_LOCK,        /* Disable support for dio read
24                                            nolocking */
25         EXT4_STATE_MAY_INLINE_DATA,     /* may have in-inode data */
26 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
27 index 4a16b0c..d5dd7d4 100644
28 --- a/fs/ext4/inode.c
29 +++ b/fs/ext4/inode.c
30 @@ -596,14 +596,6 @@ found:
31         down_write(&EXT4_I(inode)->i_data_sem);
33         /*
34 -        * if the caller is from delayed allocation writeout path
35 -        * we have already reserved fs blocks for allocation
36 -        * let the underlying get_block() function know to
37 -        * avoid double accounting
38 -        */
39 -       if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
40 -               ext4_set_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED);
41 -       /*
42          * We need to check for EXT4 here because migrate
43          * could have changed the inode type in between
44          */
45 @@ -631,8 +623,6 @@ found:
46                         (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE))
47                         ext4_da_update_reserve_space(inode, retval, 1);
48         }
49 -       if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
50 -               ext4_clear_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED);
52         if (retval > 0) {
53                 unsigned int status;
54 @@ -2004,12 +1994,10 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
55          * in data loss.  So use reserved blocks to allocate metadata if
56          * possible.
57          *
58 -        * We pass in the magic EXT4_GET_BLOCKS_DELALLOC_RESERVE if the blocks
59 -        * in question are delalloc blocks.  This affects functions in many
60 -        * different parts of the allocation call path.  This flag exists
61 -        * primarily because we don't want to change *many* call functions, so
62 -        * ext4_map_blocks() will set the EXT4_STATE_DELALLOC_RESERVED flag
63 -        * once the inode's allocation semaphore is taken.
64 +        * We pass in the magic EXT4_GET_BLOCKS_DELALLOC_RESERVE if
65 +        * the blocks in question are delalloc blocks.  This indicates
66 +        * that the blocks and quotas has already been checked when
67 +        * the data was copied into the page cache.
68          */
69         get_blocks_flags = EXT4_GET_BLOCKS_CREATE |
70                            EXT4_GET_BLOCKS_METADATA_NOFAIL;
71 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
72 index 15dffda..65cca28 100644
73 --- a/fs/ext4/mballoc.c
74 +++ b/fs/ext4/mballoc.c
75 @@ -4410,16 +4410,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
76         if (IS_NOQUOTA(ar->inode))
77                 ar->flags |= EXT4_MB_USE_ROOT_BLOCKS;
79 -       /*
80 -        * For delayed allocation, we could skip the ENOSPC and
81 -        * EDQUOT check, as blocks and quotas have been already
82 -        * reserved when data being copied into pagecache.
83 -        */
84 -       if (ext4_test_inode_state(ar->inode, EXT4_STATE_DELALLOC_RESERVED)) {
85 -               WARN_ON((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0);
86 -               ar->flags |= EXT4_MB_DELALLOC_RESERVED;
87 -       }
89         if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {
90                 /* Without delayed allocation we need to verify
91                  * there is enough free blocks to do block allocation