aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/ops_file.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 5d82e91887e3..0ee7bd287c5a 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -425,33 +425,36 @@ static struct vm_operations_struct gfs2_vm_ops = {
425 .page_mkwrite = gfs2_page_mkwrite, 425 .page_mkwrite = gfs2_page_mkwrite,
426}; 426};
427 427
428
429/** 428/**
430 * gfs2_mmap - 429 * gfs2_mmap -
431 * @file: The file to map 430 * @file: The file to map
432 * @vma: The VMA which described the mapping 431 * @vma: The VMA which described the mapping
433 * 432 *
434 * Returns: 0 or error code 433 * There is no need to get a lock here unless we should be updating
434 * atime. We ignore any locking errors since the only consequence is
435 * a missed atime update (which will just be deferred until later).
436 *
437 * Returns: 0
435 */ 438 */
436 439
437static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) 440static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
438{ 441{
439 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); 442 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
440 struct gfs2_holder i_gh;
441 int error;
442 443
443 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); 444 if (!(file->f_flags & O_NOATIME)) {
444 error = gfs2_glock_nq(&i_gh); 445 struct gfs2_holder i_gh;
445 if (error) { 446 int error;
446 gfs2_holder_uninit(&i_gh);
447 return error;
448 }
449 447
448 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
449 error = gfs2_glock_nq(&i_gh);
450 file_accessed(file);
451 if (error == 0)
452 gfs2_glock_dq_uninit(&i_gh);
453 }
450 vma->vm_ops = &gfs2_vm_ops; 454 vma->vm_ops = &gfs2_vm_ops;
455 vma->vm_flags |= VM_CAN_NONLINEAR;
451 456
452 gfs2_glock_dq_uninit(&i_gh); 457 return 0;
453
454 return error;
455} 458}
456 459
457/** 460/**