]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] readdir() cleanups
authorAndrew Morton <akpm@osdl.org>
Fri, 12 Mar 2004 00:11:54 +0000 (16:11 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 12 Mar 2004 00:11:54 +0000 (16:11 -0800)
From: <viro@parcelfarce.linux.theplanet.co.uk>

cramfs and freevxfs explicitly mark themselves readonly (as other r/o fs
do).

afs marked noatime (ACKed by maintainer)

filesystems that do not do update_atime() in their ->readdir() had been
explicitly marked nodiratime.  NOTE: cifs, coda and ncpfs almost certainly
need full noatime as we currently have in nfs and afs.

update_atime() call shifted to callers of ->readdir() and out of
->readdir() instances.  Bugs caught:

  dcache_readdir() updated atime only if it reached EOF.

  bfs_readdir() - ditto.

  qnx4_readdir() - ditto.

26 files changed:
fs/adfs/super.c
fs/affs/super.c
fs/afs/inode.c
fs/bfs/dir.c
fs/cifs/cifsfs.c
fs/coda/dir.c
fs/coda/inode.c
fs/cramfs/inode.c
fs/ext2/dir.c
fs/ext3/dir.c
fs/fat/inode.c
fs/freevxfs/vxfs_super.c
fs/hfs/super.c
fs/jffs/inode-v23.c
fs/jffs2/super.c
fs/libfs.c
fs/minix/dir.c
fs/ncpfs/inode.c
fs/proc/inode.c
fs/qnx4/dir.c
fs/readdir.c
fs/reiserfs/dir.c
fs/smbfs/inode.c
fs/sysv/dir.c
fs/udf/dir.c
fs/ufs/dir.c

index eba980885e8d5653cc07f86f81317939bda738bb..c667ba8bcfdfc178af780f90fdccf401f07b5ce0 100644 (file)
@@ -335,6 +335,8 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
        struct adfs_sb_info *asb;
        struct inode *root;
 
+       sb->s_flags |= MS_NODIRATIME;
+
        asb = kmalloc(sizeof(*asb), GFP_KERNEL);
        if (!asb)
                return -ENOMEM;
index 6f8e2b9530697199003cb31ec81f90275e45a6ae..f8564e1556e9e1bc2e75a33b5f9839982d402f50 100644 (file)
@@ -293,6 +293,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
 
        sb->s_magic             = AFFS_SUPER_MAGIC;
        sb->s_op                = &affs_sops;
+       sb->s_flags |= MS_NODIRATIME;
 
        sbi = kmalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
        if (!sbi)
index 1f5241d0d4c10dc02e14dc24370f90f61a829c89..fc2c1a93653a59c4a16b7bd15b7f41ced1114e50 100644 (file)
@@ -188,6 +188,7 @@ inline int afs_iget(struct super_block *sb, struct afs_fid *fid,
 #endif
 
        /* okay... it's a new inode */
+       inode->i_flags |= S_NOATIME;
        vnode->flags |= AFS_VNODE_CHANGED;
        ret = afs_inode_fetch_status(inode);
        if (ret<0)
index 7e5b4781eb250253afb38525d84c7a52d5feab25..09db6f39c4061df1002a57c596eb6e337b20df21 100644 (file)
@@ -65,7 +65,6 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir)
                brelse(bh);
        }
 
-       update_atime(dir);
        unlock_kernel();
        return 0;       
 }
index 0ed3315bdcdd0449dd7ed6b3ea40f613f04b2148..8be5f19797ce5e5da0719c8e93634138001303e8 100644 (file)
@@ -77,6 +77,7 @@ cifs_read_super(struct super_block *sb, void *data,
        struct cifs_sb_info *cifs_sb;
        int rc = 0;
 
+       sb->s_flags |= MS_NODIRATIME; /* and probably even noatime */
        sb->s_fs_info = kmalloc(sizeof(struct cifs_sb_info),GFP_KERNEL);
        cifs_sb = CIFS_SB(sb);
        if(cifs_sb == NULL)
index 2244a2cfdf7aeca5c94ef6b9bf2634c7abfb5e62..321024863919ce0e9cefff2cdeabd956a9950c77 100644 (file)
@@ -510,8 +510,10 @@ int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir)
                        goto out;
 
                ret = -ENOENT;
