All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zheng Liu <gnehzuil.liu@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>, Akira Fujita <a-fujita@rs.jp.nec.com>,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3] ext4: Retry allocation when inline->extent conversion failed
Date: Thu, 12 Dec 2013 14:44:22 +0800	[thread overview]
Message-ID: <20131212064422.GA16199@gmail.com> (raw)
In-Reply-To: <1386670440-3158-2-git-send-email-jack@suse.cz>

Hi Jan,

On Tue, Dec 10, 2013 at 11:13:58AM +0100, Jan Kara wrote:
> 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.

I don't see why we need to try again here.  If there is no enough space
in inline data, ext4_da_convert_inline_data_to_extent() just read the
inline data into a page and clear EXT4_STATE_MAY_INLINE_DATA flag.  If
we try again, we will encounter an ENOSPC error again.  So why do we
need to retry allocation?

Thanks,
                                                - Zheng

> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/ext4/inline.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> 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;
>  	}
>  
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-12-12  6:41 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 [this message]
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 ` [PATCH 2/3] ext4: Standardize error handling in ext4_da_write_inline_data_begin() Jan Kara
2013-12-18  5:45   ` 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=20131212064422.GA16199@gmail.com \
    --to=gnehzuil.liu@gmail.com \
    --cc=a-fujita@rs.jp.nec.com \
    --cc=jack@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.