diff options
author | Jan Kara <jack@suse.cz> | 2014-01-06 14:02:23 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-01-06 14:02:23 -0500 |
commit | bc0ca9df3b2abb13f7da9d8d255ec60718badd84 (patch) | |
tree | 4df0011c79c82f50c057109d38828cdf61527c15 /fs/ext4 | |
parent | 9cb00419faa7dd81e921328a71931d2b95ed5876 (diff) | |
download | lwn-bc0ca9df3b2abb13f7da9d8d255ec60718badd84.tar.gz lwn-bc0ca9df3b2abb13f7da9d8d255ec60718badd84.zip |
ext4: retry allocation when inline->extent conversion failed
Similarly as other ->write_begin functions in ext4, also
ext4_da_write_inline_data_begin() should retry allocation if the
conversion failed because of ENOSPC. This avoids returning ENOSPC
prematurely because of uncommitted block deletions.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inline.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index bae987549dc3..ed6e71fe5e9d 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -849,11 +849,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, handle_t *handle; struct page *page; struct ext4_iloc iloc; + int retries; ret = ext4_get_inode_loc(inode, &iloc); if (ret) return ret; +retry_journal: handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); if (IS_ERR(handle)) { ret = PTR_ERR(handle); @@ -875,6 +877,11 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, inode, flags, fsdata); + ext4_journal_stop(handle); + handle = NULL; + if (ret == -ENOSPC && + ext4_should_retry_alloc(inode->i_sb, &retries)) + goto retry_journal; goto out; } |