-               if (!IS_DEADDIR(host_inode))
+               if (!IS_DEADDIR(host_inode)) {
                        ret = host_file->f_op->readdir(host_file, filldir, dirent);
+                       update_atime(host_inode);
+               }
        }
 out:
        coda_file->f_pos = host_file->f_pos;
index 07e513b0b6bf3a46c74c0ae115c753f41ca96ac0..7c6d48dc96774c896415d8daccb75a172ab751ca 100644 (file)
@@ -171,6 +171,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
        sbi->sbi_vcomm = vc;
 
         sb->s_fs_info = sbi;
+       sb->s_flags |= MS_NODIRATIME; /* probably even noatime */
         sb->s_blocksize = 1024;        /* XXXXX  what do we put here?? */
         sb->s_blocksize_bits = 10;
         sb->s_magic = CODA_SUPER_MAGIC;
index e25bb03939ca84f44cd3c9a96cde86a6819d8e02..89e7b3d1db42a6f9a6af72e07b5a91e1cbc68254 100644 (file)
@@ -201,6 +201,8 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
        struct cramfs_sb_info *sbi;
        struct inode *root;
 
+       sb->s_flags |= MS_RDONLY;
+
        sbi = kmalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
index 78bc2cd92cf385473ff622af3ff338eab43fe504..4f24afb643c001b87a61a294f780a3838bb7c540 100644 (file)
@@ -310,7 +310,6 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
 done:
        filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
        filp->f_version = inode->i_version;
-       update_atime(inode);
        return 0;
 }
 
index b9c64eb1d6645ea94c6340b8b43f7afa7760a8b4..76ad9815fb20abaa9fac72e0b07f0353e0cf1c85 100644 (file)
@@ -224,7 +224,6 @@ revalidate:
                offset = 0;
                brelse (bh);
        }
-       update_atime(inode);
 out:
        return ret;
 }
@@ -506,7 +505,6 @@ static int ext3_dx_readdir(struct file * filp,
        }
 finished:
        info->last_pos = filp->f_pos;
-       update_atime(inode);
        return 0;
 }
 
index e5930b49ec7748bb52bec5e91fae57764b9b9f67..61989dd8dd7e869031ccc73eb7852bc8691b9145 100644 (file)
@@ -778,6 +778,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
        sb->s_fs_info = sbi;
        memset(sbi, 0, sizeof(struct msdos_sb_info));
 
+       sb->s_flags |= MS_NODIRATIME;
        sb->s_magic = MSDOS_SUPER_MAGIC;
        sb->s_op = &fat_sops;
        sb->s_export_op = &fat_export_ops;
index 354a05efc737c73cb5c292e2095aaa66b6e1728b..ebac447cc2009fa3740dd56b852dfa6682e2ec81 100644 (file)
@@ -145,6 +145,8 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
        u_long                  bsize;
        struct inode *root;
 
+       sbp->s_flags |= MS_RDONLY;
+
        infp = kmalloc(sizeof(*infp), GFP_KERNEL);
        if (!infp) {
                printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n");
index 54654573f53657a44abfb3140b6cdadc8e3b3b91..3d1e3d161880ff9f9581ed7171854c7106c2f919 100644 (file)
@@ -268,6 +268,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
        }
 
        sb->s_op = &hfs_super_operations;
+       sb->s_flags |= MS_NODIRATIME;
        init_MUTEX(&sbi->bitmap_lock);
 
        res = hfs_mdb_get(sb);
index 97cd3526636c9b9669a75068fbbc8380d0a03464..80e7b3f445105b4964af9be255d1e9f935110d00 100644 (file)
@@ -70,6 +70,8 @@ static int jffs_fill_super(struct super_block *sb, void *data, int silent)
        struct inode *root_inode;
        struct jffs_control *c;
 
+       sb->s_flags |= MS_NODIRATIME;
+
        D1(printk(KERN_NOTICE "JFFS: Trying to mount device %s.\n",
                  sb->s_id));
 
index 0f662f5d8a81045ad11fd7755603327ef44d2504..6442ed4da4ddac92f1e5169aa1efc3c0693a3bb0 100644 (file)
@@ -129,6 +129,7 @@ static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type,
                  mtd->index, mtd->name));
 
        sb->s_op = &jffs2_super_operations;
+       sb->s_flags |= MS_NODIRATIME;
 
        ret = jffs2_do_fill_super(sb, data, (flags&MS_VERBOSE)?1:0);
 
