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."

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

     

  • 相关阅读:
    Object.defineProperty 监听对象属性变化
    Object.create(null) 和 {} 区别
    Vue 源码 基础知识点
    js setTimeout和setInterval区别
    Fiddler抓包工具使用方法
    使用 Jmeter 做 Web 接口测试
    Python 操作 SQL 数据库 (ORCAL)
    python连接MySQL数据库问题
    抓包工具Charles基本用法
    Python数据分析之pandas学习
  • 原文地址:https://www.cnblogs.com/allegro/p/2019598.html
Copyright © 2011-2022 走看看