aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-09-12 18:35:49 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-09-24 16:50:45 -0400
commitf9e2d82e6395cfa0802446b54b63cc412089d82c (patch)
treecdf647041c713d3cbc8b1e0d4006c9440184e336 /fs
parent4d3b83f7364269b66cdda271f680bd99e77afd96 (diff)
ocfs2: Encode i_generation in the meta data lvb
When i_generation is removed from the lockname, this will help us determine whether a meta data lvb has information that is in sync with the local struct inode. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/dlmglue.c14
-rw-r--r--fs/ocfs2/dlmglue.h5
2 files changed, 12 insertions, 7 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index f80fb14ee815..6cd84dffbbf4 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -1427,6 +1427,7 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode)
1427 lvb->lvb_imtime_packed = 1427 lvb->lvb_imtime_packed =
1428 cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime)); 1428 cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime));
1429 lvb->lvb_iattr = cpu_to_be32(oi->ip_attr); 1429 lvb->lvb_iattr = cpu_to_be32(oi->ip_attr);
1430 lvb->lvb_igeneration = cpu_to_be32(inode->i_generation);
1430 1431
1431 mlog_meta_lvb(0, lockres); 1432 mlog_meta_lvb(0, lockres);
1432 1433
@@ -1482,11 +1483,13 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
1482 mlog_exit_void(); 1483 mlog_exit_void();
1483} 1484}
1484 1485
1485static inline int ocfs2_meta_lvb_is_trustable(struct ocfs2_lock_res *lockres) 1486static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode,
1487 struct ocfs2_lock_res *lockres)
1486{ 1488{
1487 struct ocfs2_meta_lvb *lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb; 1489 struct ocfs2_meta_lvb *lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb;
1488 1490
1489 if (lvb->lvb_version == OCFS2_LVB_VERSION) 1491 if (lvb->lvb_version == OCFS2_LVB_VERSION
1492 && be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation)
1490 return 1; 1493 return 1;
1491 return 0; 1494 return 0;
1492} 1495}
@@ -1583,7 +1586,7 @@ static int ocfs2_meta_lock_update(struct inode *inode,
1583 * map (directories, bitmap files, etc) */ 1586 * map (directories, bitmap files, etc) */
1584 ocfs2_extent_map_trunc(inode, 0); 1587 ocfs2_extent_map_trunc(inode, 0);
1585 1588
1586 if (ocfs2_meta_lvb_is_trustable(lockres)) { 1589 if (ocfs2_meta_lvb_is_trustable(inode, lockres)) {
1587 mlog(0, "Trusting LVB on inode %llu\n", 1590 mlog(0, "Trusting LVB on inode %llu\n",
1588 (unsigned long long)oi->ip_blkno); 1591 (unsigned long long)oi->ip_blkno);
1589 ocfs2_refresh_inode_from_lvb(inode); 1592 ocfs2_refresh_inode_from_lvb(inode);
@@ -3166,8 +3169,9 @@ void ocfs2_dump_meta_lvb_info(u64 level,
3166 3169
3167 mlog(level, "LVB information for %s (called from %s:%u):\n", 3170 mlog(level, "LVB information for %s (called from %s:%u):\n",
3168 lockres->l_name, function, line); 3171 lockres->l_name, function, line);
3169 mlog(level, "version: %u, clusters: %u\n", 3172 mlog(level, "version: %u, clusters: %u, generation: 0x%x\n",
3170 lvb->lvb_version, be32_to_cpu(lvb->lvb_iclusters)); 3173 lvb->lvb_version, be32_to_cpu(lvb->lvb_iclusters),
3174 be32_to_cpu(lvb->lvb_igeneration));
3171 mlog(level, "size: %llu, uid %u, gid %u, mode 0x%x\n", 3175 mlog(level, "size: %llu, uid %u, gid %u, mode 0x%x\n",
3172 (unsigned long long)be64_to_cpu(lvb->lvb_isize), 3176 (unsigned long long)be64_to_cpu(lvb->lvb_isize),
3173 be32_to_cpu(lvb->lvb_iuid), be32_to_cpu(lvb->lvb_igid), 3177 be32_to_cpu(lvb->lvb_iuid), be32_to_cpu(lvb->lvb_igid),
diff --git a/fs/ocfs2/dlmglue.h b/fs/ocfs2/dlmglue.h
index 3476a1611341..45a74f44b688 100644
--- a/fs/ocfs2/dlmglue.h
+++ b/fs/ocfs2/dlmglue.h
@@ -29,7 +29,7 @@
29 29
30#include "dcache.h" 30#include "dcache.h"
31 31
32#define OCFS2_LVB_VERSION 3 32#define OCFS2_LVB_VERSION 4
33 33
34struct ocfs2_meta_lvb { 34struct ocfs2_meta_lvb {
35 __be16 lvb_reserved0; 35 __be16 lvb_reserved0;
@@ -45,7 +45,8 @@ struct ocfs2_meta_lvb {
45 __be16 lvb_imode; 45 __be16 lvb_imode;
46 __be16 lvb_inlink; 46 __be16 lvb_inlink;
47 __be32 lvb_iattr; 47 __be32 lvb_iattr;
48 __be32 lvb_reserved[2]; 48 __be32 lvb_igeneration;
49 __be32 lvb_reserved2;
49}; 50};
50 51
51/* ocfs2_meta_lock_full() and ocfs2_data_lock_full() 'arg_flags' flags */ 52/* ocfs2_meta_lock_full() and ocfs2_data_lock_full() 'arg_flags' flags */