linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is the checkpoint interval adjustable?
@ 2013-07-31 20:02 Mike Audia
  2013-07-31 20:54 ` Zach Brown
  2013-08-03 17:28 ` Kai Krakow
  0 siblings, 2 replies; 12+ messages in thread
From: Mike Audia @ 2013-07-31 20:02 UTC (permalink / raw)
  To: linux-btrfs

I believe 30 sec is the default for the checkpoint interval.  Is this adjustable?

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Is the checkpoint interval adjustable?
@ 2013-07-31 22:10 Mike Audia
  2013-07-31 22:56 ` Zach Brown
       [not found] ` <20130731225640.GO32145@lenny. home.zabbo.net>
  0 siblings, 2 replies; 12+ messages in thread
From: Mike Audia @ 2013-07-31 22:10 UTC (permalink / raw)
  To: Zach Brown; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

> On Wed, Jul 31, 2013 at 04:02:29PM -0400, Mike Audia wrote:
> > I believe 30 sec is the default for the checkpoint interval.  Is this adjustable?
>
> It doesn't look like it. It looks like it's implemented with raw '30's
> in the code.
>
>  delay = HZ * 30;
> ...
>  (now < cur->start_time || now - cur->start_time <
> 30)) {
>
> If you want more frequent forced commits you could always syncfs()
> regularly from userspace, I suppose.

Thank you kindly for the prompt reply.  My goal is to make them _less_ frequent.  I am NO programmer by any stretch.  Let's say I want them to be once every 5 min (300 sec).  Is the attached patch sane to acheive this?  Are there any unforeseen and effects of doing this?  Thank you for the consideration.

[-- Attachment #2: Attachment: 10_minute_checkpoints.patch --]
[-- Type: text/x-patch, Size: 604 bytes --]

--- a/fs/btrfs/disk-io.c	2013-07-31 18:05:22.581062955 -0400
+++ b/fs/btrfs/disk-io.c	2013-07-31 18:06:15.243201652 -0400
@@ -1713,7 +1713,7 @@
 
 	do {
 		cannot_commit = false;
-		delay = HZ * 30;
+		delay = HZ * 300;
 		mutex_lock(&root->fs_info->transaction_kthread_mutex);
 
 		spin_lock(&root->fs_info->trans_lock);
@@ -1725,7 +1725,7 @@
 
 		now = get_seconds();
 		if (!cur->blocked &&
-		    (now < cur->start_time || now - cur->start_time < 30)) {
+		    (now < cur->start_time || now - cur->start_time < 300)) {
 			spin_unlock(&root->fs_info->trans_lock);
 			delay = HZ * 5;
 			goto sleep;

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Is the checkpoint interval adjustable?
@ 2013-08-02 20:58 Mike Audia
  2013-08-03  8:33 ` Duncan
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Audia @ 2013-08-02 20:58 UTC (permalink / raw)
  To: dsterba, Zach Brown; +Cc: linux-btrfs

> From: David Sterba
> There were a few requests to tune the interval. This finally made me to
> finish the patch and will send it in a second.

Thank you, David and to others who kindly replied to my post.  I will try your patch rather than modifying the code

> > >  Are there any unforeseen and effects of doing this?  Thank you for
> > > the consideration.
> >
> > I don't *think* that there should be. One way of looking at it is that
> > both 30 and 300 seconds are an *eternity* for cpu, memory, and storage.
> > Any trouble that you could get in to in 300 seconds some other machine
> > could trivially get in to in 30 with beefier hardware.
>
> That's a good point and lowers my worries a bit, though it would be
> interesting to see in what way a beefy machine blows with 300 seconds
> set.

I have my system booting to a BTRFS root partition.  Let's say I'm using a value of 300 for my checkpoint interval.  Does this mean that if I do a TON of filesystem writes (say I update my system which pulls down a bunch of system file updates for example), and I copy over several gigs of data from a backup, all _between_ checkpoints and for some reason, my system freezes forcing me to ungracefully restart... is EVERYTHING since the last checkpoint is lost?  Upon a reboot, will BTRFS just mount up to the last good checkpoiint automatically or will I have a broken system and need to add the `-o recovery` option while I mount it manualy from a chroot?

Another naive question: if I shutdown the system between checkpoints, systemd should umount my partitions.  Does the syncing of cached data occur after the graceful umount?

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

end of thread, other threads:[~2013-08-04  1:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31 20:02 Is the checkpoint interval adjustable? Mike Audia
2013-07-31 20:54 ` Zach Brown
2013-08-03 17:28 ` Kai Krakow
2013-08-03 17:37   ` Torbjørn
2013-08-04  0:58     ` Kai Krakow
  -- strict thread matches above, loose matches on Subject: below --
2013-07-31 22:10 Mike Audia
2013-07-31 22:56 ` Zach Brown
2013-08-01 15:40   ` David Sterba
2013-08-01 17:59     ` Zach Brown
     [not found] ` <20130731225640.GO32145@lenny. home.zabbo.net>
2013-08-01  3:11   ` Duncan
2013-08-02 20:58 Mike Audia
2013-08-03  8:33 ` Duncan

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).