linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Linux Filesystem Development List <linux-fsdevel@vger.kernel.org>,
	jack@suse.cz, torvalds@linux-foundation.org,
	viro@zeniv.linux.org.uk, stable@vger.kernel.org
Subject: Re: [PATCH-v2 1/2] fs: make sure the timestamps for lazytime inodes eventually get written
Date: Tue, 17 Mar 2015 11:09:35 -0400	[thread overview]
Message-ID: <20150317150935.GA5663@thunk.org> (raw)
In-Reply-To: <0ADB84CA-6F1D-41EC-A847-FCD5764FCAE9@dilger.ca>

On Mon, Mar 16, 2015 at 03:34:12PM -0600, Andreas Dilger wrote:
> I wonder if something more lightweight could be added to avoid this
> problem?  For example, we only care about this case if it has been
> going on for more than the lazytime interval (about a day), so the
> inode could store a 16-bit i_dirtied_time_when that is approximately
> (jiffies >> bits_in_a_half_a_day) and only check time_after() that.
> The __u16 could fit into some existing hole (e.g. after i_bytes on my
> kernel) and avoid expanding the size of the inode at all.
> 
> The remaining high bits of i_dirtied_time_when would be irrelevant, since
> a __u16 of half-days is about 80 years, so it would be enough to compare:
> 
> 
>     time_after(i_dirtied_time_when, (__u16)(jiffies >> bits_in_half_a_day))

That won't work correctly; we'd have to do something like this

#define u16_after(a,b) (typecheck(__u16, a) && typecheck(__u16, b) && \
		 ((__s16)((b) - (a)) < 0))


> Minor issue, is there a good reason why dirtied_time_when doesn't have an
> "i_" prefix?

It's because dirtied_when also doesn't have an i_ prefix, but arguably
it should.

						- Ted

  parent reply	other threads:[~2015-03-17 15:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 19:14 [PATCH-v2 0/2] lazytime bug fixes for 4.0 Theodore Ts'o
2015-03-16 19:14 ` [PATCH-v2 1/2] fs: make sure the timestamps for lazytime inodes eventually get written Theodore Ts'o
2015-03-16 21:34   ` Andreas Dilger
2015-03-17 10:33     ` Jan Kara
2015-03-17 15:53       ` Theodore Ts'o
2015-03-17 15:09     ` Theodore Ts'o [this message]
2015-03-17 10:29   ` Jan Kara
2015-03-16 19:14 ` [PATCH-v2 2/2] fs: add dirtytime_expire_seconds sysctl Theodore Ts'o
2015-03-17 10:30   ` 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=20150317150935.GA5663@thunk.org \
    --to=tytso@mit.edu \
    --cc=adilger@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 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).