Commit f2754114400afe38ad5ade3b588451c4f36a61af
Committed by
Theodore Ts'o
1 parent
da0169b3b9
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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>
Showing 1 changed file with 0 additions and 26 deletions Side-by-side Diff
fs/ext4/extents.c
... | ... | @@ -1715,7 +1715,6 @@ |
1715 | 1715 | struct ext4_extent_header *eh; |
1716 | 1716 | unsigned int depth, len; |
1717 | 1717 | int merge_done = 0; |
1718 | - int uninitialized = 0; | |
1719 | 1718 | |
1720 | 1719 | depth = ext_depth(inode); |
1721 | 1720 | BUG_ON(path[depth].p_hdr == NULL); |
1722 | 1721 | |
... | ... | @@ -1725,12 +1724,8 @@ |
1725 | 1724 | if (!ext4_can_extents_be_merged(inode, ex, ex + 1)) |
1726 | 1725 | break; |
1727 | 1726 | /* merge with next extent! */ |
1728 | - if (ext4_ext_is_uninitialized(ex)) | |
1729 | - uninitialized = 1; | |
1730 | 1727 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
1731 | 1728 | + ext4_ext_get_actual_len(ex + 1)); |
1732 | - if (uninitialized) | |
1733 | - ext4_ext_mark_uninitialized(ex); | |
1734 | 1729 | |
1735 | 1730 | if (ex + 1 < EXT_LAST_EXTENT(eh)) { |
1736 | 1731 | len = (EXT_LAST_EXTENT(eh) - ex - 1) |
... | ... | @@ -1885,7 +1880,6 @@ |
1885 | 1880 | struct ext4_ext_path *npath = NULL; |
1886 | 1881 | int depth, len, err; |
1887 | 1882 | ext4_lblk_t next; |
1888 | - unsigned uninitialized = 0; | |
1889 | 1883 | int mb_flags = 0; |
1890 | 1884 | |
1891 | 1885 | if (unlikely(ext4_ext_get_actual_len(newext) == 0)) { |
1892 | 1886 | |
... | ... | @@ -1937,18 +1931,8 @@ |
1937 | 1931 | if (err) |
1938 | 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 | 1934 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
1949 | 1935 | + ext4_ext_get_actual_len(newext)); |
1950 | - if (uninitialized) | |
1951 | - ext4_ext_mark_uninitialized(ex); | |
1952 | 1936 | eh = path[depth].p_hdr; |
1953 | 1937 | nearex = ex; |
1954 | 1938 | goto merge; |
1955 | 1939 | |
... | ... | @@ -1971,20 +1955,10 @@ |
1971 | 1955 | if (err) |
1972 | 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 | 1958 | ex->ee_block = newext->ee_block; |
1983 | 1959 | ext4_ext_store_pblock(ex, ext4_ext_pblock(newext)); |
1984 | 1960 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
1985 | 1961 | + ext4_ext_get_actual_len(newext)); |
1986 | - if (uninitialized) | |
1987 | - ext4_ext_mark_uninitialized(ex); | |
1988 | 1962 | eh = path[depth].p_hdr; |
1989 | 1963 | nearex = ex; |
1990 | 1964 | goto merge; |