aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2014-04-20 23:45:47 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-04-20 23:45:47 -0400
commit556615dcbf38b0a92a9e659f52c06686270dfc16 (patch)
tree33a336cd219fc4386b811a9ffb03d3f6a79d7185
parent090f32ee4ef0a59c738963c6b0a6948cc5dee84c (diff)
ext4: rename uninitialized extents to unwritten
Currently in ext4 there is quite a mess when it comes to naming unwritten extents. Sometimes we call it uninitialized and sometimes we refer to it as unwritten. The right name for the extent which has been allocated but does not contain any written data is _unwritten_. Other file systems are using this name consistently, even the buffer head state refers to it as unwritten. We need to fix this confusion in ext4. This commit changes every reference to an uninitialized extent (meaning allocated but unwritten) to unwritten extent. This includes comments, function names and variable names. It even covers abbreviation of the word uninitialized (such as uninit) and some misspellings. This commit does not change any of the code paths at all. This has been confirmed by comparing md5sums of the assembly code of each object file after all the function names were stripped from it. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4.h16
-rw-r--r--fs/ext4/ext4_extents.h22
-rw-r--r--fs/ext4/extents.c218
-rw-r--r--fs/ext4/extents_status.c2
-rw-r--r--fs/ext4/file.c2
-rw-r--r--fs/ext4/inode.c18
-rw-r--r--fs/ext4/move_extent.c38
-rw-r--r--fs/ext4/super.c2
-rw-r--r--include/trace/events/ext4.h8
9 files changed, 163 insertions, 163 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index b681d90b1e87..86c2cda208ea 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -183,7 +183,7 @@ struct ext4_map_blocks {
183#define EXT4_IO_END_UNWRITTEN 0x0001 183#define EXT4_IO_END_UNWRITTEN 0x0001
184 184
185/* 185/*
186 * For converting uninitialized extents on a work queue. 'handle' is used for 186 * For converting unwritten extents on a work queue. 'handle' is used for
187 * buffered writeback. 187 * buffered writeback.
188 */ 188 */
189typedef struct ext4_io_end { 189typedef struct ext4_io_end {
@@ -536,26 +536,26 @@ enum {
536/* 536/*
537 * Flags used by ext4_map_blocks() 537 * Flags used by ext4_map_blocks()
538 */ 538 */
539 /* Allocate any needed blocks and/or convert an unitialized 539 /* Allocate any needed blocks and/or convert an unwritten
540 extent to be an initialized ext4 */ 540 extent to be an initialized ext4 */
541#define EXT4_GET_BLOCKS_CREATE 0x0001 541#define EXT4_GET_BLOCKS_CREATE 0x0001
542 /* Request the creation of an unitialized extent */ 542 /* Request the creation of an unwritten extent */
543#define EXT4_GET_BLOCKS_UNINIT_EXT 0x0002 543#define EXT4_GET_BLOCKS_UNWRIT_EXT 0x0002
544#define EXT4_GET_BLOCKS_CREATE_UNINIT_EXT (EXT4_GET_BLOCKS_UNINIT_EXT|\ 544#define EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT (EXT4_GET_BLOCKS_UNWRIT_EXT|\
545 EXT4_GET_BLOCKS_CREATE) 545 EXT4_GET_BLOCKS_CREATE)
546 /* Caller is from the delayed allocation writeout path 546 /* Caller is from the delayed allocation writeout path
547 * finally doing the actual allocation of delayed blocks */ 547 * finally doing the actual allocation of delayed blocks */
548#define EXT4_GET_BLOCKS_DELALLOC_RESERVE 0x0004 548#define EXT4_GET_BLOCKS_DELALLOC_RESERVE 0x0004
549 /* caller is from the direct IO path, request to creation of an 549 /* caller is from the direct IO path, request to creation of an
550 unitialized extents if not allocated, split the uninitialized 550 unwritten extents if not allocated, split the unwritten
551 extent if blocks has been preallocated already*/ 551 extent if blocks has been preallocated already*/
552#define EXT4_GET_BLOCKS_PRE_IO 0x0008 552#define EXT4_GET_BLOCKS_PRE_IO 0x0008
553#define EXT4_GET_BLOCKS_CONVERT 0x0010 553#define EXT4_GET_BLOCKS_CONVERT 0x0010
554#define EXT4_GET_BLOCKS_IO_CREATE_EXT (EXT4_GET_BLOCKS_PRE_IO|\ 554#define EXT4_GET_BLOCKS_IO_CREATE_EXT (EXT4_GET_BLOCKS_PRE_IO|\
555 EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) 555 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT)
556 /* Convert extent to initialized after IO complete */ 556 /* Convert extent to initialized after IO complete */
557#define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ 557#define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\
558 EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) 558 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT)
559 /* Eventual metadata allocation (due to growing extent tree) 559 /* Eventual metadata allocation (due to growing extent tree)
560 * should not fail, so try to use reserved blocks for that.*/ 560 * should not fail, so try to use reserved blocks for that.*/
561#define EXT4_GET_BLOCKS_METADATA_NOFAIL 0x0020 561#define EXT4_GET_BLOCKS_METADATA_NOFAIL 0x0020
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h
index 5074fe23f19e..a867f5ca9991 100644
--- a/fs/ext4/ext4_extents.h
+++ b/fs/ext4/ext4_extents.h
@@ -137,21 +137,21 @@ struct ext4_ext_path {
137 * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an 137 * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
138 * initialized extent. This is 2^15 and not (2^16 - 1), since we use the 138 * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
139 * MSB of ee_len field in the extent datastructure to signify if this 139 * MSB of ee_len field in the extent datastructure to signify if this
140 * particular extent is an initialized extent or an uninitialized (i.e. 140 * particular extent is an initialized extent or an unwritten (i.e.
141 * preallocated). 141 * preallocated).
142 * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an 142 * EXT_UNWRITTEN_MAX_LEN is the maximum number of blocks we can have in an
143 * uninitialized extent. 143 * unwritten extent.
144 * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an 144 * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
145 * uninitialized one. In other words, if MSB of ee_len is set, it is an 145 * unwritten one. In other words, if MSB of ee_len is set, it is an
146 * uninitialized extent with only one special scenario when ee_len = 0x8000. 146 * unwritten extent with only one special scenario when ee_len = 0x8000.
147 * In this case we can not have an uninitialized extent of zero length and 147 * In this case we can not have an unwritten extent of zero length and
148 * thus we make it as a special case of initialized extent with 0x8000 length. 148 * thus we make it as a special case of initialized extent with 0x8000 length.
149 * This way we get better extent-to-group alignment for initialized extents. 149 * This way we get better extent-to-group alignment for initialized extents.
150 * Hence, the maximum number of blocks we can have in an *initialized* 150 * Hence, the maximum number of blocks we can have in an *initialized*
151 * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767). 151 * extent is 2^15 (32768) and in an *unwritten* extent is 2^15-1 (32767).
152 */ 152 */
153#define EXT_INIT_MAX_LEN (1UL << 15) 153#define EXT_INIT_MAX_LEN (1UL << 15)
154#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1) 154#define EXT_UNWRITTEN_MAX_LEN (EXT_INIT_MAX_LEN - 1)
155 155
156 156
157#define EXT_FIRST_EXTENT(__hdr__) \ 157#define EXT_FIRST_EXTENT(__hdr__) \
@@ -187,14 +187,14 @@ static inline unsigned short ext_depth(struct inode *inode)
187 return le16_to_cpu(ext_inode_hdr(inode)->eh_depth); 187 return le16_to_cpu(ext_inode_hdr(inode)->eh_depth);
188} 188}
189 189
190static inline void ext4_ext_mark_uninitialized(struct ext4_extent *ext) 190static inline void ext4_ext_mark_unwritten(struct ext4_extent *ext)
191{ 191{
192 /* We can not have an uninitialized extent of zero length! */ 192 /* We can not have an unwritten extent of zero length! */
193 BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0); 193 BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0);
194 ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN); 194 ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN);
195} 195}
196 196
197static inline int ext4_ext_is_uninitialized(struct ext4_extent *ext) 197static inline int ext4_ext_is_unwritten(struct ext4_extent *ext)
198{ 198{
199 /* Extent with ee_len of 0x8000 is treated as an initialized extent */ 199 /* Extent with ee_len of 0x8000 is treated as an initialized extent */
200 return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN); 200 return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN);
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 83ed52538ae4..e305a31641f2 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -50,8 +50,8 @@
50 */ 50 */
51#define EXT4_EXT_MAY_ZEROOUT 0x1 /* safe to zeroout if split fails \ 51#define EXT4_EXT_MAY_ZEROOUT 0x1 /* safe to zeroout if split fails \
52 due to ENOSPC */ 52 due to ENOSPC */
53#define EXT4_EXT_MARK_UNINIT1 0x2 /* mark first half uninitialized */ 53#define EXT4_EXT_MARK_UNWRIT1 0x2 /* mark first half unwritten */
54#define EXT4_EXT_MARK_UNINIT2 0x4 /* mark second half uninitialized */ 54#define EXT4_EXT_MARK_UNWRIT2 0x4 /* mark second half unwritten */
55 55
56#define EXT4_EXT_DATA_VALID1 0x8 /* first half contains valid data */ 56#define EXT4_EXT_DATA_VALID1 0x8 /* first half contains valid data */
57#define EXT4_EXT_DATA_VALID2 0x10 /* second half contains valid data */ 57#define EXT4_EXT_DATA_VALID2 0x10 /* second half contains valid data */
@@ -524,7 +524,7 @@ __read_extent_tree_block(const char *function, unsigned int line,
524 lblk - prev, ~0, 524 lblk - prev, ~0,
525 EXTENT_STATUS_HOLE); 525 EXTENT_STATUS_HOLE);
526 526
527 if (ext4_ext_is_uninitialized(ex)) 527 if (ext4_ext_is_unwritten(ex))
528 status = EXTENT_STATUS_UNWRITTEN; 528 status = EXTENT_STATUS_UNWRITTEN;
529 ext4_es_cache_extent(inode, lblk, len, 529 ext4_es_cache_extent(inode, lblk, len,
530 ext4_ext_pblock(ex), status); 530 ext4_ext_pblock(ex), status);
@@ -620,7 +620,7 @@ static void ext4_ext_show_path(struct inode *inode, struct ext4_ext_path *path)
620 } else if (path->p_ext) { 620 } else if (path->p_ext) {
621 ext_debug(" %d:[%d]%d:%llu ", 621 ext_debug(" %d:[%d]%d:%llu ",
622 le32_to_cpu(path->p_ext->ee_block), 622 le32_to_cpu(path->p_ext->ee_block),
623 ext4_ext_is_uninitialized(path->p_ext), 623 ext4_ext_is_unwritten(path->p_ext),
624 ext4_ext_get_actual_len(path->p_ext), 624 ext4_ext_get_actual_len(path->p_ext),
625 ext4_ext_pblock(path->p_ext)); 625 ext4_ext_pblock(path->p_ext));
626 } else 626 } else
@@ -646,7 +646,7 @@ static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path)
646 646
647 for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) { 647 for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) {
648 ext_debug("%d:[%d]%d:%llu ", le32_to_cpu(ex->ee_block), 648 ext_debug("%d:[%d]%d:%llu ", le32_to_cpu(ex->ee_block),
649 ext4_ext_is_uninitialized(ex), 649 ext4_ext_is_unwritten(ex),
650 ext4_ext_get_actual_len(ex), ext4_ext_pblock(ex)); 650 ext4_ext_get_actual_len(ex), ext4_ext_pblock(ex));
651 } 651 }
652 ext_debug("\n"); 652 ext_debug("\n");
@@ -677,7 +677,7 @@ static void ext4_ext_show_move(struct inode *inode, struct ext4_ext_path *path,
677 ext_debug("move %d:%llu:[%d]%d in new leaf %llu\n", 677 ext_debug("move %d:%llu:[%d]%d in new leaf %llu\n",
678 le32_to_cpu(ex->ee_block), 678 le32_to_cpu(ex->ee_block),
679 ext4_ext_pblock(ex), 679 ext4_ext_pblock(ex),
680 ext4_ext_is_uninitialized(ex), 680 ext4_ext_is_unwritten(ex),
681 ext4_ext_get_actual_len(ex), 681 ext4_ext_get_actual_len(ex),
682 newblock); 682 newblock);
683 ex++; 683 ex++;
@@ -802,7 +802,7 @@ ext4_ext_binsearch(struct inode *inode,
802 ext_debug(" -> %d:%llu:[%d]%d ", 802 ext_debug(" -> %d:%llu:[%d]%d ",
803 le32_to_cpu(path->p_ext->ee_block), 803 le32_to_cpu(path->p_ext->ee_block),
804 ext4_ext_pblock(path->p_ext), 804 ext4_ext_pblock(path->p_ext),
805 ext4_ext_is_uninitialized(path->p_ext), 805 ext4_ext_is_unwritten(path->p_ext),
806 ext4_ext_get_actual_len(path->p_ext)); 806 ext4_ext_get_actual_len(path->p_ext));
807 807
808#ifdef CHECK_BINSEARCH 808#ifdef CHECK_BINSEARCH
@@ -1686,11 +1686,11 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1,
1686 1686
1687 /* 1687 /*
1688 * Make sure that both extents are initialized. We don't merge 1688 * Make sure that both extents are initialized. We don't merge
1689 * uninitialized extents so that we can be sure that end_io code has 1689 * unwritten extents so that we can be sure that end_io code has
1690 * the extent that was written properly split out and conversion to 1690 * the extent that was written properly split out and conversion to
1691 * initialized is trivial. 1691 * initialized is trivial.
1692 */ 1692 */
1693 if (ext4_ext_is_uninitialized(ex1) != ext4_ext_is_uninitialized(ex2)) 1693 if (ext4_ext_is_unwritten(ex1) != ext4_ext_is_unwritten(ex2))
1694 return 0; 1694 return 0;
1695 1695
1696 ext1_ee_len = ext4_ext_get_actual_len(ex1); 1696 ext1_ee_len = ext4_ext_get_actual_len(ex1);
@@ -1707,10 +1707,10 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1,
1707 */ 1707 */
1708 if (ext1_ee_len + ext2_ee_len > EXT_INIT_MAX_LEN) 1708 if (ext1_ee_len + ext2_ee_len > EXT_INIT_MAX_LEN)
1709 return 0; 1709 return 0;
1710 if (ext4_ext_is_uninitialized(ex1) && 1710 if (ext4_ext_is_unwritten(ex1) &&
1711 (ext4_test_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN) || 1711 (ext4_test_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN) ||
1712 atomic_read(&EXT4_I(inode)->i_unwritten) || 1712 atomic_read(&EXT4_I(inode)->i_unwritten) ||
1713 (ext1_ee_len + ext2_ee_len > EXT_UNINIT_MAX_LEN))) 1713 (ext1_ee_len + ext2_ee_len > EXT_UNWRITTEN_MAX_LEN)))
1714 return 0; 1714 return 0;
1715#ifdef AGGRESSIVE_TEST 1715#ifdef AGGRESSIVE_TEST
1716 if (ext1_ee_len >= 4) 1716 if (ext1_ee_len >= 4)
@@ -1735,7 +1735,7 @@ static int ext4_ext_try_to_merge_right(struct inode *inode,
1735{ 1735{
1736 struct ext4_extent_header *eh; 1736 struct ext4_extent_header *eh;
1737 unsigned int depth, len; 1737 unsigned int depth, len;
1738 int merge_done = 0, uninit; 1738 int merge_done = 0, unwritten;
1739 1739
1740 depth = ext_depth(inode); 1740 depth = ext_depth(inode);
1741 BUG_ON(path[depth].p_hdr == NULL); 1741 BUG_ON(path[depth].p_hdr == NULL);
@@ -1745,11 +1745,11 @@ static int ext4_ext_try_to_merge_right(struct inode *inode,
1745 if (!ext4_can_extents_be_merged(inode, ex, ex + 1)) 1745 if (!ext4_can_extents_be_merged(inode, ex, ex + 1))
1746 break; 1746 break;
1747 /* merge with next extent! */ 1747 /* merge with next extent! */
1748 uninit = ext4_ext_is_uninitialized(ex); 1748 unwritten = ext4_ext_is_unwritten(ex);
1749 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) 1749 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
1750 + ext4_ext_get_actual_len(ex + 1)); 1750 + ext4_ext_get_actual_len(ex + 1));
1751 if (uninit) 1751 if (unwritten)
1752 ext4_ext_mark_uninitialized(ex); 1752 ext4_ext_mark_unwritten(ex);
1753 1753
1754 if (ex + 1 < EXT_LAST_EXTENT(eh)) { 1754 if (ex + 1 < EXT_LAST_EXTENT(eh)) {
1755 len = (EXT_LAST_EXTENT(eh) - ex - 1) 1755 len = (EXT_LAST_EXTENT(eh) - ex - 1)
@@ -1903,7 +1903,7 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
1903 struct ext4_ext_path *npath = NULL; 1903 struct ext4_ext_path *npath = NULL;
1904 int depth, len, err; 1904 int depth, len, err;
1905 ext4_lblk_t next; 1905 ext4_lblk_t next;
1906 int mb_flags = 0, uninit; 1906 int mb_flags = 0, unwritten;
1907 1907
1908 if (unlikely(ext4_ext_get_actual_len(newext) == 0)) { 1908 if (unlikely(ext4_ext_get_actual_len(newext) == 0)) {
1909 EXT4_ERROR_INODE(inode, "ext4_ext_get_actual_len(newext) == 0"); 1909 EXT4_ERROR_INODE(inode, "ext4_ext_get_actual_len(newext) == 0");
@@ -1943,21 +1943,21 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
1943 if (ext4_can_extents_be_merged(inode, ex, newext)) { 1943 if (ext4_can_extents_be_merged(inode, ex, newext)) {
1944 ext_debug("append [%d]%d block to %u:[%d]%d" 1944 ext_debug("append [%d]%d block to %u:[%d]%d"
1945 "(from %llu)\n", 1945 "(from %llu)\n",
1946 ext4_ext_is_uninitialized(newext), 1946 ext4_ext_is_unwritten(newext),
1947 ext4_ext_get_actual_len(newext), 1947 ext4_ext_get_actual_len(newext),
1948 le32_to_cpu(ex->ee_block), 1948 le32_to_cpu(ex->ee_block),
1949 ext4_ext_is_uninitialized(ex), 1949 ext4_ext_is_unwritten(ex),
1950 ext4_ext_get_actual_len(ex), 1950 ext4_ext_get_actual_len(ex),
1951 ext4_ext_pblock(ex)); 1951 ext4_ext_pblock(ex));
1952 err = ext4_ext_get_access(handle, inode, 1952 err = ext4_ext_get_access(handle, inode,
1953 path + depth); 1953 path + depth);
1954 if (err) 1954 if (err)
1955 return err; 1955 return err;
1956 uninit = ext4_ext_is_uninitialized(ex); 1956 unwritten = ext4_ext_is_unwritten(ex);
1957 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) 1957 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
1958 + ext4_ext_get_actual_len(newext)); 1958 + ext4_ext_get_actual_len(newext));
1959 if (uninit) 1959 if (unwritten)
1960 ext4_ext_mark_uninitialized(ex); 1960 ext4_ext_mark_unwritten(ex);
1961 eh = path[depth].p_hdr; 1961 eh = path[depth].p_hdr;
1962 nearex = ex; 1962 nearex = ex;
1963 goto merge; 1963 goto merge;
@@ -1969,10 +1969,10 @@ prepend:
1969 ext_debug("prepend %u[%d]%d block to %u:[%d]%d" 1969 ext_debug("prepend %u[%d]%d block to %u:[%d]%d"
1970 "(from %llu)\n", 1970 "(from %llu)\n",
1971 le32_to_cpu(newext->ee_block), 1971 le32_to_cpu(newext->ee_block),
1972 ext4_ext_is_uninitialized(newext), 1972 ext4_ext_is_unwritten(newext),
1973 ext4_ext_get_actual_len(newext), 1973 ext4_ext_get_actual_len(newext),
1974 le32_to_cpu(ex->ee_block), 1974 le32_to_cpu(ex->ee_block),
1975 ext4_ext_is_uninitialized(ex), 1975 ext4_ext_is_unwritten(ex),
1976 ext4_ext_get_actual_len(ex), 1976 ext4_ext_get_actual_len(ex),
1977 ext4_ext_pblock(ex)); 1977 ext4_ext_pblock(ex));
1978 err = ext4_ext_get_access(handle, inode, 1978 err = ext4_ext_get_access(handle, inode,
@@ -1980,13 +1980,13 @@ prepend:
1980 if (err) 1980 if (err)
1981 return err; 1981 return err;
1982 1982
1983 uninit = ext4_ext_is_uninitialized(ex); 1983 unwritten = ext4_ext_is_unwritten(ex);
1984 ex->ee_block = newext->ee_block; 1984 ex->ee_block = newext->ee_block;
1985 ext4_ext_store_pblock(ex, ext4_ext_pblock(newext)); 1985 ext4_ext_store_pblock(ex, ext4_ext_pblock(newext));
1986 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) 1986 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
1987 + ext4_ext_get_actual_len(newext)); 1987 + ext4_ext_get_actual_len(newext));
1988 if (uninit) 1988 if (unwritten)
1989 ext4_ext_mark_uninitialized(ex); 1989 ext4_ext_mark_unwritten(ex);
1990 eh = path[depth].p_hdr; 1990 eh = path[depth].p_hdr;
1991 nearex = ex; 1991 nearex = ex;
1992 goto merge; 1992 goto merge;
@@ -2046,7 +2046,7 @@ has_space:
2046 ext_debug("first extent in the leaf: %u:%llu:[%d]%d\n", 2046 ext_debug("first extent in the leaf: %u:%llu:[%d]%d\n",
2047 le32_to_cpu(newext->ee_block), 2047 le32_to_cpu(newext->ee_block),
2048 ext4_ext_pblock(newext), 2048 ext4_ext_pblock(newext),
2049 ext4_ext_is_uninitialized(newext), 2049 ext4_ext_is_unwritten(newext),
2050 ext4_ext_get_actual_len(newext)); 2050 ext4_ext_get_actual_len(newext));
2051 nearex = EXT_FIRST_EXTENT(eh); 2051 nearex = EXT_FIRST_EXTENT(eh);
2052 } else { 2052 } else {
@@ -2057,7 +2057,7 @@ has_space:
2057 "nearest %p\n", 2057 "nearest %p\n",
2058 le32_to_cpu(newext->ee_block), 2058 le32_to_cpu(newext->ee_block),
2059 ext4_ext_pblock(newext), 2059 ext4_ext_pblock(newext),
2060 ext4_ext_is_uninitialized(newext), 2060 ext4_ext_is_unwritten(newext),
2061 ext4_ext_get_actual_len(newext), 2061 ext4_ext_get_actual_len(newext),
2062 nearex); 2062 nearex);
2063 nearex++; 2063 nearex++;
@@ -2068,7 +2068,7 @@ has_space:
2068 "nearest %p\n", 2068 "nearest %p\n",
2069 le32_to_cpu(newext->ee_block), 2069 le32_to_cpu(newext->ee_block),
2070 ext4_ext_pblock(newext), 2070 ext4_ext_pblock(newext),
2071 ext4_ext_is_uninitialized(newext), 2071 ext4_ext_is_unwritten(newext),
2072 ext4_ext_get_actual_len(newext), 2072 ext4_ext_get_actual_len(newext),
2073 nearex); 2073 nearex);
2074 } 2074 }
@@ -2078,7 +2078,7 @@ has_space:
2078 "move %d extents from 0x%p to 0x%p\n", 2078 "move %d extents from 0x%p to 0x%p\n",
2079 le32_to_cpu(newext->ee_block), 2079 le32_to_cpu(newext->ee_block),
2080 ext4_ext_pblock(newext), 2080 ext4_ext_pblock(newext),
2081 ext4_ext_is_uninitialized(newext), 2081 ext4_ext_is_unwritten(newext),
2082 ext4_ext_get_actual_len(newext), 2082 ext4_ext_get_actual_len(newext),
2083 len, nearex, nearex + 1); 2083 len, nearex, nearex + 1);
2084 memmove(nearex + 1, nearex, 2084 memmove(nearex + 1, nearex,
@@ -2200,7 +2200,7 @@ static int ext4_fill_fiemap_extents(struct inode *inode,
2200 es.es_lblk = le32_to_cpu(ex->ee_block); 2200 es.es_lblk = le32_to_cpu(ex->ee_block);
2201 es.es_len = ext4_ext_get_actual_len(ex); 2201 es.es_len = ext4_ext_get_actual_len(ex);
2202 es.es_pblk = ext4_ext_pblock(ex); 2202 es.es_pblk = ext4_ext_pblock(ex);
2203 if (ext4_ext_is_uninitialized(ex)) 2203 if (ext4_ext_is_unwritten(ex))
2204 flags |= FIEMAP_EXTENT_UNWRITTEN; 2204 flags |= FIEMAP_EXTENT_UNWRITTEN;
2205 } 2205 }
2206 2206
@@ -2576,7 +2576,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
2576 unsigned num; 2576 unsigned num;
2577 ext4_lblk_t ex_ee_block; 2577 ext4_lblk_t ex_ee_block;
2578 unsigned short ex_ee_len; 2578 unsigned short ex_ee_len;
2579 unsigned uninitialized = 0; 2579 unsigned unwritten = 0;
2580 struct ext4_extent *ex; 2580 struct ext4_extent *ex;
2581 ext4_fsblk_t pblk; 2581 ext4_fsblk_t pblk;
2582 2582
@@ -2623,13 +2623,13 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
2623 while (ex >= EXT_FIRST_EXTENT(eh) && 2623 while (ex >= EXT_FIRST_EXTENT(eh) &&
2624 ex_ee_block + ex_ee_len > start) { 2624 ex_ee_block + ex_ee_len > start) {
2625 2625
2626 if (ext4_ext_is_uninitialized(ex)) 2626 if (ext4_ext_is_unwritten(ex))
2627 uninitialized = 1; 2627 unwritten = 1;
2628 else 2628 else
2629 uninitialized = 0; 2629 unwritten = 0;
2630 2630
2631 ext_debug("remove ext %u:[%d]%d\n", ex_ee_block, 2631 ext_debug("remove ext %u:[%d]%d\n", ex_ee_block,
2632 uninitialized, ex_ee_len); 2632 unwritten, ex_ee_len);
2633 path[depth].p_ext = ex; 2633 path[depth].p_ext = ex;
2634 2634
2635 a = ex_ee_block > start ? ex_ee_block : start; 2635 a = ex_ee_block > start ? ex_ee_block : start;
@@ -2701,11 +2701,11 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
2701 2701
2702 ex->ee_len = cpu_to_le16(num); 2702 ex->ee_len = cpu_to_le16(num);
2703 /* 2703 /*
2704 * Do not mark uninitialized if all the blocks in the 2704 * Do not mark unwritten if all the blocks in the
2705 * extent have been removed. 2705 * extent have been removed.
2706 */ 2706 */
2707 if (uninitialized && num) 2707 if (unwritten && num)
2708 ext4_ext_mark_uninitialized(ex); 2708 ext4_ext_mark_unwritten(ex);
2709 /* 2709 /*
2710 * If the extent was completely released, 2710 * If the extent was completely released,
2711 * we need to remove it from the leaf 2711 * we need to remove it from the leaf
@@ -2854,9 +2854,9 @@ again:
2854 end < ee_block + ext4_ext_get_actual_len(ex) - 1) { 2854 end < ee_block + ext4_ext_get_actual_len(ex) - 1) {
2855 int split_flag = 0; 2855 int split_flag = 0;
2856 2856
2857 if (ext4_ext_is_uninitialized(ex)) 2857 if (ext4_ext_is_unwritten(ex))
2858 split_flag = EXT4_EXT_MARK_UNINIT1 | 2858 split_flag = EXT4_EXT_MARK_UNWRIT1 |
2859 EXT4_EXT_MARK_UNINIT2; 2859 EXT4_EXT_MARK_UNWRIT2;
2860 2860
2861 /* 2861 /*
2862 * Split the extent in two so that 'end' is the last 2862 * Split the extent in two so that 'end' is the last
@@ -3113,7 +3113,7 @@ static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex)
3113 * @path: the path to the extent 3113 * @path: the path to the extent
3114 * @split: the logical block where the extent is splitted. 3114 * @split: the logical block where the extent is splitted.
3115 * @split_flags: indicates if the extent could be zeroout if split fails, and 3115 * @split_flags: indicates if the extent could be zeroout if split fails, and
3116 * the states(init or uninit) of new extents. 3116 * the states(init or unwritten) of new extents.
3117 * @flags: flags used to insert new extent to extent tree. 3117 * @flags: flags used to insert new extent to extent tree.
3118 * 3118 *
3119 * 3119 *
@@ -3155,10 +3155,10 @@ static int ext4_split_extent_at(handle_t *handle,
3155 newblock = split - ee_block + ext4_ext_pblock(ex); 3155 newblock = split - ee_block + ext4_ext_pblock(ex);
3156 3156
3157 BUG_ON(split < ee_block || split >= (ee_block + ee_len)); 3157 BUG_ON(split < ee_block || split >= (ee_block + ee_len));
3158 BUG_ON(!ext4_ext_is_uninitialized(ex) && 3158 BUG_ON(!ext4_ext_is_unwritten(ex) &&
3159 split_flag & (EXT4_EXT_MAY_ZEROOUT | 3159 split_flag & (EXT4_EXT_MAY_ZEROOUT |
3160 EXT4_EXT_MARK_UNINIT1 | 3160 EXT4_EXT_MARK_UNWRIT1 |
3161 EXT4_EXT_MARK_UNINIT2)); 3161 EXT4_EXT_MARK_UNWRIT2));
3162 3162
3163 err = ext4_ext_get_access(handle, inode, path + depth); 3163 err = ext4_ext_get_access(handle, inode, path + depth);
3164 if (err) 3164 if (err)
@@ -3170,8 +3170,8 @@ static int ext4_split_extent_at(handle_t *handle,
3170 * then we just change the state of the extent, and splitting 3170 * then we just change the state of the extent, and splitting
3171 * is not needed. 3171 * is not needed.
3172 */ 3172 */
3173 if (split_flag & EXT4_EXT_MARK_UNINIT2) 3173 if (split_flag & EXT4_EXT_MARK_UNWRIT2)
3174 ext4_ext_mark_uninitialized(ex); 3174 ext4_ext_mark_unwritten(ex);
3175 else 3175 else
3176 ext4_ext_mark_initialized(ex); 3176 ext4_ext_mark_initialized(ex);
3177 3177
@@ -3185,8 +3185,8 @@ static int ext4_split_extent_at(handle_t *handle,
3185 /* case a */ 3185 /* case a */
3186 memcpy(&orig_ex, ex, sizeof(orig_ex)); 3186 memcpy(&orig_ex, ex, sizeof(orig_ex));
3187 ex->ee_len = cpu_to_le16(split - ee_block); 3187 ex->ee_len = cpu_to_le16(split - ee_block);
3188 if (split_flag & EXT4_EXT_MARK_UNINIT1) 3188 if (split_flag & EXT4_EXT_MARK_UNWRIT1)
3189 ext4_ext_mark_uninitialized(ex); 3189 ext4_ext_mark_unwritten(ex);
3190 3190
3191 /* 3191 /*
3192 * path may lead to new leaf, not to original leaf any more 3192 * path may lead to new leaf, not to original leaf any more
@@ -3200,8 +3200,8 @@ static int ext4_split_extent_at(handle_t *handle,
3200 ex2->ee_block = cpu_to_le32(split); 3200 ex2->ee_block = cpu_to_le32(split);
3201 ex2->ee_len = cpu_to_le16(ee_len - (split - ee_block)); 3201 ex2->ee_len = cpu_to_le16(ee_len - (split - ee_block));
3202 ext4_ext_store_pblock(ex2, newblock); 3202 ext4_ext_store_pblock(ex2, newblock);
3203 if (split_flag & EXT4_EXT_MARK_UNINIT2) 3203 if (split_flag & EXT4_EXT_MARK_UNWRIT2)
3204 ext4_ext_mark_uninitialized(ex2); 3204 ext4_ext_mark_unwritten(ex2);
3205 3205
3206 err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); 3206 err = ext4_ext_insert_extent(handle, inode, path, &newex, flags);
3207 if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { 3207 if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) {
@@ -3278,7 +3278,7 @@ static int ext4_split_extent(handle_t *handle,
3278 struct ext4_extent *ex; 3278 struct ext4_extent *ex;
3279 unsigned int ee_len, depth; 3279 unsigned int ee_len, depth;
3280 int err = 0; 3280 int err = 0;
3281 int uninitialized; 3281 int unwritten;
3282 int split_flag1, flags1; 3282 int split_flag1, flags1;
3283 int allocated = map->m_len; 3283 int allocated = map->m_len;
3284 3284
@@ -3286,14 +3286,14 @@ static int ext4_split_extent(handle_t *handle,
3286 ex = path[depth].p_ext; 3286 ex = path[depth].p_ext;
3287 ee_block = le32_to_cpu(ex->ee_block); 3287 ee_block = le32_to_cpu(ex->ee_block);
3288 ee_len = ext4_ext_get_actual_len(ex); 3288 ee_len = ext4_ext_get_actual_len(ex);
3289 uninitialized = ext4_ext_is_uninitialized(ex); 3289 unwritten = ext4_ext_is_unwritten(ex);
3290 3290
3291 if (map->m_lblk + map->m_len < ee_block + ee_len) { 3291 if (map->m_lblk + map->m_len < ee_block + ee_len) {
3292 split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT; 3292 split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT;
3293 flags1 = flags | EXT4_GET_BLOCKS_PRE_IO; 3293 flags1 = flags | EXT4_GET_BLOCKS_PRE_IO;
3294 if (uninitialized) 3294 if (unwritten)
3295 split_flag1 |= EXT4_EXT_MARK_UNINIT1 | 3295 split_flag1 |= EXT4_EXT_MARK_UNWRIT1 |
3296 EXT4_EXT_MARK_UNINIT2; 3296 EXT4_EXT_MARK_UNWRIT2;
3297 if (split_flag & EXT4_EXT_DATA_VALID2) 3297 if (split_flag & EXT4_EXT_DATA_VALID2)
3298 split_flag1 |= EXT4_EXT_DATA_VALID1; 3298 split_flag1 |= EXT4_EXT_DATA_VALID1;
3299 err = ext4_split_extent_at(handle, inode, path, 3299 err = ext4_split_extent_at(handle, inode, path,
@@ -3318,15 +3318,15 @@ static int ext4_split_extent(handle_t *handle,
3318 (unsigned long) map->m_lblk); 3318 (unsigned long) map->m_lblk);
3319 return -EIO; 3319 return -EIO;
3320 } 3320 }
3321 uninitialized = ext4_ext_is_uninitialized(ex); 3321 unwritten = ext4_ext_is_unwritten(ex);
3322 split_flag1 = 0; 3322 split_flag1 = 0;
3323 3323
3324 if (map->m_lblk >= ee_block) { 3324 if (map->m_lblk >= ee_block) {
3325 split_flag1 = split_flag & EXT4_EXT_DATA_VALID2; 3325 split_flag1 = split_flag & EXT4_EXT_DATA_VALID2;
3326 if (uninitialized) { 3326 if (unwritten) {
3327 split_flag1 |= EXT4_EXT_MARK_UNINIT1; 3327 split_flag1 |= EXT4_EXT_MARK_UNWRIT1;
3328 split_flag1 |= split_flag & (EXT4_EXT_MAY_ZEROOUT | 3328 split_flag1 |= split_flag & (EXT4_EXT_MAY_ZEROOUT |
3329 EXT4_EXT_MARK_UNINIT2); 3329 EXT4_EXT_MARK_UNWRIT2);
3330 } 3330 }
3331 err = ext4_split_extent_at(handle, inode, path, 3331 err = ext4_split_extent_at(handle, inode, path,
3332 map->m_lblk, split_flag1, flags); 3332 map->m_lblk, split_flag1, flags);
@@ -3341,16 +3341,16 @@ out:
3341 3341
3342/* 3342/*
3343 * This function is called by ext4_ext_map_blocks() if someone tries to write 3343 * This function is called by ext4_ext_map_blocks() if someone tries to write
3344 * to an uninitialized extent. It may result in splitting the uninitialized 3344 * to an unwritten extent. It may result in splitting the unwritten
3345 * extent into multiple extents (up to three - one initialized and two 3345 * extent into multiple extents (up to three - one initialized and two
3346 * uninitialized). 3346 * unwritten).
3347 * There are three possibilities: 3347 * There are three possibilities:
3348 * a> There is no split required: Entire extent should be initialized 3348 * a> There is no split required: Entire extent should be initialized
3349 * b> Splits in two extents: Write is happening at either end of the extent 3349 * b> Splits in two extents: Write is happening at either end of the extent
3350 * c> Splits in three extents: Somone is writing in middle of the extent 3350 * c> Splits in three extents: Somone is writing in middle of the extent
3351 * 3351 *
3352 * Pre-conditions: 3352 * Pre-conditions:
3353 * - The extent pointed to by 'path' is uninitialized. 3353 * - The extent pointed to by 'path' is unwritten.
3354 * - The extent pointed to by 'path' contains a superset 3354 * - The extent pointed to by 'path' contains a superset
3355 * of the logical span [map->m_lblk, map->m_lblk + map->m_len). 3355 * of the logical span [map->m_lblk, map->m_lblk + map->m_len).
3356 * 3356 *
@@ -3396,12 +3396,12 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
3396 trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); 3396 trace_ext4_ext_convert_to_initialized_enter(inode, map, ex);
3397 3397
3398 /* Pre-conditions */ 3398 /* Pre-conditions */
3399 BUG_ON(!ext4_ext_is_uninitialized(ex)); 3399 BUG_ON(!ext4_ext_is_unwritten(ex));
3400 BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); 3400 BUG_ON(!in_range(map->m_lblk, ee_block, ee_len));
3401 3401
3402 /* 3402 /*
3403 * Attempt to transfer newly initialized blocks from the currently 3403 * Attempt to transfer newly initialized blocks from the currently
3404 * uninitialized extent to its neighbor. This is much cheaper 3404 * unwritten extent to its neighbor. This is much cheaper
3405 * than an insertion followed by a merge as those involve costly 3405 * than an insertion followed by a merge as those involve costly
3406 * memmove() calls. Transferring to the left is the common case in 3406 * memmove() calls. Transferring to the left is the common case in
3407 * steady state for workloads doing fallocate(FALLOC_FL_KEEP_SIZE) 3407 * steady state for workloads doing fallocate(FALLOC_FL_KEEP_SIZE)
@@ -3437,7 +3437,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
3437 * - C4: abut_ex can receive the additional blocks without 3437 * - C4: abut_ex can receive the additional blocks without
3438 * overflowing the (initialized) length limit. 3438 * overflowing the (initialized) length limit.
3439 */ 3439 */
3440 if ((!ext4_ext_is_uninitialized(abut_ex)) && /*C1*/ 3440 if ((!ext4_ext_is_unwritten(abut_ex)) && /*C1*/
3441 ((prev_lblk + prev_len) == ee_block) && /*C2*/ 3441 ((prev_lblk + prev_len) == ee_block) && /*C2*/
3442 ((prev_pblk + prev_len) == ee_pblk) && /*C3*/ 3442 ((prev_pblk + prev_len) == ee_pblk) && /*C3*/
3443 (prev_len < (EXT_INIT_MAX_LEN - map_len))) { /*C4*/ 3443 (prev_len < (EXT_INIT_MAX_LEN - map_len))) { /*C4*/
@@ -3452,7 +3452,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
3452 ex->ee_block = cpu_to_le32(ee_block + map_len); 3452 ex->ee_block = cpu_to_le32(ee_block + map_len);
3453 ext4_ext_store_pblock(ex, ee_pblk + map_len); 3453 ext4_ext_store_pblock(ex, ee_pblk + map_len);
3454 ex->ee_len = cpu_to_le16(ee_len - map_len); 3454 ex->ee_len = cpu_to_le16(ee_len - map_len);
3455 ext4_ext_mark_uninitialized(ex); /* Restore the flag */ 3455 ext4_ext_mark_unwritten(ex); /* Restore the flag */
3456 3456
3457 /* Extend abut_ex by 'map_len' blocks */ 3457 /* Extend abut_ex by 'map_len' blocks */
3458 abut_ex->ee_len = cpu_to_le16(prev_len + map_len); 3458 abut_ex->ee_len = cpu_to_le16(prev_len + map_len);
@@ -3483,7 +3483,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
3483 * - C4: abut_ex can receive the additional blocks without 3483 * - C4: abut_ex can receive the additional blocks without
3484 * overflowing the (initialized) length limit. 3484 * overflowing the (initialized) length limit.
3485 */ 3485 */
3486 if ((!ext4_ext_is_uninitialized(abut_ex)) && /*C1*/ 3486 if ((!ext4_ext_is_unwritten(abut_ex)) && /*C1*/
3487 ((map->m_lblk + map_len) == next_lblk) && /*C2*/ 3487 ((map->m_lblk + map_len) == next_lblk) && /*C2*/
3488 ((ee_pblk + ee_len) == next_pblk) && /*C3*/ 3488 ((ee_pblk + ee_len) == next_pblk) && /*C3*/
3489 (next_len < (EXT_INIT_MAX_LEN - map_len))) { /*C4*/ 3489 (next_len < (EXT_INIT_MAX_LEN - map_len))) { /*C4*/
@@ -3498,7 +3498,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
3498 abut_ex->ee_block = cpu_to_le32(next_lblk - map_len); 3498 abut_ex->ee_block = cpu_to_le32(next_lblk - map_len);
3499 ext4_ext_store_pblock(abut_ex, next_pblk - map_len); 3499 ext4_ext_store_pblock(abut_ex, next_pblk - map_len);
3500 ex->ee_len = cpu_to_le16(ee_len - map_len); 3500 ex->ee_len = cpu_to_le16(ee_len - map_len);
3501 ext4_ext_mark_uninitialized(ex); /* Restore the flag */ 3501 ext4_ext_mark_unwritten(ex); /* Restore the flag */
3502 3502
3503 /* Extend abut_ex by 'map_len' blocks */ 3503 /* Extend abut_ex by 'map_len' blocks */
3504 abut_ex->ee_len = cpu_to_le16(next_len + map_len); 3504 abut_ex->ee_len = cpu_to_le16(next_len + map_len);
@@ -3603,26 +3603,26 @@ out:
3603/* 3603/*
3604 * This function is called by ext4_ext_map_blocks() from 3604 * This function is called by ext4_ext_map_blocks() from
3605 * ext4_get_blocks_dio_write() when DIO to write 3605 * ext4_get_blocks_dio_write() when DIO to write
3606 * to an uninitialized extent. 3606 * to an unwritten extent.
3607 * 3607 *
3608 * Writing to an uninitialized extent may result in splitting the uninitialized 3608 * Writing to an unwritten extent may result in splitting the unwritten
3609 * extent into multiple initialized/uninitialized extents (up to three) 3609 * extent into multiple initialized/unwritten extents (up to three)
3610 * There are three possibilities: 3610 * There are three possibilities:
3611 * a> There is no split required: Entire extent should be uninitialized 3611 * a> There is no split required: Entire extent should be unwritten
3612 * b> Splits in two extents: Write is happening at either end of the extent 3612 * b> Splits in two extents: Write is happening at either end of the extent
3613 * c> Splits in three extents: Somone is writing in middle of the extent 3613 * c> Splits in three extents: Somone is writing in middle of the extent
3614 * 3614 *
3615 * This works the same way in the case of initialized -> unwritten conversion. 3615 * This works the same way in the case of initialized -> unwritten conversion.
3616 * 3616 *
3617 * One of more index blocks maybe needed if the extent tree grow after 3617 * One of more index blocks maybe needed if the extent tree grow after
3618 * the uninitialized extent split. To prevent ENOSPC occur at the IO 3618 * the unwritten extent split. To prevent ENOSPC occur at the IO
3619 * complete, we need to split the uninitialized extent before DIO submit 3619 * complete, we need to split the unwritten extent before DIO submit
3620 * the IO. The uninitialized extent called at this time will be split 3620 * the IO. The unwritten extent called at this time will be split
3621 * into three uninitialized extent(at most). After IO complete, the part 3621 * into three unwritten extent(at most). After IO complete, the part
3622 * being filled will be convert to initialized by the end_io callback function 3622 * being filled will be convert to initialized by the end_io callback function
3623 * via ext4_convert_unwritten_extents(). 3623 * via ext4_convert_unwritten_extents().
3624 * 3624 *
3625 * Returns the size of uninitialized extent to be written on success. 3625 * Returns the size of unwritten extent to be written on success.
3626 */ 3626 */
3627static int ext4_split_convert_extents(handle_t *handle, 3627static int ext4_split_convert_extents(handle_t *handle,
3628 struct inode *inode, 3628 struct inode *inode,
@@ -3660,7 +3660,7 @@ static int ext4_split_convert_extents(handle_t *handle,
3660 } else if (flags & EXT4_GET_BLOCKS_CONVERT) { 3660 } else if (flags & EXT4_GET_BLOCKS_CONVERT) {
3661 split_flag |= ee_block + ee_len <= eof_block ? 3661 split_flag |= ee_block + ee_len <= eof_block ?
3662 EXT4_EXT_MAY_ZEROOUT : 0; 3662 EXT4_EXT_MAY_ZEROOUT : 0;
3663 split_flag |= (EXT4_EXT_MARK_UNINIT2 | EXT4_EXT_DATA_VALID2); 3663 split_flag |= (EXT4_EXT_MARK_UNWRIT2 | EXT4_EXT_DATA_VALID2);
3664 } 3664 }
3665 flags |= EXT4_GET_BLOCKS_PRE_IO; 3665 flags |= EXT4_GET_BLOCKS_PRE_IO;
3666 return ext4_split_extent(handle, inode, path, map, split_flag, flags); 3666 return ext4_split_extent(handle, inode, path, map, split_flag, flags);
@@ -3710,8 +3710,8 @@ static int ext4_convert_initialized_extents(handle_t *handle,
3710 err = ext4_ext_get_access(handle, inode, path + depth); 3710 err = ext4_ext_get_access(handle, inode, path + depth);
3711 if (err) 3711 if (err)
3712 goto out; 3712 goto out;
3713 /* first mark the extent as uninitialized */ 3713 /* first mark the extent as unwritten */
3714 ext4_ext_mark_uninitialized(ex); 3714 ext4_ext_mark_unwritten(ex);
3715 3715
3716 /* note: ext4_ext_correct_indexes() isn't needed here because 3716 /* note: ext4_ext_correct_indexes() isn't needed here because
3717 * borders are not changed 3717 * borders are not changed
@@ -3971,10 +3971,10 @@ ext4_ext_convert_initialized_extent(handle_t *handle, struct inode *inode,
3971 3971
3972 /* 3972 /*
3973 * Make sure that the extent is no bigger than we support with 3973 * Make sure that the extent is no bigger than we support with
3974 * uninitialized extent 3974 * unwritten extent
3975 */ 3975 */
3976 if (map->m_len > EXT_UNINIT_MAX_LEN) 3976 if (map->m_len > EXT_UNWRITTEN_MAX_LEN)
3977 map->m_len = EXT_UNINIT_MAX_LEN / 2; 3977 map->m_len = EXT_UNWRITTEN_MAX_LEN / 2;
3978 3978
3979 ret = ext4_convert_initialized_extents(handle, inode, map, 3979 ret = ext4_convert_initialized_extents(handle, inode, map,
3980 path); 3980 path);
@@ -3993,7 +3993,7 @@ ext4_ext_convert_initialized_extent(handle_t *handle, struct inode *inode,
3993} 3993}
3994 3994
3995static int 3995static int
3996ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, 3996ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
3997 struct ext4_map_blocks *map, 3997 struct ext4_map_blocks *map,
3998 struct ext4_ext_path *path, int flags, 3998 struct ext4_ext_path *path, int flags,
3999 unsigned int allocated, ext4_fsblk_t newblock) 3999 unsigned int allocated, ext4_fsblk_t newblock)
@@ -4002,19 +4002,19 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
4002 int err = 0; 4002 int err = 0;
4003 ext4_io_end_t *io = ext4_inode_aio(inode); 4003 ext4_io_end_t *io = ext4_inode_aio(inode);
4004 4004
4005 ext_debug("ext4_ext_handle_uninitialized_extents: inode %lu, logical " 4005 ext_debug("ext4_ext_handle_unwritten_extents: inode %lu, logical "
4006 "block %llu, max_blocks %u, flags %x, allocated %u\n", 4006 "block %llu, max_blocks %u, flags %x, allocated %u\n",
4007 inode->i_ino, (unsigned long long)map->m_lblk, map->m_len, 4007 inode->i_ino, (unsigned long long)map->m_lblk, map->m_len,
4008 flags, allocated); 4008 flags, allocated);
4009 ext4_ext_show_leaf(inode, path); 4009 ext4_ext_show_leaf(inode, path);
4010 4010
4011 /* 4011 /*
4012 * When writing into uninitialized space, we should not fail to 4012 * When writing into unwritten space, we should not fail to
4013 * allocate metadata blocks for the new extent block if needed. 4013 * allocate metadata blocks for the new extent block if needed.
4014 */ 4014 */
4015 flags |= EXT4_GET_BLOCKS_METADATA_NOFAIL; 4015 flags |= EXT4_GET_BLOCKS_METADATA_NOFAIL;
4016 4016
4017 trace_ext4_ext_handle_uninitialized_extents(inode, map, flags, 4017 trace_ext4_ext_handle_unwritten_extents(inode, map, flags,
4018 allocated, newblock); 4018 allocated, newblock);
4019 4019
4020 /* get_block() before submit the IO, split the extent */ 4020 /* get_block() before submit the IO, split the extent */
@@ -4057,7 +4057,7 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
4057 * repeat fallocate creation request 4057 * repeat fallocate creation request
4058 * we already have an unwritten extent 4058 * we already have an unwritten extent
4059 */ 4059 */
4060 if (flags & EXT4_GET_BLOCKS_UNINIT_EXT) { 4060 if (flags & EXT4_GET_BLOCKS_UNWRIT_EXT) {
4061 map->m_flags |= EXT4_MAP_UNWRITTEN; 4061 map->m_flags |= EXT4_MAP_UNWRITTEN;
4062 goto map_out; 4062 goto map_out;
4063 } 4063 }
@@ -4308,7 +4308,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
4308 4308
4309 4309
4310 /* 4310 /*
4311 * Uninitialized extents are treated as holes, except that 4311 * unwritten extents are treated as holes, except that
4312 * we split out initialized portions during a write. 4312 * we split out initialized portions during a write.
4313 */ 4313 */
4314 ee_len = ext4_ext_get_actual_len(ex); 4314 ee_len = ext4_ext_get_actual_len(ex);
@@ -4327,16 +4327,16 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
4327 * If the extent is initialized check whether the 4327 * If the extent is initialized check whether the
4328 * caller wants to convert it to unwritten. 4328 * caller wants to convert it to unwritten.
4329 */ 4329 */
4330 if ((!ext4_ext_is_uninitialized(ex)) && 4330 if ((!ext4_ext_is_unwritten(ex)) &&
4331 (flags & EXT4_GET_BLOCKS_CONVERT_UNWRITTEN)) { 4331 (flags & EXT4_GET_BLOCKS_CONVERT_UNWRITTEN)) {
4332 allocated = ext4_ext_convert_initialized_extent( 4332 allocated = ext4_ext_convert_initialized_extent(
4333 handle, inode, map, path, flags, 4333 handle, inode, map, path, flags,
4334 allocated, newblock); 4334 allocated, newblock);
4335 goto out2; 4335 goto out2;
4336 } else if (!ext4_ext_is_uninitialized(ex)) 4336 } else if (!ext4_ext_is_unwritten(ex))
4337 goto out; 4337 goto out;
4338 4338
4339 ret = ext4_ext_handle_uninitialized_extents( 4339 ret = ext4_ext_handle_unwritten_extents(
4340 handle, inode, map, path, flags, 4340 handle, inode, map, path, flags,
4341 allocated, newblock); 4341 allocated, newblock);
4342 if (ret < 0) 4342 if (ret < 0)
@@ -4408,15 +4408,15 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
4408 /* 4408 /*
4409 * See if request is beyond maximum number of blocks we can have in 4409 * See if request is beyond maximum number of blocks we can have in
4410 * a single extent. For an initialized extent this limit is 4410 * a single extent. For an initialized extent this limit is
4411 * EXT_INIT_MAX_LEN and for an uninitialized extent this limit is 4411 * EXT_INIT_MAX_LEN and for an unwritten extent this limit is
4412 * EXT_UNINIT_MAX_LEN. 4412 * EXT_UNWRITTEN_MAX_LEN.
4413 */ 4413 */
4414 if (map->m_len > EXT_INIT_MAX_LEN && 4414 if (map->m_len > EXT_INIT_MAX_LEN &&
4415 !(flags & EXT4_GET_BLOCKS_UNINIT_EXT)) 4415 !(flags & EXT4_GET_BLOCKS_UNWRIT_EXT))
4416 map->m_len = EXT_INIT_MAX_LEN; 4416 map->m_len = EXT_INIT_MAX_LEN;
4417 else if (map->m_len > EXT_UNINIT_MAX_LEN && 4417 else if (map->m_len > EXT_UNWRITTEN_MAX_LEN &&
4418 (flags & EXT4_GET_BLOCKS_UNINIT_EXT)) 4418 (flags & EXT4_GET_BLOCKS_UNWRIT_EXT))
4419 map->m_len = EXT_UNINIT_MAX_LEN; 4419 map->m_len = EXT_UNWRITTEN_MAX_LEN;
4420 4420
4421 /* Check if we can really insert (m_lblk)::(m_lblk + m_len) extent */ 4421 /* Check if we can really insert (m_lblk)::(m_lblk + m_len) extent */
4422 newex.ee_len = cpu_to_le16(map->m_len); 4422 newex.ee_len = cpu_to_le16(map->m_len);
@@ -4464,13 +4464,13 @@ got_allocated_blocks:
4464 /* try to insert new extent into found leaf and return */ 4464 /* try to insert new extent into found leaf and return */
4465 ext4_ext_store_pblock(&newex, newblock + offset); 4465 ext4_ext_store_pblock(&newex, newblock + offset);
4466 newex.ee_len = cpu_to_le16(ar.len); 4466 newex.ee_len = cpu_to_le16(ar.len);
4467 /* Mark uninitialized */ 4467 /* Mark unwritten */
4468 if (flags & EXT4_GET_BLOCKS_UNINIT_EXT){ 4468 if (flags & EXT4_GET_BLOCKS_UNWRIT_EXT){
4469 ext4_ext_mark_uninitialized(&newex); 4469 ext4_ext_mark_unwritten(&newex);
4470 map->m_flags |= EXT4_MAP_UNWRITTEN; 4470 map->m_flags |= EXT4_MAP_UNWRITTEN;
4471 /* 4471 /*
4472 * io_end structure was created for every IO write to an 4472 * io_end structure was created for every IO write to an
4473 * uninitialized extent. To avoid unnecessary conversion, 4473 * unwritten extent. To avoid unnecessary conversion,
4474 * here we flag the IO that really needs the conversion. 4474 * here we flag the IO that really needs the conversion.
4475 * For non asycn direct IO case, flag the inode state 4475 * For non asycn direct IO case, flag the inode state
4476 * that we need to perform conversion when IO is done. 4476 * that we need to perform conversion when IO is done.
@@ -4603,9 +4603,9 @@ got_allocated_blocks:
4603 4603
4604 /* 4604 /*
4605 * Cache the extent and update transaction to commit on fdatasync only 4605 * Cache the extent and update transaction to commit on fdatasync only
4606 * when it is _not_ an uninitialized extent. 4606 * when it is _not_ an unwritten extent.
4607 */ 4607 */
4608 if ((flags & EXT4_GET_BLOCKS_UNINIT_EXT) == 0) 4608 if ((flags & EXT4_GET_BLOCKS_UNWRIT_EXT) == 0)
4609 ext4_update_inode_fsync_trans(handle, inode, 1); 4609 ext4_update_inode_fsync_trans(handle, inode, 1);
4610 else 4610 else
4611 ext4_update_inode_fsync_trans(handle, inode, 0); 4611 ext4_update_inode_fsync_trans(handle, inode, 0);
@@ -4679,7 +4679,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
4679 * that it doesn't get unnecessarily split into multiple 4679 * that it doesn't get unnecessarily split into multiple
4680 * extents. 4680 * extents.
4681 */ 4681 */
4682 if (len <= EXT_UNINIT_MAX_LEN) 4682 if (len <= EXT_UNWRITTEN_MAX_LEN)
4683 flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; 4683 flags |= EXT4_GET_BLOCKS_NO_NORMALIZE;
4684 4684
4685 /* 4685 /*
@@ -4771,7 +4771,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
4771 else 4771 else
4772 max_blocks -= lblk; 4772 max_blocks -= lblk;
4773 4773
4774 flags = EXT4_GET_BLOCKS_CREATE_UNINIT_EXT | 4774 flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
4775 EXT4_GET_BLOCKS_CONVERT_UNWRITTEN; 4775 EXT4_GET_BLOCKS_CONVERT_UNWRITTEN;
4776 if (mode & FALLOC_FL_KEEP_SIZE) 4776 if (mode & FALLOC_FL_KEEP_SIZE)
4777 flags |= EXT4_GET_BLOCKS_KEEP_SIZE; 4777 flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
@@ -4914,7 +4914,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
4914 max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) 4914 max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits)
4915 - lblk; 4915 - lblk;
4916 4916
4917 flags = EXT4_GET_BLOCKS_CREATE_UNINIT_EXT; 4917 flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT;
4918 if (mode & FALLOC_FL_KEEP_SIZE) 4918 if (mode & FALLOC_FL_KEEP_SIZE)
4919 flags |= EXT4_GET_BLOCKS_KEEP_SIZE; 4919 flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
4920 4920
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 0ebc21204b51..98c90f5834ee 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -433,7 +433,7 @@ static void ext4_es_insert_extent_ext_check(struct inode *inode,
433 ee_start = ext4_ext_pblock(ex); 433 ee_start = ext4_ext_pblock(ex);
434 ee_len = ext4_ext_get_actual_len(ex); 434 ee_len = ext4_ext_get_actual_len(ex);
435 435
436 ee_status = ext4_ext_is_uninitialized(ex) ? 1 : 0; 436 ee_status = ext4_ext_is_unwritten(ex) ? 1 : 0;
437 es_status = ext4_es_is_unwritten(es) ? 1 : 0; 437 es_status = ext4_es_is_unwritten(es) ? 1 : 0;
438 438
439 /* 439 /*
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 063fc1538355..bf0e772b6a03 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -136,7 +136,7 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
136 /* 136 /*
137 * 'err==len' means that all of blocks has been preallocated no 137 * 'err==len' means that all of blocks has been preallocated no
138 * matter they are initialized or not. For excluding 138 * matter they are initialized or not. For excluding
139 * uninitialized extents, we need to check m_flags. There are 139 * unwritten extents, we need to check m_flags. There are
140 * two conditions that indicate for initialized extents. 140 * two conditions that indicate for initialized extents.
141 * 1) If we hit extent cache, EXT4_MAP_MAPPED flag is returned; 141 * 1) If we hit extent cache, EXT4_MAP_MAPPED flag is returned;
142 * 2) If we do a real lookup, non-flags are returned. 142 * 2) If we do a real lookup, non-flags are returned.
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 297465e07d44..7dfbcbba67d5 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -489,8 +489,8 @@ static void ext4_map_blocks_es_recheck(handle_t *handle,
489 * Otherwise, call with ext4_ind_map_blocks() to handle indirect mapping 489 * Otherwise, call with ext4_ind_map_blocks() to handle indirect mapping
490 * based files 490 * based files
491 * 491 *
492 * On success, it returns the number of blocks being mapped or allocate. 492 * On success, it returns the number of blocks being mapped or allocated.
493 * if create==0 and the blocks are pre-allocated and uninitialized block, 493 * if create==0 and the blocks are pre-allocated and unwritten block,
494 * the result buffer head is unmapped. If the create ==1, it will make sure 494 * the result buffer head is unmapped. If the create ==1, it will make sure
495 * the buffer head is mapped. 495 * the buffer head is mapped.
496 * 496 *
@@ -622,7 +622,7 @@ found:
622 map->m_flags &= ~EXT4_MAP_FLAGS; 622 map->m_flags &= ~EXT4_MAP_FLAGS;
623 623
624 /* 624 /*
625 * New blocks allocate and/or writing to uninitialized extent 625 * New blocks allocate and/or writing to unwritten extent
626 * will possibly result in updating i_data, so we take 626 * will possibly result in updating i_data, so we take
627 * the write lock of i_data_sem, and call get_blocks() 627 * the write lock of i_data_sem, and call get_blocks()
628 * with create == 1 flag. 628 * with create == 1 flag.
@@ -2032,7 +2032,7 @@ static int mpage_process_page_bufs(struct mpage_da_data *mpd,
2032 * Scan buffers corresponding to changed extent (we expect corresponding pages 2032 * Scan buffers corresponding to changed extent (we expect corresponding pages
2033 * to be already locked) and update buffer state according to new extent state. 2033 * to be already locked) and update buffer state according to new extent state.
2034 * We map delalloc buffers to their physical location, clear unwritten bits, 2034 * We map delalloc buffers to their physical location, clear unwritten bits,
2035 * and mark buffers as uninit when we perform writes to uninitialized extents 2035 * and mark buffers as uninit when we perform writes to unwritten extents
2036 * and do extent conversion after IO is finished. If the last page is not fully 2036 * and do extent conversion after IO is finished. If the last page is not fully
2037 * mapped, we update @map to the next extent in the last page that needs 2037 * mapped, we update @map to the next extent in the last page that needs
2038 * mapping. Otherwise we submit the page for IO. 2038 * mapping. Otherwise we submit the page for IO.
@@ -2131,7 +2131,7 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
2131 trace_ext4_da_write_pages_extent(inode, map); 2131 trace_ext4_da_write_pages_extent(inode, map);
2132 /* 2132 /*
2133 * Call ext4_map_blocks() to allocate any delayed allocation blocks, or 2133 * Call ext4_map_blocks() to allocate any delayed allocation blocks, or
2134 * to convert an uninitialized extent to be initialized (in the case 2134 * to convert an unwritten extent to be initialized (in the case
2135 * where we have written into one or more preallocated blocks). It is 2135 * where we have written into one or more preallocated blocks). It is
2136 * possible that we're going to need more metadata blocks than 2136 * possible that we're going to need more metadata blocks than
2137 * previously reserved. However we must not fail because we're in 2137 * previously reserved. However we must not fail because we're in
@@ -3071,9 +3071,9 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
3071 * preallocated extents, and those write extend the file, no need to 3071 * preallocated extents, and those write extend the file, no need to
3072 * fall back to buffered IO. 3072 * fall back to buffered IO.
3073 * 3073 *
3074 * For holes, we fallocate those blocks, mark them as uninitialized 3074 * For holes, we fallocate those blocks, mark them as unwritten
3075 * If those blocks were preallocated, we mark sure they are split, but 3075 * If those blocks were preallocated, we mark sure they are split, but
3076 * still keep the range to write as uninitialized. 3076 * still keep the range to write as unwritten.
3077 * 3077 *
3078 * The unwritten extents will be converted to written when DIO is completed. 3078 * The unwritten extents will be converted to written when DIO is completed.
3079 * For async direct IO, since the IO may still pending when return, we 3079 * For async direct IO, since the IO may still pending when return, we
@@ -3125,12 +3125,12 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
3125 * We could direct write to holes and fallocate. 3125 * We could direct write to holes and fallocate.
3126 * 3126 *
3127 * Allocated blocks to fill the hole are marked as 3127 * Allocated blocks to fill the hole are marked as
3128 * uninitialized to prevent parallel buffered read to expose 3128 * unwritten to prevent parallel buffered read to expose
3129 * the stale data before DIO complete the data IO. 3129 * the stale data before DIO complete the data IO.
3130 * 3130 *
3131 * As to previously fallocated extents, ext4 get_block will 3131 * As to previously fallocated extents, ext4 get_block will
3132 * just simply mark the buffer mapped but still keep the 3132 * just simply mark the buffer mapped but still keep the
3133 * extents uninitialized. 3133 * extents unwritten.
3134 * 3134 *
3135 * For non AIO case, we will convert those unwritten extents 3135 * For non AIO case, we will convert those unwritten extents
3136 * to written after return back from blockdev_direct_IO. 3136 * to written after return back from blockdev_direct_IO.
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 58ee7dc87669..1b809fe51da1 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -57,8 +57,8 @@ get_ext_path(struct inode *inode, ext4_lblk_t lblock,
57static void 57static void
58copy_extent_status(struct ext4_extent *src, struct ext4_extent *dest) 58copy_extent_status(struct ext4_extent *src, struct ext4_extent *dest)
59{ 59{
60 if (ext4_ext_is_uninitialized(src)) 60 if (ext4_ext_is_unwritten(src))
61 ext4_ext_mark_uninitialized(dest); 61 ext4_ext_mark_unwritten(dest);
62 else 62 else
63 dest->ee_len = cpu_to_le16(ext4_ext_get_actual_len(dest)); 63 dest->ee_len = cpu_to_le16(ext4_ext_get_actual_len(dest));
64} 64}
@@ -593,14 +593,14 @@ mext_calc_swap_extents(struct ext4_extent *tmp_dext,
593 * @inode: inode in question 593 * @inode: inode in question
594 * @from: block offset of inode 594 * @from: block offset of inode
595 * @count: block count to be checked 595 * @count: block count to be checked
596 * @uninit: extents expected to be uninitialized 596 * @unwritten: extents expected to be unwritten
597 * @err: pointer to save error value 597 * @err: pointer to save error value
598 * 598 *
599 * Return 1 if all extents in range has expected type, and zero otherwise. 599 * Return 1 if all extents in range has expected type, and zero otherwise.
600 */ 600 */
601static int 601static int
602mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count, 602mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count,
603 int uninit, int *err) 603 int unwritten, int *err)
604{ 604{
605 struct ext4_ext_path *path = NULL; 605 struct ext4_ext_path *path = NULL;
606 struct ext4_extent *ext; 606 struct ext4_extent *ext;
@@ -611,7 +611,7 @@ mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count,
611 if (*err) 611 if (*err)
612 goto out; 612 goto out;
613 ext = path[ext_depth(inode)].p_ext; 613 ext = path[ext_depth(inode)].p_ext;
614 if (uninit != ext4_ext_is_uninitialized(ext)) 614 if (unwritten != ext4_ext_is_unwritten(ext))
615 goto out; 615 goto out;
616 from += ext4_ext_get_actual_len(ext); 616 from += ext4_ext_get_actual_len(ext);
617 ext4_ext_drop_refs(path); 617 ext4_ext_drop_refs(path);
@@ -894,7 +894,7 @@ out:
894 * @orig_page_offset: page index on original file 894 * @orig_page_offset: page index on original file
895 * @data_offset_in_page: block index where data swapping starts 895 * @data_offset_in_page: block index where data swapping starts
896 * @block_len_in_page: the number of blocks to be swapped 896 * @block_len_in_page: the number of blocks to be swapped
897 * @uninit: orig extent is uninitialized or not 897 * @unwritten: orig extent is unwritten or not
898 * @err: pointer to save return value 898 * @err: pointer to save return value
899 * 899 *
900 * Save the data in original inode blocks and replace original inode extents 900 * Save the data in original inode blocks and replace original inode extents
@@ -905,7 +905,7 @@ out:
905static int 905static int
906move_extent_per_page(struct file *o_filp, struct inode *donor_inode, 906move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
907 pgoff_t orig_page_offset, int data_offset_in_page, 907 pgoff_t orig_page_offset, int data_offset_in_page,
908 int block_len_in_page, int uninit, int *err) 908 int block_len_in_page, int unwritten, int *err)
909{ 909{
910 struct inode *orig_inode = file_inode(o_filp); 910 struct inode *orig_inode = file_inode(o_filp);
911 struct page *pagep[2] = {NULL, NULL}; 911 struct page *pagep[2] = {NULL, NULL};
@@ -962,27 +962,27 @@ again:
962 if (unlikely(*err < 0)) 962 if (unlikely(*err < 0))
963 goto stop_journal; 963 goto stop_journal;
964 /* 964 /*
965 * If orig extent was uninitialized it can become initialized 965 * If orig extent was unwritten it can become initialized
966 * at any time after i_data_sem was dropped, in order to 966 * at any time after i_data_sem was dropped, in order to
967 * serialize with delalloc we have recheck extent while we 967 * serialize with delalloc we have recheck extent while we
968 * hold page's lock, if it is still the case data copy is not 968 * hold page's lock, if it is still the case data copy is not
969 * necessary, just swap data blocks between orig and donor. 969 * necessary, just swap data blocks between orig and donor.
970 */ 970 */
971 if (uninit) { 971 if (unwritten) {
972 ext4_double_down_write_data_sem(orig_inode, donor_inode); 972 ext4_double_down_write_data_sem(orig_inode, donor_inode);
973 /* If any of extents in range became initialized we have to 973 /* If any of extents in range became initialized we have to
974 * fallback to data copying */ 974 * fallback to data copying */
975 uninit = mext_check_coverage(orig_inode, orig_blk_offset, 975 unwritten = mext_check_coverage(orig_inode, orig_blk_offset,
976 block_len_in_page, 1, err); 976 block_len_in_page, 1, err);
977 if (*err) 977 if (*err)
978 goto drop_data_sem; 978 goto drop_data_sem;
979 979
980 uninit &= mext_check_coverage(donor_inode, orig_blk_offset, 980 unwritten &= mext_check_coverage(donor_inode, orig_blk_offset,
981 block_len_in_page, 1, err); 981 block_len_in_page, 1, err);
982 if (*err) 982 if (*err)
983 goto drop_data_sem; 983 goto drop_data_sem;
984 984
985 if (!uninit) { 985 if (!unwritten) {
986 ext4_double_up_write_data_sem(orig_inode, donor_inode); 986 ext4_double_up_write_data_sem(orig_inode, donor_inode);
987 goto data_copy; 987 goto data_copy;
988 } 988 }
@@ -1259,7 +1259,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1259 int blocks_per_page = PAGE_CACHE_SIZE >> orig_inode->i_blkbits; 1259 int blocks_per_page = PAGE_CACHE_SIZE >> orig_inode->i_blkbits;
1260 int data_offset_in_page; 1260 int data_offset_in_page;
1261 int block_len_in_page; 1261 int block_len_in_page;
1262 int uninit; 1262 int unwritten;
1263 1263
1264 if (orig_inode->i_sb != donor_inode->i_sb) { 1264 if (orig_inode->i_sb != donor_inode->i_sb) {
1265 ext4_debug("ext4 move extent: The argument files " 1265 ext4_debug("ext4 move extent: The argument files "
@@ -1391,8 +1391,8 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1391 !last_extent) 1391 !last_extent)
1392 continue; 1392 continue;
1393 1393
1394 /* Is original extent is uninitialized */ 1394 /* Is original extent is unwritten */
1395 uninit = ext4_ext_is_uninitialized(ext_prev); 1395 unwritten = ext4_ext_is_unwritten(ext_prev);
1396 1396
1397 data_offset_in_page = seq_start % blocks_per_page; 1397 data_offset_in_page = seq_start % blocks_per_page;
1398 1398
@@ -1432,8 +1432,8 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1432 o_filp, donor_inode, 1432 o_filp, donor_inode,
1433 orig_page_offset, 1433 orig_page_offset,
1434 data_offset_in_page, 1434 data_offset_in_page,
1435 block_len_in_page, uninit, 1435 block_len_in_page,
1436 &ret); 1436 unwritten, &ret);
1437 1437
1438 /* Count how many blocks we have exchanged */ 1438 /* Count how many blocks we have exchanged */
1439 *moved_len += block_len_in_page; 1439 *moved_len += block_len_in_page;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6f9e6fadac04..c4895c195e00 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3337,7 +3337,7 @@ static ext4_fsblk_t ext4_calculate_resv_clusters(struct super_block *sb)
3337 * By default we reserve 2% or 4096 clusters, whichever is smaller. 3337 * By default we reserve 2% or 4096 clusters, whichever is smaller.
3338 * This should cover the situations where we can not afford to run 3338 * This should cover the situations where we can not afford to run
3339 * out of space like for example punch hole, or converting 3339 * out of space like for example punch hole, or converting
3340 * uninitialized extents in delalloc path. In most cases such 3340 * unwritten extents in delalloc path. In most cases such
3341 * allocation would require 1, or 2 blocks, higher numbers are 3341 * allocation would require 1, or 2 blocks, higher numbers are
3342 * very rare. 3342 * very rare.
3343 */ 3343 */
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 9995d3b588a8..d4f70a7fe876 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -36,7 +36,7 @@ struct extent_status;
36 36
37#define show_map_flags(flags) __print_flags(flags, "|", \ 37#define show_map_flags(flags) __print_flags(flags, "|", \
38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \ 38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \
39 { EXT4_GET_BLOCKS_UNINIT_EXT, "UNINIT" }, \ 39 { EXT4_GET_BLOCKS_UNWRIT_EXT, "UNWRIT" }, \
40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \ 40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \
41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \ 41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \
42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \ 42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \
@@ -1496,7 +1496,7 @@ DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1496 TP_ARGS(inode) 1496 TP_ARGS(inode)
1497); 1497);
1498 1498
1499/* 'ux' is the uninitialized extent. */ 1499/* 'ux' is the unwritten extent. */
1500TRACE_EVENT(ext4_ext_convert_to_initialized_enter, 1500TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1501 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, 1501 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1502 struct ext4_extent *ux), 1502 struct ext4_extent *ux),
@@ -1532,7 +1532,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1532); 1532);
1533 1533
1534/* 1534/*
1535 * 'ux' is the uninitialized extent. 1535 * 'ux' is the unwritten extent.
1536 * 'ix' is the initialized extent to which blocks are transferred. 1536 * 'ix' is the initialized extent to which blocks are transferred.
1537 */ 1537 */
1538TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath, 1538TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
@@ -1810,7 +1810,7 @@ DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1810 TP_ARGS(sb, group, start, len) 1810 TP_ARGS(sb, group, start, len)
1811); 1811);
1812 1812
1813TRACE_EVENT(ext4_ext_handle_uninitialized_extents, 1813TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1814 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags, 1814 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1815 unsigned int allocated, ext4_fsblk_t newblock), 1815 unsigned int allocated, ext4_fsblk_t newblock),
1816 1816