All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kazuya Mio <k-mio@sx.jp.nec.com>
To: linux-ext4@vger.kernel.org, Theodore Tso <tytso@mit.edu>
Subject: [PATCH 2/2] ext4: update donor file's ctime/mtime
Date: Thu, 08 Oct 2009 17:04:20 +0900	[thread overview]
Message-ID: <4ACD9D04.40503@sx.jp.nec.com> (raw)

EXT4_IOC_MOVE_EXT changes donor file data, but doesn't update ctime/mtime.
This patch fixes this problem.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
---

 move_extent.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index e2e99fd..1cb2609 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -1210,6 +1210,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
 	ext4_lblk_t block_end, seq_start, add_blocks, file_end, seq_blocks = 0;
 	ext4_lblk_t rest_blocks;
 	pgoff_t orig_page_offset = 0, seq_end_page;
+	handle_t *handle;
 	int ret1, ret2, depth, last_extent = 0;
 	int blocks_per_page = PAGE_CACHE_SIZE >> orig_inode->i_blkbits;
 	int data_offset_in_page;
@@ -1406,6 +1407,25 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
 
 	}
 out:
+	/*
+	 * Note that ctime/mtime will not be updated if power failure is
+	 * detected during block replacing.
+	 */
+	if (*moved_len) {
+		handle = ext4_journal_start(donor_inode, 1);
+		if (IS_ERR(handle))
+			ret2 = PTR_ERR(handle);
+		else {
+			donor_inode->i_ctime = donor_inode->i_mtime =
+					ext4_current_time(donor_inode);
+			ret2 = ext4_mark_inode_dirty(handle, donor_inode);
+			ext4_journal_stop(handle);
+		}
+
+		if (!ret1)
+			ret1 = ret2;
+	}
+
 	if (orig_path) {
 		ext4_ext_drop_refs(orig_path);
 		kfree(orig_path);


             reply	other threads:[~2009-10-08  8:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-08  8:04 Kazuya Mio [this message]
2009-10-09 17:20 ` [PATCH 2/2] ext4: update donor file's ctime/mtime Andreas Dilger
2009-10-14  1:49   ` Kazuya Mio
2009-10-14 18:10     ` Andreas Dilger
2009-10-14 21:19       ` Greg Freemyer

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=4ACD9D04.40503@sx.jp.nec.com \
    --to=k-mio@sx.jp.nec.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 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.