linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
	Linux Filesystem Development List <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH-v5 2/5] vfs: don't let the dirty time inodes get more than a day stale
Date: Fri, 28 Nov 2014 17:43:58 +0100	[thread overview]
Message-ID: <20141128164358.GB738@quack.suse.cz> (raw)
In-Reply-To: <1417154411-5367-3-git-send-email-tytso@mit.edu>

On Fri 28-11-14 01:00:07, Ted Tso wrote:
> Guarantee that the on-disk timestamps will be no more than 24 hours
> stale.
  Why is this still necessary after what you do in patch 1/5?

								Honza
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>  fs/fs-writeback.c  |  1 +
>  fs/inode.c         | 20 ++++++++++++++++++++
>  include/linux/fs.h |  1 +
>  3 files changed, 22 insertions(+)
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 518f3bb..15dec84 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1147,6 +1147,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
>  	if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
>  		trace_writeback_dirty_inode_start(inode, flags);
>  
> +		inode->i_ts_dirty_day = 0;
>  		if (sb->s_op->dirty_inode)
>  			sb->s_op->dirty_inode(inode, flags);
>  
> diff --git a/fs/inode.c b/fs/inode.c
> index 1ec0629..84a5a3d 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -1507,6 +1507,9 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
>   */
>  static int update_time(struct inode *inode, struct timespec *time, int flags)
>  {
> +	struct timespec uptime;
> +	unsigned short days_since_boot;
> +
>  	if (inode->i_op->update_time)
>  		return inode->i_op->update_time(inode, time, flags);
>  
> @@ -1524,6 +1527,22 @@ static int update_time(struct inode *inode, struct timespec *time, int flags)
>  	    !(inode->i_state & I_DIRTY_WB)) {
>  		if (inode->i_state & I_DIRTY_TIME)
>  			return 0;
> +		get_monotonic_boottime(&uptime);
> +		days_since_boot = div_u64(uptime.tv_sec, 86400);
> +		/*
> +		 * If i_ts_dirty_day is zero, then either we have not
> +		 * deferred timestamp updates, or the system has been
> +		 * up for less than a day (so days_since_boot is
> +		 * zero), so we can defer timestamp updates in that
> +		 * case.  If a day or more has passed, then
> +		 * i_ts_dirty_day will be different from
> +		 * days_since_boot, and then we should update the
> +		 * on-disk inode and then we can clear i_ts_dirty_day.
> +		 */
> +		if (inode->i_ts_dirty_day &&
> +		    (inode->i_ts_dirty_day != days_since_boot))
> +			goto force_dirty;
> +
>  		spin_lock(&inode->i_lock);
>  		if (inode->i_state & I_DIRTY_WB) {
>  			spin_unlock(&inode->i_lock);
> @@ -1534,6 +1553,7 @@ static int update_time(struct inode *inode, struct timespec *time, int flags)
>  			return 0;
>  		}
>  		inode->i_state |= I_DIRTY_TIME;
> +		inode->i_ts_dirty_day = days_since_boot;
>  		spin_unlock(&inode->i_lock);
>  		inode_requeue_dirtytime(inode);
>  		return 0;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 7932482..2b86b5d 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -575,6 +575,7 @@ struct inode {
>  	struct timespec		i_ctime;
>  	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
>  	unsigned short          i_bytes;
> +	unsigned short		i_ts_dirty_day;
>  	unsigned int		i_blkbits;
>  	blkcnt_t		i_blocks;
>  
> -- 
> 2.1.0
> 
> --
> 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
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2014-11-28 16:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  6:00 [PATCH-v5 0/5] add support for a lazytime mount option Theodore Ts'o
2014-11-28  6:00 ` [PATCH-v5 1/5] vfs: " Theodore Ts'o
2014-11-28 17:23   ` Jan Kara
     [not found]     ` <20141128181421.GA19461@google.com>
2014-12-02 12:58       ` Jan Kara
2014-12-02 17:55         ` Boaz Harrosh
2014-12-02 19:23           ` Theodore Ts'o
2014-12-02 20:37             ` Andreas Dilger
2014-12-02 21:01               ` Theodore Ts'o
2014-11-28  6:00 ` [PATCH-v5 2/5] vfs: don't let the dirty time inodes get more than a day stale Theodore Ts'o
2014-11-28 16:43   ` Jan Kara [this message]
2014-11-28  6:00 ` [PATCH 2/5] vfs: use writeback lists to provide lazytime one day timeout Theodore Ts'o
2014-11-28 17:20   ` Jan Kara
2014-11-28  6:00 ` [PATCH-v5 3/5] vfs: add lazytime tracepoints for better debugging Theodore Ts'o
2014-11-28  6:00 ` [PATCH-v5 4/5] vfs: add find_inode_nowait() function Theodore Ts'o
2014-11-28  6:00 ` [PATCH-v5 5/5] ext4: add optimization for the lazytime mount option Theodore Ts'o
2014-11-28  8:55 ` [PATCH-v5 0/5] add support for a " Sedat Dilek
2014-11-28 15:07   ` Theodore Ts'o
2014-11-28 16:32   ` 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=20141128164358.GB738@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).