From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: gnehzuil.liu@gmail.com, Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH 3/3] ext4: reserve metadata block for every delayed write
Date: Fri, 8 Mar 2013 09:24:19 +0100 [thread overview]
Message-ID: <1362731059-3508-3-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1362731059-3508-1-git-send-email-lczerner@redhat.com>
Currently we only reserve space (data+metadata) in delayed allocation if
we're allocating from new cluster (which is always in non-bigalloc file
system) which is ok for data blocks, because we reserve whole cluster.
However we have to reserve metadata for every delayed block we're going
to write because every block could potentially require metedata block
when we need to grow the extent tree.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
fs/ext4/inode.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c3b88ec..e0d5bc6 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1905,8 +1905,11 @@ add_delayed:
* XXX: __block_prepare_write() unmaps passed block,
* is it OK?
*/
- /* If the block was allocated from previously allocated cluster,
- * then we dont need to reserve it again. */
+ /*
+ * If the block was allocated from previously allocated cluster,
+ * then we don't need to reserve it again. However we still need
+ * to reserve metadata for every block we're going to write.
+ */
if (!(map->m_flags & EXT4_MAP_FROM_CLUSTER)) {
ret = ext4_da_reserve_space(inode, iblock);
if (ret) {
@@ -1914,6 +1917,13 @@ add_delayed:
retval = ret;
goto out_unlock;
}
+ } else {
+ ret = ext4_da_reserve_metadata(inode, iblock);
+ if (ret) {
+ /* not enough space to reserve */
+ retval = ret;
+ goto out_unlock;
+ }
}
ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len,
--
1.7.7.6
next prev parent reply other threads:[~2013-03-08 8:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-08 8:24 [PATCH 1/3] ext4: Reserve metadata if writing into uninitialized Lukas Czerner
2013-03-08 8:24 ` [PATCH 2/3] ext4: Update reserved space after the 'correction' Lukas Czerner
2013-03-11 2:50 ` Theodore Ts'o
2013-03-08 8:24 ` Lukas Czerner [this message]
2013-03-11 2:52 ` [PATCH 3/3] ext4: reserve metadata block for every delayed write Theodore Ts'o
2013-03-11 2:49 ` [PATCH 1/3] ext4: Reserve metadata if writing into uninitialized 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=1362731059-3508-3-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=gnehzuil.liu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
/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).