diff options
author | Tiger Yang <tiger.yang@oracle.com> | 2006-11-15 02:48:42 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-12-01 21:28:51 -0500 |
commit | 7f1a37e31f94b4f1c123d32ce9f69205ab2095bd (patch) | |
tree | 7d2136573966de80d031e7320db11c15d7f93a92 /fs/ocfs2/dlmglue.c | |
parent | 8659ac25b434fcc61cf7797f4b69edc3eaaffb55 (diff) |
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.c | 39 |
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 @@ | |||
49 | #include "dcache.h" | 49 | #include "dcache.h" |
50 | #include "dlmglue.h" | 50 | #include "dlmglue.h" |
51 | #include "extent_map.h" | 51 | #include "extent_map.h" |
52 | #include "file.h" | ||
52 | #include "heartbeat.h" | 53 | #include "heartbeat.h" |
53 | #include "inode.h" | 54 | #include "inode.h" |
54 | #include "journal.h" | 55 | #include "journal.h" |
@@ -1723,6 +1724,44 @@ int ocfs2_meta_lock_with_page(struct inode *inode, | |||
1723 | return ret; | 1724 | return ret; |
1724 | } | 1725 | } |
1725 | 1726 | ||
1727 | int ocfs2_meta_lock_atime(struct inode *inode, | ||
1728 | struct vfsmount *vfsmnt, | ||
1729 | int *level) | ||
1730 | { | ||
1731 | int ret; | ||
1732 | |||
1733 | mlog_entry_void(); | ||
1734 | ret = ocfs2_meta_lock(inode, NULL, 0); | ||
1735 | if (ret < 0) { | ||
1736 | mlog_errno(ret); | ||
1737 | return ret; | ||
1738 | } | ||
1739 | |||
1740 | /* | ||
1741 | * If we should update atime, we will get EX lock, | ||
1742 | * otherwise we just get PR lock. | ||
1743 | */ | ||
1744 | if (ocfs2_should_update_atime(inode, vfsmnt)) { | ||
1745 | struct buffer_head *bh = NULL; | ||
1746 | |||
1747 | ocfs2_meta_unlock(inode, 0); | ||
1748 | ret = ocfs2_meta_lock(inode, &bh, 1); | ||
1749 | if (ret < 0) { | ||
1750 | mlog_errno(ret); | ||
1751 | return ret; | ||
1752 | } | ||
1753 | *level = 1; | ||
1754 | if (ocfs2_should_update_atime(inode, vfsmnt)) | ||
1755 | ocfs2_update_inode_atime(inode, bh); | ||
1756 | if (bh) | ||
1757 | brelse(bh); | ||
1758 | } else | ||
1759 | *level = 0; | ||
1760 | |||
1761 | mlog_exit(ret); | ||
1762 | return ret; | ||
1763 | } | ||
1764 | |||
1726 | void ocfs2_meta_unlock(struct inode *inode, | 1765 | void ocfs2_meta_unlock(struct inode *inode, |
1727 | int ex) | 1766 | int ex) |
1728 | { | 1767 | { |