All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Andreas Dilger <adilger@dilger.ca>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	xfs@oss.sgi.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/4] vfs: don't let the dirty time inodes get more than a day stale
Date: Fri, 21 Nov 2014 16:36:51 -0500	[thread overview]
Message-ID: <20141121213651.GF7112@thunk.org> (raw)
In-Reply-To: <B1759DB3-7D86-499B-BE09-34D9927C75C8@dilger.ca>

On Fri, Nov 21, 2014 at 02:19:07PM -0600, Andreas Dilger wrote:
> > -	if (inode->i_sb->s_flags & MS_LAZYTIME) {
> > +	if ((inode->i_sb->s_flags & MS_LAZYTIME) &&
> > +	    (!inode->i_ts_dirty_day ||
> > +	     inode->i_ts_dirty_day == days_since_boot)) {
> > 		spin_lock(&inode->i_lock);
> > 		inode->i_state |= I_DIRTY_TIME;
> > 		spin_unlock(&inode->i_lock);
> > +		inode->i_ts_dirty_day = days_since_boot;
> 
> It isn't clear if this is correct.  It looks like the condition will
> only be entered if i_ts_dirty_day == days_since_boot, but that is only
> set inside the condition?

If i_ts_dirty_day is zero, the timestamps don't have to written to
disk.  This is either because the inode has been written to disk, or
the system has been up for less than a day, such that when we last a
lazy mtime update (i.e., we skipped the call to mark_inode_dirty)
since jiffies / (HZ * 86400) was zero.

If it is non-zero, then the timestamps were updated but were not sent
to disk N days since the system was booted.  So long as it remains N
days since the system was booted, we can skip calling
mark_inode_dirty().  But once it becomes N+1 days since the system was
booted, then we will call mark_inode_dirty() and set i_ts_dirty_day to
zero.

I'll add a comment so it's a bit more obvious what we're doing here,
but I'm pretty sure we currently have is in fact correct.

> and "days_since_boot" should be declared unsigned short so it wraps
> in the same way as i_ts_dirty_day

Good point, thanks.  This will only be an issue after the system has
been up for almost 90 years, but we might as well get it right,

     	    	      	     	    	  - Ted

WARNING: multiple messages have this Message-ID (diff)
From: Theodore Ts'o <tytso@mit.edu>
To: Andreas Dilger <adilger@dilger.ca>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH 3/4] vfs: don't let the dirty time inodes get more than a day stale
Date: Fri, 21 Nov 2014 16:36:51 -0500	[thread overview]
Message-ID: <20141121213651.GF7112@thunk.org> (raw)
In-Reply-To: <B1759DB3-7D86-499B-BE09-34D9927C75C8@dilger.ca>

On Fri, Nov 21, 2014 at 02:19:07PM -0600, Andreas Dilger wrote:
> > -	if (inode->i_sb->s_flags & MS_LAZYTIME) {
> > +	if ((inode->i_sb->s_flags & MS_LAZYTIME) &&
> > +	    (!inode->i_ts_dirty_day ||
> > +	     inode->i_ts_dirty_day == days_since_boot)) {
> > 		spin_lock(&inode->i_lock);
> > 		inode->i_state |= I_DIRTY_TIME;
> > 		spin_unlock(&inode->i_lock);
> > +		inode->i_ts_dirty_day = days_since_boot;
> 
> It isn't clear if this is correct.  It looks like the condition will
> only be entered if i_ts_dirty_day == days_since_boot, but that is only
> set inside the condition?

If i_ts_dirty_day is zero, the timestamps don't have to written to
disk.  This is either because the inode has been written to disk, or
the system has been up for less than a day, such that when we last a
lazy mtime update (i.e., we skipped the call to mark_inode_dirty)
since jiffies / (HZ * 86400) was zero.

If it is non-zero, then the timestamps were updated but were not sent
to disk N days since the system was booted.  So long as it remains N
days since the system was booted, we can skip calling
mark_inode_dirty().  But once it becomes N+1 days since the system was
booted, then we will call mark_inode_dirty() and set i_ts_dirty_day to
zero.

I'll add a comment so it's a bit more obvious what we're doing here,
but I'm pretty sure we currently have is in fact correct.

> and "days_since_boot" should be declared unsigned short so it wraps
> in the same way as i_ts_dirty_day

Good point, thanks.  This will only be an issue after the system has
been up for almost 90 years, but we might as well get it right,

     	    	      	     	    	  - Ted

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-11-21 21:36 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 19:59 [PATCH 0/4] add support for a lazytime mount option Theodore Ts'o
2014-11-21 19:59 ` Theodore Ts'o
2014-11-21 19:59 ` [PATCH 1/4] fs: split update_time() into update_time() and write_time() Theodore Ts'o
2014-11-21 19:59   ` Theodore Ts'o
2014-11-21 20:08   ` Chris Mason
2014-11-21 20:08     ` Chris Mason
2014-11-21 21:42     ` Theodore Ts'o
2014-11-21 21:42       ` Theodore Ts'o
2014-11-24 16:38       ` David Sterba
2014-11-24 16:38         ` David Sterba
2014-11-24 17:22         ` Theodore Ts'o
2014-11-24 17:22           ` Theodore Ts'o
2014-11-24 18:09           ` David Sterba
2014-11-24 18:09             ` David Sterba
2014-11-24 15:21   ` Christoph Hellwig
2014-11-24 15:21     ` Christoph Hellwig
2014-11-24 15:56     ` Theodore Ts'o
2014-11-24 15:56       ` Theodore Ts'o
2014-11-24 17:34     ` David Sterba
2014-11-24 17:34       ` David Sterba
2014-11-25 15:51       ` David Sterba
2014-11-25 15:51         ` David Sterba
2014-11-25 17:01         ` Christoph Hellwig
2014-11-21 19:59 ` [PATCH 2/4] vfs: add support for a lazytime mount option Theodore Ts'o
2014-11-21 19:59   ` Theodore Ts'o
2014-11-25  1:52   ` Dave Chinner
2014-11-25  1:52     ` Dave Chinner
2014-11-25  4:33     ` Theodore Ts'o
2014-11-25  4:33       ` Theodore Ts'o
2014-11-25 15:32       ` Boaz Harrosh
2014-11-25 15:32         ` Boaz Harrosh
2014-11-25 17:19       ` Jan Kara
2014-11-25 17:19         ` Jan Kara
2014-11-25 17:57         ` Theodore Ts'o
2014-11-25 17:57           ` Theodore Ts'o
2014-11-25 20:18           ` Jan Kara
2014-11-25 20:18             ` Jan Kara
2014-11-25 17:30       ` Jan Kara
2014-11-25 17:30         ` Jan Kara
2014-11-25 19:26         ` Theodore Ts'o
2014-11-25 19:26           ` Theodore Ts'o
2014-11-26  0:24       ` Dave Chinner
2014-11-26  0:24         ` Dave Chinner
2014-11-21 19:59 ` [PATCH 3/4] vfs: don't let the dirty time inodes get more than a day stale Theodore Ts'o
2014-11-21 19:59   ` Theodore Ts'o
2014-11-21 20:19   ` Andreas Dilger
2014-11-21 20:19     ` Andreas Dilger
2014-11-21 21:36     ` Theodore Ts'o [this message]
2014-11-21 21:36       ` Theodore Ts'o
2014-11-21 23:09       ` Andreas Dilger
2014-11-25  1:53   ` Dave Chinner
2014-11-25  1:53     ` Dave Chinner
2014-11-25  4:45     ` Theodore Ts'o
2014-11-25  4:45       ` Theodore Ts'o
2014-11-25 23:48       ` Dave Chinner
2014-11-25 23:48         ` Dave Chinner
2014-11-26 10:20         ` Theodore Ts'o
2014-11-26 10:20           ` Theodore Ts'o
2014-11-26 22:39           ` Dave Chinner
2014-11-26 22:39             ` Dave Chinner
2014-11-25 17:31   ` Jan Kara
2014-11-25 17:31     ` Jan Kara
2014-11-21 19:59 ` [PATCH 4/4] ext4: add support for a lazytime mount option Theodore Ts'o
2014-11-21 19:59   ` Theodore Ts'o
2014-11-25 17:34   ` Jan Kara
2014-11-25 17:34     ` Jan Kara

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=20141121213651.GF7112@thunk.org \
    --to=tytso@mit.edu \
    --cc=adilger@dilger.ca \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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.