diff options
author | Jan Kara <jack@suse.cz> | 2014-01-06 14:03:23 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-01-06 14:03:23 -0500 |
commit | 52e4477758eef45c2fa28b087abf83847126bc28 (patch) | |
tree | 05d53957b0336ae8399553fcba18daf1885bbc41 /fs/ext4 | |
parent | bc0ca9df3b2abb13f7da9d8d255ec60718badd84 (diff) |
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inline.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index ed6e71fe5e9d..c417e52d194e 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
@@ -859,7 +859,6 @@ retry_journal: | |||
859 | handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); | 859 | handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); |
860 | if (IS_ERR(handle)) { | 860 | if (IS_ERR(handle)) { |
861 | ret = PTR_ERR(handle); | 861 | ret = PTR_ERR(handle); |
862 | handle = NULL; | ||
863 | goto out; | 862 | goto out; |
864 | } | 863 | } |
865 | 864 | ||
@@ -869,7 +868,7 @@ retry_journal: | |||
869 | if (inline_size >= pos + len) { | 868 | if (inline_size >= pos + len) { |
870 | ret = ext4_prepare_inline_data(handle, inode, pos + len); | 869 | ret = ext4_prepare_inline_data(handle, inode, pos + len); |
871 | if (ret && ret != -ENOSPC) | 870 | if (ret && ret != -ENOSPC) |
872 | goto out; | 871 | goto out_journal; |
873 | } | 872 | } |
874 | 873 | ||
875 | if (ret == -ENOSPC) { | 874 | if (ret == -ENOSPC) { |
@@ -878,7 +877,6 @@ retry_journal: | |||
878 | flags, | 877 | flags, |
879 | fsdata); | 878 | fsdata); |
880 | ext4_journal_stop(handle); | 879 | ext4_journal_stop(handle); |
881 | handle = NULL; | ||
882 | if (ret == -ENOSPC && | 880 | if (ret == -ENOSPC && |
883 | ext4_should_retry_alloc(inode->i_sb, &retries)) | 881 | ext4_should_retry_alloc(inode->i_sb, &retries)) |
884 | goto retry_journal; | 882 | goto retry_journal; |
@@ -894,7 +892,7 @@ retry_journal: | |||
894 | page = grab_cache_page_write_begin(mapping, 0, flags); | 892 | page = grab_cache_page_write_begin(mapping, 0, flags); |
895 | if (!page) { | 893 | if (!page) { |
896 | ret = -ENOMEM; | 894 | ret = -ENOMEM; |
897 | goto out; | 895 | goto out_journal; |
898 | } | 896 | } |
899 | 897 | ||
900 | down_read(&EXT4_I(inode)->xattr_sem); | 898 | down_read(&EXT4_I(inode)->xattr_sem); |
@@ -911,16 +909,15 @@ retry_journal: | |||
911 | 909 | ||
912 | up_read(&EXT4_I(inode)->xattr_sem); | 910 | up_read(&EXT4_I(inode)->xattr_sem); |
913 | *pagep = page; | 911 | *pagep = page; |
914 | handle = NULL; | ||
915 | brelse(iloc.bh); | 912 | brelse(iloc.bh); |
916 | return 1; | 913 | return 1; |
917 | out_release_page: | 914 | out_release_page: |
918 | up_read(&EXT4_I(inode)->xattr_sem); | 915 | up_read(&EXT4_I(inode)->xattr_sem); |
919 | unlock_page(page); | 916 | unlock_page(page); |
920 | page_cache_release(page); | 917 | page_cache_release(page); |
918 | out_journal: | ||
919 | ext4_journal_stop(handle); | ||
921 | out: | 920 | out: |
922 | if (handle) | ||
923 | ext4_journal_stop(handle); | ||
924 | brelse(iloc.bh); | 921 | brelse(iloc.bh); |
925 | return ret; | 922 | return ret; |
926 | } | 923 | } |