From: Jan Kara <jack@suse.cz>
To: Ted Tso <tytso@mit.edu>
Cc: Akira Fujita <a-fujita@rs.jp.nec.com>,
linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH 2/3] ext4: Standardize error handling in ext4_da_write_inline_data_begin()
Date: Tue, 10 Dec 2013 11:13:59 +0100 [thread overview]
Message-ID: <1386670440-3158-3-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1386670440-3158-1-git-send-email-jack@suse.cz>
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>
---
fs/ext4/inline.c | 11 ++++-------
1 file 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:
handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
- handle = NULL;
goto out;
}
@@ -869,7 +868,7 @@ retry_journal:
if (inline_size >= pos + len) {
ret = ext4_prepare_inline_data(handle, inode, pos + len);
if (ret && ret != -ENOSPC)
- goto out;
+ goto out_journal;
}
if (ret == -ENOSPC) {
@@ -878,7 +877,6 @@ retry_journal:
flags,
fsdata);
ext4_journal_stop(handle);
- handle = NULL;
if (ret == -ENOSPC &&
ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry_journal;
@@ -894,7 +892,7 @@ retry_journal:
page = grab_cache_page_write_begin(mapping, 0, flags);
if (!page) {
ret = -ENOMEM;
- goto out;
+ goto out_journal;
}
down_read(&EXT4_I(inode)->xattr_sem);
@@ -911,16 +909,15 @@ retry_journal:
up_read(&EXT4_I(inode)->xattr_sem);
*pagep = page;
- handle = NULL;
brelse(iloc.bh);
return 1;
out_release_page:
up_read(&EXT4_I(inode)->xattr_sem);
unlock_page(page);
page_cache_release(page);
+out_journal:
+ ext4_journal_stop(handle);
out:
- if (handle)
- ext4_journal_stop(handle);
brelse(iloc.bh);
return ret;
}
--
1.8.1.4
next prev parent reply other threads:[~2013-12-10 10:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 10:13 [PATCH 0/3] Fix ext4 deadlock when running xfstests/269 Jan Kara
2013-12-10 10:13 ` [PATCH 1/3] ext4: Retry allocation when inline->extent conversion failed Jan Kara
2013-12-12 6:44 ` Zheng Liu
2013-12-12 9:39 ` Jan Kara
2013-12-12 10:30 ` Zheng Liu
2013-12-18 5:45 ` Theodore Ts'o
2013-12-10 10:13 ` Jan Kara [this message]
2013-12-18 5:45 ` [PATCH 2/3] ext4: Standardize error handling in ext4_da_write_inline_data_begin() Theodore Ts'o
2013-12-10 10:14 ` [PATCH 3/3] ext4: Fix deadlock when writing in ENOSPC conditions Jan Kara
2013-12-12 6:51 ` Zheng Liu
2013-12-12 9:41 ` Jan Kara
2013-12-18 5:45 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386670440-3158-3-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=a-fujita@rs.jp.nec.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).