All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] e4defrag: fallocate donor file only once
@ 2009-09-02 15:35 Peng Tao
  2009-09-02 22:09 ` Greg Freemyer
  0 siblings, 1 reply; 12+ messages in thread
From: Peng Tao @ 2009-09-02 15:35 UTC (permalink / raw)
  To: linux-ext4; +Cc: Theodore Tso, Akira Fujita, Peng Tao

If we allocate the donor file once for all, it will have a better chance
to be continuous.

Signed-off-by: "Peng Tao" <bergwolf@gmail.com>
---
 misc/e4defrag.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index c25514a..c1e9213 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -1603,6 +1603,7 @@ static int file_defrag(const char *file, const struct stat64 *buf,
 	struct fiemap_extent_list	*donor_list_logical = NULL;
 	struct fiemap_extent_group	*orig_group_head = NULL;
 	struct fiemap_extent_group	*orig_group_tmp = NULL;
+	ext4_fsblk_t	orig_block_count;
 
 	defraged_file_count++;
 
@@ -1742,19 +1743,17 @@ static int file_defrag(const char *file, const struct stat64 *buf,
 	/* Allocate space for donor inode */
 	orig_group_tmp = orig_group_head;
 	do {
-		ret = fallocate(donor_fd, 0,
-		  (loff_t)orig_group_tmp->start->data.logical * block_size,
-		  (loff_t)orig_group_tmp->len * block_size);
-		if (ret < 0) {
-			if (mode_flag & DETAIL) {
-				PRINT_FILE_NAME(file);
-				PRINT_ERR_MSG_WITH_ERRNO("Failed to fallocate");
-			}
-			goto out;
-		}

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-09-09  1:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02 15:35 [PATCH] e4defrag: fallocate donor file only once Peng Tao
2009-09-02 22:09 ` Greg Freemyer
2009-09-02 22:24   ` Andreas Dilger
2009-09-03  8:00   ` Peng Tao
2009-09-03  9:30     ` Greg Freemyer
2009-09-04  3:08       ` Peng Tao
2009-09-04 12:36         ` Greg Freemyer
2009-09-04 16:56           ` Peng Tao
2009-09-04 19:10             ` Greg Freemyer
2009-09-05 16:29               ` Peng Tao
2009-09-08 15:41                 ` Greg Freemyer
2009-09-09  1:24                   ` Peng Tao

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.