aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/file.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-02-02 09:48:10 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2011-02-02 09:48:10 -0500
commitb9c93bb7deadc7cdd00415edc6b38d67a26c1c7a (patch)
treeb490fba351eefdb9ef4feeb9925fae75045fac51 /fs/gfs2/file.c
parentedae38a6431276c50d4b51543c36de258722358e (diff)
GFS2: Improve cluster mmap scalability
The mmap system call grabs a glock when an update to atime maybe required. It does this in order to ensure that the flags on the inode are uptodate, but since it will only mark atime for a future update, an exclusive lock is not required here (one will be taken later when the actual update is performed). Also, the lock can be skipped when the mount is marked noatime in addition to the original check which only looked at the noatime flag for the inode itself. This should increase the scalability of the mmap call when multiple nodes are all mmaping the same file. Reported-by: Scooter Morris <scooter@cgl.ucsf.edu> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r--fs/gfs2/file.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 7cfdcb913363..216ad2774a62 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -448,15 +448,20 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
448{ 448{
449 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); 449 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
450 450
451 if (!(file->f_flags & O_NOATIME)) { 451 if (!(file->f_flags & O_NOATIME) &&
452 !IS_NOATIME(&ip->i_inode)) {
452 struct gfs2_holder i_gh; 453 struct gfs2_holder i_gh;
453 int error; 454 int error;
454 455
455 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); 456 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
456 error = gfs2_glock_nq(&i_gh); 457 error = gfs2_glock_nq(&i_gh);
457 file_accessed(file); 458 if (error == 0) {
458 if (error == 0) 459 file_accessed(file);
459 gfs2_glock_dq_uninit(&i_gh); 460 gfs2_glock_dq(&i_gh);
461 }
462 gfs2_holder_uninit(&i_gh);
463 if (error)
464 return error;
460 } 465 }
461 vma->vm_ops = &gfs2_vm_ops; 466 vma->vm_ops = &gfs2_vm_ops;
462 vma->vm_flags |= VM_CAN_NONLINEAR; 467 vma->vm_flags |= VM_CAN_NONLINEAR;