summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlmglue.c
diff options
context:
space:
mode:
authorTiger Yang <tiger.yang@oracle.com>2006-11-15 15:48:42 +0800
committerMark Fasheh <mark.fasheh@oracle.com>2006-12-01 18:28:51 -0800
commit7f1a37e31f94b4f1c123d32ce9f69205ab2095bd (patch)
tree7d2136573966de80d031e7320db11c15d7f93a92 /fs/ocfs2/dlmglue.c
parent8659ac25b434fcc61cf7797f4b69edc3eaaffb55 (diff)
downloadlinux-7f1a37e31f94b4f1c123d32ce9f69205ab2095bd.tar.gz
linux-7f1a37e31f94b4f1c123d32ce9f69205ab2095bd.tar.bz2
linux-7f1a37e31f94b4f1c123d32ce9f69205ab2095bd.zip
ocfs2: core atime update functions
This patch adds the core routines for updating atime in ocfs2. Signed-off-by: Tiger Yang <tiger.yang@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlmglue.c')
-rw-r--r--fs/ocfs2/dlmglue.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 7a22118ef046..69fba16efbd1 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -49,6 +49,7 @@
#include "dcache.h"
#include "dlmglue.h"
#include "extent_map.h"
+#include "file.h"
#include "heartbeat.h"
#include "inode.h"
#include "journal.h"
@@ -1723,6 +1724,44 @@ int ocfs2_meta_lock_with_page(struct inode *inode,
return ret;
}
+int ocfs2_meta_lock_atime(struct inode *inode,
+ struct vfsmount *vfsmnt,
+ int *level)
+{
+ int ret;
+
+ mlog_entry_void();
+ ret = ocfs2_meta_lock(inode, NULL, 0);
+ if (ret < 0) {
+ mlog_errno(ret);
+ return ret;
+ }
+
+ /*
+ * If we should update atime, we will get EX lock,
+ * otherwise we just get PR lock.
+ */
+ if (ocfs2_should_update_atime(inode, vfsmnt)) {
+ struct buffer_head *bh = NULL;
+
+ ocfs2_meta_unlock(inode, 0);
+ ret = ocfs2_meta_lock(inode, &bh, 1);
+ if (ret < 0) {
+ mlog_errno(ret);
+ return ret;
+ }
+ *level = 1;
+ if (ocfs2_should_update_atime(inode, vfsmnt))
+ ocfs2_update_inode_atime(inode, bh);
+ if (bh)
+ brelse(bh);
+ } else
+ *level = 0;
+
+ mlog_exit(ret);
+ return ret;
+}
+
void ocfs2_meta_unlock(struct inode *inode,
int ex)
{