All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>,
	linux-mtd@lists.infradead.org, adrian.hunter@intel.com,
	dedekind1@gmail.com
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH RESEND] ubifs: Introduce a mount option of force_atime.
Date: Tue, 09 Jun 2015 00:35:13 +0200	[thread overview]
Message-ID: <557618A1.8020203@nod.at> (raw)
In-Reply-To: <1433758060-18614-1-git-send-email-yangds.fnst@cn.fujitsu.com>

Am 08.06.2015 um 12:07 schrieb Dongsheng Yang:
> Currently, ubifs does not support access time anyway. I understand
> that there is a overhead to update inode in each access from user.
> 
> But for the following two reasons, I think we can make it optional
> to user.
> 
> (1). More and more flash storage in server are trying to use ubifs,
> it is not only for a device such as mobile phone any more, we want
> to use it in more and more generic way. Then we need to compete
> with some other main filesystems. From this point, access time is
> necessary to us, at least as a choice to user currently.
> 
> (2). The default mount option about atime is relatime currently,
> it's much relaxy compared with strictatime. Then we don't update
> the inode in any accessing. So the overhead is not too much.
> It's really acceptable.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
> ---
> 	It's a RESEND patch to cc to fsdevel as Artem suggested.
> I would rename force_atime to enable_atime in next version.
> 
>  fs/ubifs/file.c  |  4 ++++
>  fs/ubifs/super.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++---
>  fs/ubifs/ubifs.h |  5 +++++
>  3 files changed, 58 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index 35efc10..e683890 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -1541,11 +1541,15 @@ static const struct vm_operations_struct ubifs_file_vm_ops = {
>  static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
>  {
>  	int err;
> +	struct inode *inode = file->f_mapping->host;
> +	struct ubifs_info *c = inode->i_sb->s_fs_info;
>  
>  	err = generic_file_mmap(file, vma);
>  	if (err)
>  		return err;
>  	vma->vm_ops = &ubifs_file_vm_ops;
> +	if (c->force_atime)
> +		file_accessed(file);
>  	return 0;
>  }
>  
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 75e6f04..8c2773b 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -128,7 +128,9 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
>  	if (err)
>  		goto out_ino;
>  
> -	inode->i_flags |= (S_NOCMTIME | S_NOATIME);
> +	inode->i_flags |= S_NOCMTIME;
> +	if (!c->force_atime)
> +		inode->i_flags |= S_NOATIME;
>  	set_nlink(inode, le32_to_cpu(ino->nlink));
>  	i_uid_write(inode, le32_to_cpu(ino->uid));
>  	i_gid_write(inode, le32_to_cpu(ino->gid));
> @@ -378,15 +380,47 @@ done:
>  	clear_inode(inode);
>  }
>  
> +/*
> + * There is only one possible caller of ubifs_dirty_inode without holding
> + * ui->ui_mutex, file_accessed. We are going to support atime if user
> + * set the mount option of force_atime. In that case, ubifs_dirty_inode
> + * need to lock ui->ui_mutex by itself and do a budget by itself.
> + */
>  static void ubifs_dirty_inode(struct inode *inode, int flags)
>  {
>  	struct ubifs_inode *ui = ubifs_inode(inode);
> +	int locked = mutex_is_locked(&ui->ui_mutex);
> +	struct ubifs_info *c = inode->i_sb->s_fs_info;
> +	int ret = 0;
> +
> +	if (!locked)
> +		mutex_lock(&ui->ui_mutex);

Please try as hard as possible to avoid conditional locking.

Thanks,
//richard

  reply	other threads:[~2015-06-08 22:35 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08 10:07 [PATCH RESEND] ubifs: Introduce a mount option of force_atime Dongsheng Yang
2015-06-08 10:07 ` Dongsheng Yang
2015-06-08 22:35 ` Richard Weinberger [this message]
2015-06-08 22:55 ` Richard Weinberger
2015-06-09  2:57   ` Dongsheng Yang
2015-06-09  2:57     ` Dongsheng Yang
2015-06-09  3:24   ` Dongsheng Yang
2015-06-09  3:24     ` Dongsheng Yang
2015-06-09  5:00     ` Dongsheng Yang
2015-06-09  5:00       ` Dongsheng Yang
2015-06-09  5:09       ` Dongsheng Yang
2015-06-09  5:09         ` Dongsheng Yang
2015-06-09  6:36 ` Artem Bityutskiy
2015-06-09  6:36   ` Artem Bityutskiy
2015-06-09  8:02   ` Richard Weinberger
2015-06-09  8:02     ` Richard Weinberger
2015-06-10  3:16     ` Dongsheng Yang
2015-06-10  3:16       ` Dongsheng Yang
2015-06-10  9:21       ` Artem Bityutskiy
2015-06-10  9:21         ` Artem Bityutskiy
2015-06-10 10:10         ` Dongsheng Yang
2015-06-10 10:10           ` Dongsheng Yang
2015-06-10 10:25           ` Artem Bityutskiy
2015-06-10 10:25             ` Artem Bityutskiy
2015-06-10 10:34             ` Dongsheng Yang
2015-06-10 10:34               ` Dongsheng Yang
2015-06-10 11:05               ` Artem Bityutskiy
2015-06-10 11:05                 ` Artem Bityutskiy
2015-06-23  9:55                 ` Dongsheng Yang
2015-06-23  9:55                   ` Dongsheng Yang
2015-06-23 10:44                   ` Artem Bityutskiy
2015-06-23 10:44                     ` Artem Bityutskiy
2015-06-23 23:49                     ` Dongsheng Yang
2015-06-23 23:49                       ` Dongsheng Yang
2015-06-24  0:33                     ` Dave Chinner
2015-06-24  0:33                       ` Dave Chinner
2015-06-24 16:04                       ` Artem Bityutskiy
2015-06-24 16:04                         ` Artem Bityutskiy
2015-06-25  9:55                       ` Dongsheng Yang
2015-06-25  9:55                         ` Dongsheng Yang
2015-06-25 10:08                         ` Artem Bityutskiy
2015-06-25 10:08                           ` Artem Bityutskiy
2015-06-25 10:10                           ` Dongsheng Yang
2015-06-25 10:10                             ` Dongsheng Yang
2015-06-25 11:28                             ` Artem Bityutskiy
2015-06-25 11:28                               ` Artem Bityutskiy
2015-06-26  1:17                               ` Dongsheng Yang
2015-06-26  1:17                                 ` Dongsheng Yang
2015-06-26  7:01                                 ` Artem Bityutskiy
2015-06-26  7:01                                   ` Artem Bityutskiy
2015-06-26  7:13                                   ` Dongsheng Yang
2015-06-26  7:13                                     ` Dongsheng Yang
2015-06-26  7:43                                     ` Artem Bityutskiy
2015-06-26  7:43                                       ` Artem Bityutskiy
2015-06-26  7:52                                       ` Dongsheng Yang
2015-06-26  7:52                                         ` Dongsheng Yang
2015-06-26  8:19                                         ` Artem Bityutskiy
2015-06-26  8:19                                           ` Artem Bityutskiy
2015-06-26  8:22                                           ` Dongsheng Yang
2015-06-26  8:22                                             ` Dongsheng Yang

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=557618A1.8020203@nod.at \
    --to=richard@nod.at \
    --cc=adrian.hunter@intel.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=yangds.fnst@cn.fujitsu.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.