[Ocfs2-commits] mfasheh commits r1689 - branches/dlm-glue/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Dec 3 19:04:22 CST 2004
Author: mfasheh
Date: 2004-12-03 19:04:21 -0600 (Fri, 03 Dec 2004)
New Revision: 1689
Modified:
branches/dlm-glue/src/alloc.c
branches/dlm-glue/src/inode.c
branches/dlm-glue/src/namei.c
branches/dlm-glue/src/ocfs.h
branches/dlm-glue/src/ocfs2_fs.h
branches/dlm-glue/src/suballoc.c
branches/dlm-glue/src/super.c
Log:
* bring ourselves up to date with trunk r1654
Modified: branches/dlm-glue/src/alloc.c
===================================================================
--- branches/dlm-glue/src/alloc.c 2004-12-03 20:06:28 UTC (rev 1688)
+++ branches/dlm-glue/src/alloc.c 2004-12-04 01:04:21 UTC (rev 1689)
@@ -204,6 +204,7 @@
/* Ok, setup the minimal stuff here. */
strcpy(eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE);
eb->h_blkno = first_blkno;
+ eb->h_fs_generation = osb->fs_generation;
#ifndef OCFS_USE_ALL_METADATA_SUBALLOCATORS
/* we always use node zeros suballocator */
Modified: branches/dlm-glue/src/inode.c
===================================================================
--- branches/dlm-glue/src/inode.c 2004-12-03 20:06:28 UTC (rev 1688)
+++ branches/dlm-glue/src/inode.c 2004-12-04 01:04:21 UTC (rev 1689)
@@ -350,6 +350,15 @@
goto bail;
}
+ if (le32_to_cpu(fe->i_fs_generation) != osb->fs_generation) {
+ LOG_ERROR_ARGS("file entry generation does not match "
+ "superblock! osb->fs_generation=%x, "
+ "fe->i_fs_generation=%x\n",
+ osb->fs_generation,
+ le32_to_cpu(fe->i_fs_generation));
+ goto bail;
+ }
+
if (!inode->u.generic_ip && ocfs_inode_init_private(inode)) {
/* How can we recover gracefully? */
LOG_ERROR_STR("unable to allocate private data for "
Modified: branches/dlm-glue/src/namei.c
===================================================================
--- branches/dlm-glue/src/namei.c 2004-12-03 20:06:28 UTC (rev 1688)
+++ branches/dlm-glue/src/namei.c 2004-12-04 01:04:21 UTC (rev 1689)
@@ -517,6 +517,7 @@
inode->i_generation = osb->s_next_generation++;
spin_unlock(&osb->s_next_gen_lock);
fe->i_generation = cpu_to_le32(inode->i_generation);
+ fe->i_fs_generation = cpu_to_le32(osb->fs_generation);
fe->i_blkno = fe_blkno;
fe->i_suballoc_bit = suballoc_bit;
fe->i_suballoc_node = osb->slot_num;
Modified: branches/dlm-glue/src/ocfs.h
===================================================================
--- branches/dlm-glue/src/ocfs.h 2004-12-03 20:06:28 UTC (rev 1688)
+++ branches/dlm-glue/src/ocfs.h 2004-12-04 01:04:21 UTC (rev 1689)
@@ -342,6 +342,7 @@
u8 *uuid;
u8 *vol_label;
u64 first_cluster_group_blkno;
+ u32 fs_generation;
u32 s_feature_compat;
u32 s_feature_incompat;
Modified: branches/dlm-glue/src/ocfs2_fs.h
===================================================================
--- branches/dlm-glue/src/ocfs2_fs.h 2004-12-03 20:06:28 UTC (rev 1688)
+++ branches/dlm-glue/src/ocfs2_fs.h 2004-12-04 01:04:21 UTC (rev 1689)
@@ -273,7 +273,7 @@
extent_header belongs to */
__u16 h_suballoc_bit; /* Bit offset in suballocater
block group */
- __u32 h_reserved2;
+ __u32 h_fs_generation; /* Must match super block */
__u64 h_blkno; /* Offset on disk, in blocks */
/*20*/ __u64 h_reserved3;
__u64 h_next_leaf_blk; /* Offset on disk, in blocks,
@@ -357,7 +357,9 @@
/*50*/ __u64 i_blkno; /* Offset on disk, in blocks */
__u64 i_last_eb_blk; /* Pointer to last extent
block */
-/*60*/ __u64 i_reserved1[11];
+/*60*/ __u32 i_fs_generation; /* Generation per fs-instance */
+ __u32 i_reserved1; /* Generation per fs-instance */
+/*68*/ __u64 i_reserved2[10];
/*B8*/ union {
__u64 i_pad1; /* Generic way to refer to this
64bit union */
Modified: branches/dlm-glue/src/suballoc.c
===================================================================
--- branches/dlm-glue/src/suballoc.c 2004-12-03 20:06:28 UTC (rev 1688)
+++ branches/dlm-glue/src/suballoc.c 2004-12-04 01:04:21 UTC (rev 1689)
@@ -167,7 +167,7 @@
memset(bg, 0, sb->s_blocksize);
strcpy (bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
- bg->bg_generation = cpu_to_le32(alloc_inode->i_generation);
+ bg->bg_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation);
bg->bg_size = ocfs2_group_bitmap_size(sb);
bg->bg_bits = (u32) cl->cl_cpg * (u32) cl->cl_bpc;
bg->bg_chain = my_chain;
@@ -1249,6 +1249,62 @@
return status;
}
+/* translate a group desc. blkno and it's bitmap offset into
+ * disk cluster offset. */
+static inline u32 ocfs2_desc_bitmap_to_cluster_off(struct inode *inode,
+ u64 bg_blkno,
+ u16 bg_bit_off)
+{
+ ocfs_super *osb = OCFS2_SB(inode->i_sb);
+ u32 cluster = 0;
+
+ OCFS_ASSERT(ocfs2_is_cluster_bitmap(inode));
+
+ if (bg_blkno != osb->first_cluster_group_blkno)
+ cluster = ocfs2_blocks_to_clusters(inode->i_sb, bg_blkno);
+ cluster += (u32) bg_bit_off;
+ return cluster;
+}
+
+/* given a cluster offset, calculate which block group it belongs to
+ * and return that block offset. */
+static inline u64 ocfs2_which_cluster_group(struct inode *inode,
+ u32 cluster)
+{
+ ocfs_super *osb = OCFS2_SB(inode->i_sb);
+ u32 group_no;
+
+ OCFS_ASSERT(ocfs2_is_cluster_bitmap(inode));
+
+ group_no = cluster / osb->bitmap_cpg;
+ if (!group_no)
+ return osb->first_cluster_group_blkno;
+ return ocfs2_clusters_to_blocks(inode->i_sb,
+ group_no * osb->bitmap_cpg);
+}
+
+/* given the block number of a cluster start, calculate which cluster
+ * group and descriptor bitmap offset that corresponds to. */
+static inline void ocfs2_block_to_cluster_group(struct inode *inode,
+ u64 data_blkno,
+ u64 *bg_blkno,
+ u16 *bg_bit_off)
+{
+ ocfs_super *osb = OCFS2_SB(inode->i_sb);
+ u32 data_cluster = ocfs2_blocks_to_clusters(osb->sb, data_blkno);
+
+ OCFS_ASSERT(ocfs2_is_cluster_bitmap(inode));
+
+ *bg_blkno = ocfs2_which_cluster_group(inode,
+ data_cluster);
+
+ if (*bg_blkno == osb->first_cluster_group_blkno)
+ *bg_bit_off = (u16) data_cluster;
+ else
+ *bg_bit_off = (u16) ocfs2_blocks_to_clusters(osb->sb,
+ data_blkno - *bg_blkno);
+}
+
/*
* min_bits - minimum contiguous chunk from this total allocation we
* can handle. set to what we asked for originally for a full
@@ -1477,62 +1533,6 @@
bit, bg_blkno, 1);
}
-/* translate a group desc. blkno and it's bitmap offset into
- * disk cluster offset. */
-static inline u32 ocfs2_desc_bitmap_to_cluster_off(struct inode *inode,
- u64 bg_blkno,
- u16 bg_bit_off)
-{
- ocfs_super *osb = OCFS2_SB(inode->i_sb);
- u32 cluster = 0;
-
- OCFS_ASSERT(ocfs2_is_cluster_bitmap(inode));
-
- if (bg_blkno != osb->first_cluster_group_blkno)
- cluster = ocfs2_blocks_to_clusters(inode->i_sb, bg_blkno);
- cluster += (u32) bg_bit_off;
- return cluster;
-}
-
-/* given a cluster offset, calculate which block group it belongs to
- * and return that block offset. */
-static inline u64 ocfs2_which_cluster_group(struct inode *inode,
- u32 cluster)
-{
- ocfs_super *osb = OCFS2_SB(inode->i_sb);
- u32 group_no;
-
- OCFS_ASSERT(ocfs2_is_cluster_bitmap(inode));
-
- group_no = cluster / osb->bitmap_cpg;
- if (!group_no)
- return osb->first_cluster_group_blkno;
- return ocfs2_clusters_to_blocks(inode->i_sb,
- group_no * osb->bitmap_cpg);
-}
-
-/* given the block number of a cluster start, calculate which cluster
- * group and descriptor bitmap offset that corresponds to. */
-static inline void ocfs2_block_to_cluster_group(struct inode *inode,
- u64 data_blkno,
- u64 *bg_blkno,
- u16 *bg_bit_off)
-{
- ocfs_super *osb = OCFS2_SB(inode->i_sb);
- u32 data_cluster = ocfs2_blocks_to_clusters(osb->sb, data_blkno);
-
- OCFS_ASSERT(ocfs2_is_cluster_bitmap(inode));
-
- *bg_blkno = ocfs2_which_cluster_group(inode,
- data_cluster);
-
- if (*bg_blkno == osb->first_cluster_group_blkno)
- *bg_bit_off = (u16) data_cluster;
- else
- *bg_bit_off = (u16) ocfs2_blocks_to_clusters(osb->sb,
- data_blkno - *bg_blkno);
-}
-
int ocfs_free_clusters(ocfs_journal_handle *handle,
struct inode *bitmap_inode,
struct buffer_head *bitmap_bh,
Modified: branches/dlm-glue/src/super.c
===================================================================
--- branches/dlm-glue/src/super.c 2004-12-03 20:06:28 UTC (rev 1688)
+++ branches/dlm-glue/src/super.c 2004-12-04 01:04:21 UTC (rev 1689)
@@ -1234,6 +1234,7 @@
osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno);
osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno);
osb->first_cluster_group_blkno = le64_to_cpu(di->id2.i_super.s_first_cluster_group);
+ osb->fs_generation = le32_to_cpu(di->i_fs_generation);
printk("vol_label: %s\n", osb->vol_label);
{
int ttt;
More information about the Ocfs2-commits
mailing list