index a0e9c087b054c76a4e5f5fa573bf0a3469498ab9..dfe6ac5ac928bc02928f4e068999d79b915fe926 100644 (file)
@@ -155,7 +155,6 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
                        }
                        spin_unlock(&dcache_lock);
        }
-       update_atime(dentry->d_inode);
        return 0;
 }
 
index 8aa973d7a734d03ea68fc31058cb2fada6da09ad..97c3c3debd576bd30fe5c5e710768671a635c8e1 100644 (file)
@@ -127,7 +127,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
 
 done:
        filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
-       update_atime(inode);
        unlock_kernel();
        return 0;
 }
index bfae2891f3aa060c18c47941bf438d34c0d561a1..9750a4f49940ab2f2e4ab2b6bc53540d85860d6d 100644 (file)
@@ -479,6 +479,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
        else
                default_bufsize = 1024;
 
+       sb->s_flags |= MS_NODIRATIME;   /* probably even noatime */
        sb->s_maxbytes = 0xFFFFFFFFU;
        sb->s_blocksize = 1024; /* Eh...  Is this correct? */
        sb->s_blocksize_bits = 10;
index 1427ffb57d5fd6ec309c24569bb07e7bdf24fee5..7405c1cc3e9436061064bfc5cbb8388c6bc83e55 100644 (file)
@@ -231,6 +231,7 @@ int proc_fill_super(struct super_block *s, void *data, int silent)
 {
        struct inode * root_inode;
 
+       s->s_flags |= MS_NODIRATIME;
        s->s_blocksize = 1024;
        s->s_blocksize_bits = 10;
        s->s_magic = PROC_SUPER_MAGIC;
index 77da4bd212f3b6012329295f374a1d7945adf986..cd66147cca04c902331f6807b25b6989b8a6b3fb 100644 (file)
@@ -76,8 +76,6 @@ static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir)
                }
                brelse(bh);
        }
-       update_atime(inode);
-
 out:
        unlock_kernel();
        return 0;
index 88e35d310c08deb6b3175001c88e3df6d3248c89..7104275d457a364c2099696252355dd3adc3127b 100644 (file)
@@ -32,6 +32,7 @@ int vfs_readdir(struct file *file, filldir_t filler, void *buf)
        res = -ENOENT;
        if (!IS_DEADDIR(inode)) {
                res = file->f_op->readdir(file, buf, filler);
+               update_atime(inode);
        }
        up(&inode->i_sem);
 out:
index cbc26ddb5c90a5e75f5c604d5ad5b7f2da5a4bb8..3147195da5bb65e0419548938786ce46a642d1b1 100644 (file)
@@ -186,7 +186,6 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
     filp->f_pos = next_pos;
     pathrelse (&path_to_entry);
     reiserfs_check_path(&path_to_entry) ;
-    update_atime(inode) ;
  out:
     reiserfs_write_unlock(inode->i_sb);
     return ret;
index 1a22ef00cd25be04161bca15608d61002631260a..e94e2cf594b688a926e2be9cb4d86d6d444006b1 100644 (file)
@@ -499,6 +499,7 @@ int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
        if (ver != SMB_MOUNT_OLDVERSION && cpu_to_be32(ver) != SMB_MOUNT_ASCII)
                goto out_wrong_data;
 
+       sb->s_flags |= MS_NODIRATIME;
        sb->s_blocksize = 1024; /* Eh...  Is this correct? */
        sb->s_blocksize_bits = 10;
        sb->s_magic = SMB_SUPER_MAGIC;
index 7d6f0e6199d049341e094073d385aa304c98f11c..b6874dc79991beb4e755a9c44ade15d6bd7a3b09 100644 (file)
@@ -116,7 +116,6 @@ static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir)
 
 done:
        filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
-       update_atime(inode);
        unlock_kernel();
        return 0;
 }
index b1aae2f4791908b4dc42871e82ad923563233a33..b2b977da15323cbebd8d84a76da2e308b3786d67 100644 (file)
@@ -98,7 +98,6 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
        }
 
        result = do_udf_readdir(dir, filp, filldir, dirent);
-       update_atime(dir);
        unlock_kernel();
        return result;
 }
index 463c4bca0b621ad4b3aeb2085299fec0e46e77bc..868d3b4b348cbaf4911e7b9ec54488529129f0fb 100644 (file)
@@ -166,7 +166,6 @@ revalidate:
                offset = 0;
                brelse (bh);
        }
-       update_atime(inode);
        unlock_kernel();
        return 0;
 }