aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-12 18:41:59 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:07:49 -0400
commit292dd27ec76b96cebcef576f330ab121f59ccf05 (patch)
treed98f4d359f610e7dad53eb5b68fdb1517a043fb3 /fs
parent66fb345ddd2d343e36692da0ff66126d7a99dc1b (diff)
ocfs2: move ip_created_trans to struct ocfs2_caching_info
Similar ip_last_trans, ip_created_trans tracks the creation of a journal managed inode. This specifically tracks what transaction created the inode. This is so the code can know if the inode has ever been written to disk. This behavior is desirable for any journal managed object. We move it to struct ocfs2_caching_info as ci_created_trans so that any object using ocfs2_caching_info can rely on this behavior. Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/inode.c1
-rw-r--r--fs/ocfs2/inode.h4
-rw-r--r--fs/ocfs2/journal.h6
-rw-r--r--fs/ocfs2/ocfs2.h3
-rw-r--r--fs/ocfs2/super.c1
-rw-r--r--fs/ocfs2/uptodate.c4
6 files changed, 9 insertions, 10 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index a47750dea059..8a9e7085e99f 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1147,7 +1147,6 @@ void ocfs2_clear_inode(struct inode *inode)
1147 1147
1148 /* Clear all other flags. */ 1148 /* Clear all other flags. */
1149 oi->ip_flags = 0; 1149 oi->ip_flags = 0;
1150 oi->ip_created_trans = 0;
1151 oi->ip_dir_start_lookup = 0; 1150 oi->ip_dir_start_lookup = 0;
1152 oi->ip_blkno = 0ULL; 1151 oi->ip_blkno = 0ULL;
1153 1152
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index 2cae2514e7fb..67392f60629d 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -60,10 +60,6 @@ struct ocfs2_inode_info
60 60
61 u32 ip_dir_start_lookup; 61 u32 ip_dir_start_lookup;
62 62
63 /* next two are protected by trans_inc_lock */
64 /* which transaction were we created on? Zero if none. */
65 unsigned long ip_created_trans;
66
67 struct ocfs2_caching_info ip_metadata_cache; 63 struct ocfs2_caching_info ip_metadata_cache;
68 64
69 struct ocfs2_extent_map ip_extent_map; 65 struct ocfs2_extent_map ip_extent_map;
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index d4ac19739d7c..0bb6754c73f4 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -129,9 +129,9 @@ static inline int ocfs2_inode_is_new(struct inode *inode)
129 return 0; 129 return 0;
130 spin_lock(&trans_inc_lock); 130 spin_lock(&trans_inc_lock);
131 ret = !(time_after(OCFS2_SB(inode->i_sb)->journal->j_trans_id, 131 ret = !(time_after(OCFS2_SB(inode->i_sb)->journal->j_trans_id,
132 OCFS2_I(inode)->ip_created_trans)); 132 INODE_CACHE(inode)->ci_created_trans));
133 if (!ret) 133 if (!ret)
134 OCFS2_I(inode)->ip_created_trans = 0; 134 INODE_CACHE(inode)->ci_created_trans = 0;
135 spin_unlock(&trans_inc_lock); 135 spin_unlock(&trans_inc_lock);
136 return ret; 136 return ret;
137} 137}
@@ -140,7 +140,7 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb,
140 struct inode *inode) 140 struct inode *inode)
141{ 141{
142 spin_lock(&trans_inc_lock); 142 spin_lock(&trans_inc_lock);
143 OCFS2_I(inode)->ip_created_trans = osb->journal->j_trans_id; 143 INODE_CACHE(inode)->ci_created_trans = osb->journal->j_trans_id;
144 spin_unlock(&trans_inc_lock); 144 spin_unlock(&trans_inc_lock);
145} 145}
146 146
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index c9bd7ce30ba6..18b5fea98c91 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -77,6 +77,9 @@ struct ocfs2_caching_info {
77 */ 77 */
78 const struct ocfs2_caching_operations *ci_ops; 78 const struct ocfs2_caching_operations *ci_ops;
79 79
80 /* next two are protected by trans_inc_lock */
81 /* which transaction were we created on? Zero if none. */
82 unsigned long ci_created_trans;
80 /* last transaction we were a part of. */ 83 /* last transaction we were a part of. */
81 unsigned long ci_last_trans; 84 unsigned long ci_last_trans;
82 85
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 4212547e78a2..e35a5052ce3a 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1668,7 +1668,6 @@ static void ocfs2_inode_init_once(void *data)
1668 spin_lock_init(&oi->ip_lock); 1668 spin_lock_init(&oi->ip_lock);
1669 ocfs2_extent_map_init(&oi->vfs_inode); 1669 ocfs2_extent_map_init(&oi->vfs_inode);
1670 INIT_LIST_HEAD(&oi->ip_io_markers); 1670 INIT_LIST_HEAD(&oi->ip_io_markers);
1671 oi->ip_created_trans = 0;
1672 oi->ip_dir_start_lookup = 0; 1671 oi->ip_dir_start_lookup = 0;
1673 1672
1674 init_rwsem(&oi->ip_alloc_sem); 1673 init_rwsem(&oi->ip_alloc_sem);
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
index 81c82200b908..b6284f235d2f 100644
--- a/fs/ocfs2/uptodate.c
+++ b/fs/ocfs2/uptodate.c
@@ -124,8 +124,10 @@ static void ocfs2_metadata_cache_reset(struct ocfs2_caching_info *ci,
124 ci->ci_flags |= OCFS2_CACHE_FL_INLINE; 124 ci->ci_flags |= OCFS2_CACHE_FL_INLINE;
125 ci->ci_num_cached = 0; 125 ci->ci_num_cached = 0;
126 126
127 if (clear) 127 if (clear) {
128 ci->ci_created_trans = 0;
128 ci->ci_last_trans = 0; 129 ci->ci_last_trans = 0;
130 }
129} 131}
130 132
131void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, 133void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci,