public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* ext4-online-defrag-free-space-fragmentation.patch uses do_fsync()
@ 2008-01-23 13:55 Theodore Ts'o
  2008-01-23 14:10 ` Dave Kleikamp
  2008-01-24  3:00 ` Takashi Sato
  0 siblings, 2 replies; 4+ messages in thread
From: Theodore Ts'o @ 2008-01-23 13:55 UTC (permalink / raw)
  To: linux-ext4; +Cc: Mingming Cao, Takashi Sato, Akira Fujita


I was trying to build ext4 as a module, and ran into problems because
the online defrag patch is calling do_fsync() which is *not* an exported
symbol, and so can not be called from a module.

Looking at what the routine is doing, there's no reason to call
do_fsync(), and in fact depending on the journaling mode in use, it may
not force a journal commit, which seems to be the goal of the code.

Hence, I plan to merge the following fix into the the
defrag-free-space-fragmentation patch, unless there are any objections
from Takashi-San or Akira-San.

Regards,

						- Ted

diff --git a/fs/ext4/defrag.c b/fs/ext4/defrag.c
index 4ef3dc0..19d2cfd 100644
--- a/fs/ext4/defrag.c
+++ b/fs/ext4/defrag.c
@@ -632,8 +632,9 @@ static int ext4_ext_defrag_victim(struct file *target_filp,
 		}
 
 		/* Sync journal blocks before reservation */
-		if (do_fsync(target_filp, 0)) {
-			printk(KERN_ERR "defrag: failed do_fsync\n");
+		ret = ext4_force_commit(sb);
+		if (ret) {
+			printk(KERN_ERR "defrag: failed do_fsync (%d)\n", ret);
 			goto ERR;
 		}
 	}

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

* Re: ext4-online-defrag-free-space-fragmentation.patch uses do_fsync()
  2008-01-23 13:55 ext4-online-defrag-free-space-fragmentation.patch uses do_fsync() Theodore Ts'o
@ 2008-01-23 14:10 ` Dave Kleikamp
  2008-01-23 14:16   ` Theodore Tso
  2008-01-24  3:00 ` Takashi Sato
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Kleikamp @ 2008-01-23 14:10 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4, Mingming Cao, Takashi Sato, Akira Fujita


> diff --git a/fs/ext4/defrag.c b/fs/ext4/defrag.c
> index 4ef3dc0..19d2cfd 100644
> --- a/fs/ext4/defrag.c
> +++ b/fs/ext4/defrag.c
> @@ -632,8 +632,9 @@ static int ext4_ext_defrag_victim(struct file *target_filp,
>  		}
> 
>  		/* Sync journal blocks before reservation */
> -		if (do_fsync(target_filp, 0)) {
> -			printk(KERN_ERR "defrag: failed do_fsync\n");
> +		ret = ext4_force_commit(sb);
> +		if (ret) {
> +			printk(KERN_ERR "defrag: failed do_fsync (%d)\n", ret);

I'd think you'd want to change the printk text as well.  "defrag: failed
ext4_force_commit (%d)\n" maybe?

>  			goto ERR;
>  		}
>  	}

-- 
David Kleikamp
IBM Linux Technology Center

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

* Re: ext4-online-defrag-free-space-fragmentation.patch uses do_fsync()
  2008-01-23 14:10 ` Dave Kleikamp
@ 2008-01-23 14:16   ` Theodore Tso
  0 siblings, 0 replies; 4+ messages in thread
From: Theodore Tso @ 2008-01-23 14:16 UTC (permalink / raw)
  To: Dave Kleikamp; +Cc: linux-ext4, Mingming Cao, Takashi Sato, Akira Fujita

On Wed, Jan 23, 2008 at 08:10:20AM -0600, Dave Kleikamp wrote:
> I'd think you'd want to change the printk text as well.  "defrag: failed
> ext4_force_commit (%d)\n" maybe?

mmm, good catch, thanks.

						- Ted

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

* Re: ext4-online-defrag-free-space-fragmentation.patch uses do_fsync()
  2008-01-23 13:55 ext4-online-defrag-free-space-fragmentation.patch uses do_fsync() Theodore Ts'o
  2008-01-23 14:10 ` Dave Kleikamp
@ 2008-01-24  3:00 ` Takashi Sato
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Sato @ 2008-01-24  3:00 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4, Akira Fujita, Mingming Cao

Hi,

> I was trying to build ext4 as a module, and ran into problems because
> the online defrag patch is calling do_fsync() which is *not* an exported
> symbol, and so can not be called from a module.
> 
> Looking at what the routine is doing, there's no reason to call
> do_fsync(), and in fact depending on the journaling mode in use, it may
> not force a journal commit, which seems to be the goal of the code.
> 
> Hence, I plan to merge the following fix into the the
> defrag-free-space-fragmentation patch, unless there are any objections
> from Takashi-San or Akira-San.

Thank you for your information and the proposition of the fix.
Your fix is correct, please merge it.

> Regards,
> 
> - Ted
> 
> diff --git a/fs/ext4/defrag.c b/fs/ext4/defrag.c
> index 4ef3dc0..19d2cfd 100644
> --- a/fs/ext4/defrag.c
> +++ b/fs/ext4/defrag.c
> @@ -632,8 +632,9 @@ static int ext4_ext_defrag_victim(struct file *target_filp,
>  }
> 
>  /* Sync journal blocks before reservation */
> - if (do_fsync(target_filp, 0)) {
> - printk(KERN_ERR "defrag: failed do_fsync\n");
> + ret = ext4_force_commit(sb);
> + if (ret) {
> + printk(KERN_ERR "defrag: failed do_fsync (%d)\n", ret);
>  goto ERR;
>  }
>  }
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Cheers, Takashi

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

end of thread, other threads:[~2008-01-24  3:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-23 13:55 ext4-online-defrag-free-space-fragmentation.patch uses do_fsync() Theodore Ts'o
2008-01-23 14:10 ` Dave Kleikamp
2008-01-23 14:16   ` Theodore Tso
2008-01-24  3:00 ` Takashi Sato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox