From: Chengguang Xu <cgxu519@mykernel.net>
To: jack@suse.com
Cc: linux-ext4@vger.kernel.org, Chengguang Xu <cgxu519@mykernel.net>
Subject: [PATCH] ext2: delay discarding block reservation
Date: Mon, 22 Jun 2020 09:25:26 +0800 [thread overview]
Message-ID: <20200622012526.4688-1-cgxu519@mykernel.net> (raw)
Currently block reservation will be discard when a write mode
file structure is released. It is not efficent for concurrent
writing, so change to discard block reservation when last writer
release file structure.
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
fs/ext2/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 60378ddf1424..28eaf429138b 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -139,7 +139,7 @@ static int ext2_file_mmap(struct file *file, struct vm_area_struct *vma)
*/
static int ext2_release_file (struct inode * inode, struct file * filp)
{
- if (filp->f_mode & FMODE_WRITE) {
+ if ((filp->f_mode & FMODE_WRITE) && (atomic_read(&inode->i_writecount) == 1)) {
mutex_lock(&EXT2_I(inode)->truncate_mutex);
ext2_discard_reservation(inode);
mutex_unlock(&EXT2_I(inode)->truncate_mutex);
--
2.17.2
reply other threads:[~2020-06-22 1:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200622012526.4688-1-cgxu519@mykernel.net \
--to=cgxu519@mykernel.net \
--cc=jack@suse.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 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.