diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-11-07 22:22:08 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-11-07 22:22:08 -0500 |
commit | f2754114400afe38ad5ade3b588451c4f36a61af (patch) | |
tree | ac19f3d62c4d167eefc58392fb6a313cb377296a | |
parent | da0169b3b9a460ecbb571dad6123fe3735b148d1 (diff) |
ext4: remove unreachable code after ext4_can_extents_be_merged()
Commit ec22ba8e ("ext4: disable merging of uninitialized extents")
ensured that if either extent under consideration is uninit, we
decline to merge, and ext4_can_extents_be_merged() returns false.
So there is no need for the caller to then test whether the
extent under consideration is unitialized; if it were, we
wouldn't have gotten that far.
The comments were also inaccurate; ext4_can_extents_be_merged()
no longer XORs the states, it fails if *either* is uninit.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
-rw-r--r-- | fs/ext4/extents.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index de6d4674ba6e..35f65cf4f318 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -1715,7 +1715,6 @@ static int ext4_ext_try_to_merge_right(struct inode *inode, | |||
1715 | struct ext4_extent_header *eh; | 1715 | struct ext4_extent_header *eh; |
1716 | unsigned int depth, len; | 1716 | unsigned int depth, len; |
1717 | int merge_done = 0; | 1717 | int merge_done = 0; |
1718 | int uninitialized = 0; | ||
1719 | 1718 | ||
1720 | depth = ext_depth(inode); | 1719 | depth = ext_depth(inode); |
1721 | BUG_ON(path[depth].p_hdr == NULL); | 1720 | BUG_ON(path[depth].p_hdr == NULL); |
@@ -1725,12 +1724,8 @@ static int ext4_ext_try_to_merge_right(struct inode *inode, | |||
1725 | if (!ext4_can_extents_be_merged(inode, ex, ex + 1)) | 1724 | if (!ext4_can_extents_be_merged(inode, ex, ex + 1)) |
1726 | break; | 1725 | break; |
1727 | /* merge with next extent! */ | 1726 | /* merge with next extent! */ |
1728 | if (ext4_ext_is_uninitialized(ex)) | ||
1729 | uninitialized = 1; | ||
1730 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) | 1727 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
1731 | + ext4_ext_get_actual_len(ex + 1)); | 1728 | + ext4_ext_get_actual_len(ex + 1)); |
1732 | if (uninitialized) | ||
1733 | ext4_ext_mark_uninitialized(ex); | ||
1734 | 1729 | ||
1735 | if (ex + 1 < EXT_LAST_EXTENT(eh)) { | 1730 | if (ex + 1 < EXT_LAST_EXTENT(eh)) { |
1736 | len = (EXT_LAST_EXTENT(eh) - ex - 1) | 1731 | len = (EXT_LAST_EXTENT(eh) - ex - 1) |
@@ -1885,7 +1880,6 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode, | |||
1885 | struct ext4_ext_path *npath = NULL; | 1880 | struct ext4_ext_path *npath = NULL; |
1886 | int depth, len, err; | 1881 | int depth, len, err; |
1887 | ext4_lblk_t next; | 1882 | ext4_lblk_t next; |
1888 | unsigned uninitialized = 0; | ||
1889 | int mb_flags = 0; | 1883 | int mb_flags = 0; |
1890 | 1884 | ||
1891 | if (unlikely(ext4_ext_get_actual_len(newext) == 0)) { | 1885 | if (unlikely(ext4_ext_get_actual_len(newext) == 0)) { |
@@ -1937,18 +1931,8 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode, | |||
1937 | if (err) | 1931 | if (err) |
1938 | return err; | 1932 | return err; |
1939 | 1933 | ||
1940 | /* | ||
1941 | * ext4_can_extents_be_merged should have checked | ||
1942 | * that either both extents are uninitialized, or | ||
1943 | * both aren't. Thus we need to check only one of | ||
1944 | * them here. | ||
1945 | */ | ||
1946 | if (ext4_ext_is_uninitialized(ex)) | ||
1947 | uninitialized = 1; | ||
1948 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) | 1934 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
1949 | + ext4_ext_get_actual_len(newext)); | 1935 | + ext4_ext_get_actual_len(newext)); |
1950 | if (uninitialized) | ||
1951 | ext4_ext_mark_uninitialized(ex); | ||
1952 | eh = path[depth].p_hdr; | 1936 | eh = path[depth].p_hdr; |
1953 | nearex = ex; | 1937 | nearex = ex; |
1954 | goto merge; | 1938 | goto merge; |
@@ -1971,20 +1955,10 @@ prepend: | |||
1971 | if (err) | 1955 | if (err) |
1972 | return err; | 1956 | return err; |
1973 | 1957 | ||
1974 | /* | ||
1975 | * ext4_can_extents_be_merged should have checked | ||
1976 | * that either both extents are uninitialized, or | ||
1977 | * both aren't. Thus we need to check only one of | ||
1978 | * them here. | ||
1979 | */ | ||
1980 | if (ext4_ext_is_uninitialized(ex)) | ||
1981 | uninitialized = 1; | ||
1982 | ex->ee_block = newext->ee_block; | 1958 | ex->ee_block = newext->ee_block; |
1983 | ext4_ext_store_pblock(ex, ext4_ext_pblock(newext)); | 1959 | ext4_ext_store_pblock(ex, ext4_ext_pblock(newext)); |
1984 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) | 1960 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
1985 | + ext4_ext_get_actual_len(newext)); | 1961 | + ext4_ext_get_actual_len(newext)); |
1986 | if (uninitialized) | ||
1987 | ext4_ext_mark_uninitialized(ex); | ||
1988 | eh = path[depth].p_hdr; | 1962 | eh = path[depth].p_hdr; |
1989 | nearex = ex; | 1963 | nearex = ex; |
1990 | goto merge; | 1964 | goto merge; |