Commit 724feb8d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] readdir() cleanups

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.
parent 68f79793
......@@ -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;
......
......@@ -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)
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -224,7 +224,6 @@ static int ext3_readdir(struct file * filp,
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;
}
......
......@@ -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;
......
......@@ -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");
......
......@@ -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);
......
......@@ -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));
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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:
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -166,7 +166,6 @@ ufs_readdir (struct file * filp, void * dirent, filldir_t filldir)
offset = 0;
brelse (bh);
}
update_atime(inode);
unlock_kernel();
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment