diff options
-rw-r--r-- | fs/ocfs2/dir.c | 13 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/mmap.c | 11 | ||||
-rw-r--r-- | fs/ocfs2/symlink.c | 4 |
4 files changed, 28 insertions, 6 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 5efea44d780d..baad2aa27c14 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -82,6 +82,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
82 | struct inode *inode = filp->f_dentry->d_inode; | 82 | struct inode *inode = filp->f_dentry->d_inode; |
83 | struct super_block * sb = inode->i_sb; | 83 | struct super_block * sb = inode->i_sb; |
84 | unsigned int ra_sectors = 16; | 84 | unsigned int ra_sectors = 16; |
85 | int lock_level = 0; | ||
85 | 86 | ||
86 | mlog_entry("dirino=%llu\n", | 87 | mlog_entry("dirino=%llu\n", |
87 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 88 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
@@ -89,7 +90,15 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
89 | stored = 0; | 90 | stored = 0; |
90 | bh = NULL; | 91 | bh = NULL; |
91 | 92 | ||
92 | error = ocfs2_meta_lock(inode, NULL, 0); | 93 | error = ocfs2_meta_lock_atime(inode, filp->f_vfsmnt, &lock_level); |
94 | if (lock_level && error >= 0) { | ||
95 | /* We release EX lock which used to update atime | ||
96 | * and get PR lock again to reduce contention | ||
97 | * on commonly accessed directories. */ | ||
98 | ocfs2_meta_unlock(inode, 1); | ||
99 | lock_level = 0; | ||
100 | error = ocfs2_meta_lock(inode, NULL, 0); | ||
101 | } | ||
93 | if (error < 0) { | 102 | if (error < 0) { |
94 | if (error != -ENOENT) | 103 | if (error != -ENOENT) |
95 | mlog_errno(error); | 104 | mlog_errno(error); |
@@ -198,7 +207,7 @@ revalidate: | |||
198 | 207 | ||
199 | stored = 0; | 208 | stored = 0; |
200 | bail: | 209 | bail: |
201 | ocfs2_meta_unlock(inode, 0); | 210 | ocfs2_meta_unlock(inode, lock_level); |
202 | 211 | ||
203 | bail_nolock: | 212 | bail_nolock: |
204 | mlog_exit(stored); | 213 | mlog_exit(stored); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index e82288f7cf21..b64ef7c6e2d2 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1254,7 +1254,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
1254 | unsigned long nr_segs, | 1254 | unsigned long nr_segs, |
1255 | loff_t pos) | 1255 | loff_t pos) |
1256 | { | 1256 | { |
1257 | int ret = 0, rw_level = -1, have_alloc_sem = 0; | 1257 | int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0; |
1258 | struct file *filp = iocb->ki_filp; | 1258 | struct file *filp = iocb->ki_filp; |
1259 | struct inode *inode = filp->f_dentry->d_inode; | 1259 | struct inode *inode = filp->f_dentry->d_inode; |
1260 | 1260 | ||
@@ -1296,12 +1296,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
1296 | * like i_size. This allows the checks down below | 1296 | * like i_size. This allows the checks down below |
1297 | * generic_file_aio_read() a chance of actually working. | 1297 | * generic_file_aio_read() a chance of actually working. |
1298 | */ | 1298 | */ |
1299 | ret = ocfs2_meta_lock(inode, NULL, 0); | 1299 | ret = ocfs2_meta_lock_atime(inode, filp->f_vfsmnt, &lock_level); |
1300 | if (ret < 0) { | 1300 | if (ret < 0) { |
1301 | mlog_errno(ret); | 1301 | mlog_errno(ret); |
1302 | goto bail; | 1302 | goto bail; |
1303 | } | 1303 | } |
1304 | ocfs2_meta_unlock(inode, 0); | 1304 | ocfs2_meta_unlock(inode, lock_level); |
1305 | 1305 | ||
1306 | ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); | 1306 | ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); |
1307 | if (ret == -EINVAL) | 1307 | if (ret == -EINVAL) |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 83934e33e5b0..69f85ae392dc 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -82,6 +82,8 @@ static struct vm_operations_struct ocfs2_file_vm_ops = { | |||
82 | 82 | ||
83 | int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) | 83 | int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) |
84 | { | 84 | { |
85 | int ret = 0, lock_level = 0; | ||
86 | |||
85 | /* We don't want to support shared writable mappings yet. */ | 87 | /* We don't want to support shared writable mappings yet. */ |
86 | if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) | 88 | if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) |
87 | && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { | 89 | && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { |
@@ -91,7 +93,14 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) | |||
91 | return -EINVAL; | 93 | return -EINVAL; |
92 | } | 94 | } |
93 | 95 | ||
94 | file_accessed(file); | 96 | ret = ocfs2_meta_lock_atime(file->f_dentry->d_inode, |
97 | file->f_vfsmnt, &lock_level); | ||
98 | if (ret < 0) { | ||
99 | mlog_errno(ret); | ||
100 | goto out; | ||
101 | } | ||
102 | ocfs2_meta_unlock(file->f_dentry->d_inode, lock_level); | ||
103 | out: | ||
95 | vma->vm_ops = &ocfs2_file_vm_ops; | 104 | vma->vm_ops = &ocfs2_file_vm_ops; |
96 | return 0; | 105 | return 0; |
97 | } | 106 | } |
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index c0f68aa6c175..957d6878b03e 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c | |||
@@ -126,6 +126,10 @@ static int ocfs2_readlink(struct dentry *dentry, | |||
126 | goto out; | 126 | goto out; |
127 | } | 127 | } |
128 | 128 | ||
129 | /* | ||
130 | * Without vfsmount we can't update atime now, | ||
131 | * but we will update atime here ultimately. | ||
132 | */ | ||
129 | ret = vfs_readlink(dentry, buffer, buflen, link); | 133 | ret = vfs_readlink(dentry, buffer, buflen, link); |
130 | 134 | ||
131 | brelse(bh); | 135 | brelse(bh); |