zoukankan      html  css  js  c++  java
  • noatime是否隐含了nodiratime?

        如题,我们需要同时设置noatime和nodiratime吗?很多资料都提到要同时设置noatime和nodiratime,但我们看mount(2)关于参数的描述: 

    MS_NOATIME
           Do not update access times for (all types of) files on this file
           system.
    MS_NODIRATIME
           Do  not update access times for directories on this file system.
           This flag provides a subset of  the  functionality  provided  by
           MS_NOATIME; that is, MS_NOATIME implies MS_NODIRATIME.

        如何理解这里的“(all types of) files”,目录是否作为文件的一类?

        还是看看内核源码的相关内容,在文件fs/inode.c中有个touch_atime函数:

    void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
    {
        
    /* ... */
        
    if (inode->i_flags & S_NOATIME)
            
    return;
        
    if (IS_NOATIME(inode))
            
    return;
        
    if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
            
    return;

        可以看到,一旦NOATIME标志位设置,NODIRATIME就不再被处理了。

        而且Andrew Morton同学也说了:"noatime is a superset of nodiratime, btw."

        好了,大家知道该怎么做了吧。

     

  • 相关阅读:
    C# 并行线程调用
    Oracle定时备份
    读取Excel里面的内容转为DataTable
    c# 将json数据转为键值对
    Py基础+中级
    深入理解DIP、IoC、DI以及IoC容器(转载)
    错误页面的配置
    JavaScript重载
    关于为空必填js判断
    MyEclipse CI 2018.8.0正式发布(附下载)
  • 原文地址:https://www.cnblogs.com/allegro/p/2019598.html
Copyright © 2011-2022 走看看