summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dir.c
diff options
context:
space:
mode:
authorTiger Yang <tiger.yang@oracle.com>2006-11-15 15:49:02 +0800
committerMark Fasheh <mark.fasheh@oracle.com>2006-12-01 18:28:58 -0800
commit25899deef46c226c49c53b42c00e0f032379c04b (patch)
treeac8c19482ab05ee2e13d874eecd8b2eaa507a156 /fs/ocfs2/dir.c
parent7f1a37e31f94b4f1c123d32ce9f69205ab2095bd (diff)
downloadop-kernel-dev-25899deef46c226c49c53b42c00e0f032379c04b.zip
op-kernel-dev-25899deef46c226c49c53b42c00e0f032379c04b.tar.gz
ocfs2: update file system paths to set atime
Conditionally update atime in ocfs2_file_aio_read(), ocfs2_readdir() and ocfs2_mmap(). Signed-off-by: Tiger Yang <tiger.yang@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dir.c')
-rw-r--r--fs/ocfs2/dir.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 5efea44..baad2aa 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)
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);
@@ -89,7 +90,15 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
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);
@@ -198,7 +207,7 @@ revalidate:
stored = 0;
bail:
- ocfs2_meta_unlock(inode, 0);
+ ocfs2_meta_unlock(inode, lock_level);
bail_nolock:
mlog_exit(stored);
OpenPOWER on IntegriCloud