diff options
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 | { |
