Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42392
b: refs/heads/master
c: 25899de
h: refs/heads/master
v: v3
  • Loading branch information
Tiger Yang authored and Mark Fasheh committed Dec 2, 2006
1 parent 712f69d commit cf0210d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7f1a37e31f94b4f1c123d32ce9f69205ab2095bd
refs/heads/master: 25899deef46c226c49c53b42c00e0f032379c04b
13 changes: 11 additions & 2 deletions trunk/fs/ocfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,23 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
struct inode *inode = filp->f_dentry->d_inode;
struct super_block * sb = inode->i_sb;
unsigned int ra_sectors = 16;
int lock_level = 0;

mlog_entry("dirino=%llu\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno);

stored = 0;
bh = NULL;

error = ocfs2_meta_lock(inode, NULL, 0);
error = ocfs2_meta_lock_atime(inode, filp->f_vfsmnt, &lock_level);
if (lock_level && error >= 0) {
/* We release EX lock which used to update atime
* and get PR lock again to reduce contention
* on commonly accessed directories. */
ocfs2_meta_unlock(inode, 1);
lock_level = 0;
error = ocfs2_meta_lock(inode, NULL, 0);
}
if (error < 0) {
if (error != -ENOENT)
mlog_errno(error);
Expand Down Expand Up @@ -198,7 +207,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)

stored = 0;
bail:
ocfs2_meta_unlock(inode, 0);
ocfs2_meta_unlock(inode, lock_level);

bail_nolock:
mlog_exit(stored);
Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
unsigned long nr_segs,
loff_t pos)
{
int ret = 0, rw_level = -1, have_alloc_sem = 0;
int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
struct file *filp = iocb->ki_filp;
struct inode *inode = filp->f_dentry->d_inode;

Expand Down Expand Up @@ -1296,12 +1296,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
* like i_size. This allows the checks down below
* generic_file_aio_read() a chance of actually working.
*/
ret = ocfs2_meta_lock(inode, NULL, 0);
ret = ocfs2_meta_lock_atime(inode, filp->f_vfsmnt, &lock_level);
if (ret < 0) {
mlog_errno(ret);
goto bail;
}
ocfs2_meta_unlock(inode, 0);
ocfs2_meta_unlock(inode, lock_level);

ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
if (ret == -EINVAL)
Expand Down
11 changes: 10 additions & 1 deletion trunk/fs/ocfs2/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ static struct vm_operations_struct ocfs2_file_vm_ops = {

int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
{
int ret = 0, lock_level = 0;

/* We don't want to support shared writable mappings yet. */
if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE))
&& ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) {
Expand All @@ -91,7 +93,14 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
return -EINVAL;
}

file_accessed(file);
ret = ocfs2_meta_lock_atime(file->f_dentry->d_inode,
file->f_vfsmnt, &lock_level);
if (ret < 0) {
mlog_errno(ret);
goto out;
}
ocfs2_meta_unlock(file->f_dentry->d_inode, lock_level);
out:
vma->vm_ops = &ocfs2_file_vm_ops;
return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/ocfs2/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ static int ocfs2_readlink(struct dentry *dentry,
goto out;
}

/*
* Without vfsmount we can't update atime now,
* but we will update atime here ultimately.
*/
ret = vfs_readlink(dentry, buffer, buflen, link);

brelse(bh);
Expand Down

0 comments on commit cf0210d

Please sign in to comment.