ext4: standardize error handling in ext4_da_write_inline_data_begin()
The function has a bit non-standard (for ext4) error recovery in that it used a mix of 'out' labels and testing for 'handle' being NULL. There isn't a good reason for that in the function so clean it up a bit. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
bc0ca9df3b
commit
52e4477758
1 changed files with 4 additions and 7 deletions
|
@ -859,7 +859,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
|
||||||
handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
|
handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
|
||||||
if (IS_ERR(handle)) {
|
if (IS_ERR(handle)) {
|
||||||
ret = PTR_ERR(handle);
|
ret = PTR_ERR(handle);
|
||||||
handle = NULL;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,7 +868,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
|
||||||
if (inline_size >= pos + len) {
|
if (inline_size >= pos + len) {
|
||||||
ret = ext4_prepare_inline_data(handle, inode, pos + len);
|
ret = ext4_prepare_inline_data(handle, inode, pos + len);
|
||||||
if (ret && ret != -ENOSPC)
|
if (ret && ret != -ENOSPC)
|
||||||
goto out;
|
goto out_journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -ENOSPC) {
|
if (ret == -ENOSPC) {
|
||||||
|
@ -878,7 +877,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
|
||||||
flags,
|
flags,
|
||||||
fsdata);
|
fsdata);
|
||||||
ext4_journal_stop(handle);
|
ext4_journal_stop(handle);
|
||||||
handle = NULL;
|
|
||||||
if (ret == -ENOSPC &&
|
if (ret == -ENOSPC &&
|
||||||
ext4_should_retry_alloc(inode->i_sb, &retries))
|
ext4_should_retry_alloc(inode->i_sb, &retries))
|
||||||
goto retry_journal;
|
goto retry_journal;
|
||||||
|
@ -894,7 +892,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
|
||||||
page = grab_cache_page_write_begin(mapping, 0, flags);
|
page = grab_cache_page_write_begin(mapping, 0, flags);
|
||||||
if (!page) {
|
if (!page) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out;
|
goto out_journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
down_read(&EXT4_I(inode)->xattr_sem);
|
down_read(&EXT4_I(inode)->xattr_sem);
|
||||||
|
@ -911,16 +909,15 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
|
||||||
|
|
||||||
up_read(&EXT4_I(inode)->xattr_sem);
|
up_read(&EXT4_I(inode)->xattr_sem);
|
||||||
*pagep = page;
|
*pagep = page;
|
||||||
handle = NULL;
|
|
||||||
brelse(iloc.bh);
|
brelse(iloc.bh);
|
||||||
return 1;
|
return 1;
|
||||||
out_release_page:
|
out_release_page:
|
||||||
up_read(&EXT4_I(inode)->xattr_sem);
|
up_read(&EXT4_I(inode)->xattr_sem);
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
page_cache_release(page);
|
page_cache_release(page);
|
||||||
|
out_journal:
|
||||||
|
ext4_journal_stop(handle);
|
||||||
out:
|
out:
|
||||||
if (handle)
|
|
||||||
ext4_journal_stop(handle);
|
|
||||||
brelse(iloc.bh);
|
brelse(iloc.bh);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue