From: Jan Kara <jack@suse.cz>
To: Zhang Yi <yi.zhang@huawei.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca, jack@suse.cz, yukuai3@huawei.com
Subject: Re: [PATCH v2 3/4] ext4: factor out write end code of inline file
Date: Thu, 15 Jul 2021 14:08:18 +0200 [thread overview]
Message-ID: <20210715120818.GF9457@quack2.suse.cz> (raw)
In-Reply-To: <20210715015452.2542505-4-yi.zhang@huawei.com>
On Thu 15-07-21 09:54:51, Zhang Yi wrote:
> Now that the inline_data file write end procedure are falled into the
> common write end functions, it is not clear. Factor them out and do
> some cleanup. This patch also drop ext4_da_write_inline_data_end()
> and switch to use ext4_write_inline_data_end() instead because we also
> need to do the same error processing if we failed to write data into
> inline entry.
>
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Just two small comments below.
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index 28b666f25ac2..3d227b32b21c 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
...
> +out:
> + /*
> + * If we have allocated more blocks and copied less. We will have
> + * blocks allocated outside inode->i_size, so truncate them.
> + */
> + if (pos + len > inode->i_size && ext4_can_truncate(inode))
> + ext4_orphan_add(handle, inode);
I don't think we need this error handling here. For inline data we never
allocate any blocks so shorter writes don't need any cleanup.
> - return copied;
> + ret2 = ext4_journal_stop(handle);
> + if (!ret)
> + ret = ret2;
> + if (pos + len > inode->i_size) {
> + ext4_truncate_failed_write(inode);
> + /*
> + * If truncate failed early the inode might still be
> + * on the orphan list; we need to make sure the inode
> + * is removed from the orphan list in that case.
> + */
> + if (inode->i_nlink)
> + ext4_orphan_del(NULL, inode);
> + }
And this can go away as well...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2021-07-15 12:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 1:54 [PATCH v2 0/4] ext4: improve delalloc buffer write performance Zhang Yi
2021-07-15 1:54 ` [PATCH v2 1/4] ext4: check and update i_disksize properly Zhang Yi
2021-07-15 11:52 ` Jan Kara
2021-07-15 1:54 ` [PATCH v2 2/4] ext4: correct the error path of ext4_write_inline_data_end() Zhang Yi
2021-07-15 1:54 ` [PATCH v2 3/4] ext4: factor out write end code of inline file Zhang Yi
2021-07-15 12:08 ` Jan Kara [this message]
2021-07-16 3:56 ` Zhang Yi
2021-07-16 10:08 ` Jan Kara
2021-07-16 12:04 ` Zhang Yi
2021-07-15 1:54 ` [PATCH v2 4/4] ext4: drop unnecessary journal handle in delalloc write Zhang Yi
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=20210715120818.GF9457@quack2.suse.cz \
--to=jack@suse.cz \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
/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).