linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <tytso@mit.edu>, <linux-ext4@vger.kernel.org>
Subject: [PATCH] ext4: only call ext4_truncate when size <= isize
Date: Tue, 19 May 2015 11:28:57 -0400	[thread overview]
Message-ID: <1432049337-3520-1-git-send-email-jbacik@fb.com> (raw)

At LSF we decided that if we truncate up from isize we shouldn't trim fallocated
blocks that were fallocated with KEEP_SIZE and are past the new i_size.  This
patch fixes ext4 to do this.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 fs/ext4/inode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0554b0b..92174dd 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4640,6 +4640,7 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode)
 int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 {
 	struct inode *inode = d_inode(dentry);
+	loff_t oldsize = inode->i_size;
 	int error, rc = 0;
 	int orphan = 0;
 	const unsigned int ia_valid = attr->ia_valid;
@@ -4727,8 +4728,6 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 				goto err_out;
 			}
 		} else {
-			loff_t oldsize = inode->i_size;

             reply	other threads:[~2015-05-19 15:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 15:28 Josef Bacik [this message]
2015-06-02  8:08 ` [PATCH] ext4: only call ext4_truncate when size <= isize Lukáš Czerner
2015-06-06 20:20   ` Theodore Ts'o
2015-06-09 16:07     ` Theodore Ts'o
2015-06-22  4:37       ` 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=1432049337-3520-1-git-send-email-jbacik@fb.com \
    --to=jbacik@fb.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).