diff options
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r-- | fs/ext4/inline.c | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 285ed1588730..e55a8bc870bd 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
@@ -437,6 +437,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle, | |||
437 | 437 | ||
438 | memset((void *)ext4_raw_inode(&is.iloc)->i_block, | 438 | memset((void *)ext4_raw_inode(&is.iloc)->i_block, |
439 | 0, EXT4_MIN_INLINE_DATA_SIZE); | 439 | 0, EXT4_MIN_INLINE_DATA_SIZE); |
440 | memset(ei->i_data, 0, EXT4_MIN_INLINE_DATA_SIZE); | ||
440 | 441 | ||
441 | if (ext4_has_feature_extents(inode->i_sb)) { | 442 | if (ext4_has_feature_extents(inode->i_sb)) { |
442 | if (S_ISDIR(inode->i_mode) || | 443 | if (S_ISDIR(inode->i_mode) || |
@@ -886,11 +887,11 @@ retry_journal: | |||
886 | flags |= AOP_FLAG_NOFS; | 887 | flags |= AOP_FLAG_NOFS; |
887 | 888 | ||
888 | if (ret == -ENOSPC) { | 889 | if (ret == -ENOSPC) { |
890 | ext4_journal_stop(handle); | ||
889 | ret = ext4_da_convert_inline_data_to_extent(mapping, | 891 | ret = ext4_da_convert_inline_data_to_extent(mapping, |
890 | inode, | 892 | inode, |
891 | flags, | 893 | flags, |
892 | fsdata); | 894 | fsdata); |
893 | ext4_journal_stop(handle); | ||
894 | if (ret == -ENOSPC && | 895 | if (ret == -ENOSPC && |
895 | ext4_should_retry_alloc(inode->i_sb, &retries)) | 896 | ext4_should_retry_alloc(inode->i_sb, &retries)) |
896 | goto retry_journal; | 897 | goto retry_journal; |
@@ -1890,42 +1891,6 @@ out: | |||
1890 | return (error < 0 ? error : 0); | 1891 | return (error < 0 ? error : 0); |
1891 | } | 1892 | } |
1892 | 1893 | ||
1893 | /* | ||
1894 | * Called during xattr set, and if we can sparse space 'needed', | ||
1895 | * just create the extent tree evict the data to the outer block. | ||
1896 | * | ||
1897 | * We use jbd2 instead of page cache to move data to the 1st block | ||
1898 | * so that the whole transaction can be committed as a whole and | ||
1899 | * the data isn't lost because of the delayed page cache write. | ||
1900 | */ | ||
1901 | int ext4_try_to_evict_inline_data(handle_t *handle, | ||
1902 | struct inode *inode, | ||
1903 | int needed) | ||
1904 | { | ||
1905 | int error; | ||
1906 | struct ext4_xattr_entry *entry; | ||
1907 | struct ext4_inode *raw_inode; | ||
1908 | struct ext4_iloc iloc; | ||
1909 | |||
1910 | error = ext4_get_inode_loc(inode, &iloc); | ||
1911 | if (error) | ||
1912 | return error; | ||
1913 | |||
1914 | raw_inode = ext4_raw_inode(&iloc); | ||
1915 | entry = (struct ext4_xattr_entry *)((void *)raw_inode + | ||
1916 | EXT4_I(inode)->i_inline_off); | ||
1917 | if (EXT4_XATTR_LEN(entry->e_name_len) + | ||
1918 | EXT4_XATTR_SIZE(le32_to_cpu(entry->e_value_size)) < needed) { | ||
1919 | error = -ENOSPC; | ||
1920 | goto out; | ||
1921 | } | ||
1922 | |||
1923 | error = ext4_convert_inline_data_nolock(handle, inode, &iloc); | ||
1924 | out: | ||
1925 | brelse(iloc.bh); | ||
1926 | return error; | ||
1927 | } | ||
1928 | |||
1929 | int ext4_inline_data_truncate(struct inode *inode, int *has_inline) | 1894 | int ext4_inline_data_truncate(struct inode *inode, int *has_inline) |
1930 | { | 1895 | { |
1931 | handle_t *handle; | 1896 | handle_t *handle; |