[Ocfs2-commits] jlbec commits r1049 - branches/format-changes/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Jun 10 21:32:05 CDT 2004
Author: jlbec
Date: 2004-06-10 20:32:03 -0500 (Thu, 10 Jun 2004)
New Revision: 1049
Modified:
branches/format-changes/src/alloc.c
branches/format-changes/src/extmap.c
branches/format-changes/src/file.c
branches/format-changes/src/namei.c
branches/format-changes/src/ocfs.h
branches/format-changes/src/sysfile.c
Log:
o Renamed ocfs2_extent_header to ocfs2_extent_block.
o IS_VALID_EXTENT_BLOCK
o OCFS_EXTENT_BLOCK_SIGNATURE
o OCFS_EXTENT_DATA_SIGNATURE is now dead
Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c 2004-06-11 01:07:13 UTC (rev 1048)
+++ branches/format-changes/src/alloc.c 2004-06-11 01:32:03 UTC (rev 1049)
@@ -78,8 +78,8 @@
static int ocfs_allocate_new_data_node(ocfs_super *osb,
ocfs2_dinode *fe,
u32 new_clusters,
- struct buffer_head *eh_bh,
- u64 *new_eh_blkno,
+ struct buffer_head *eb_bh,
+ u64 *new_eb_blkno,
ocfs_journal_handle *handle,
struct inode *inode);
@@ -96,17 +96,17 @@
u32 num_clusters, int flag,
struct inode *inode);
-static int ocfs_fix_extent_header(ocfs_super *osb,
- struct buffer_head *eh_bh,
- struct inode *inode);
+static int ocfs_fix_extent_block(ocfs_super *osb,
+ struct buffer_head *eb_bh,
+ struct inode *inode);
static int ocfs_split_this_tree(ocfs_super * osb,
- struct buffer_head *eh_bh,
+ struct buffer_head *eb_bh,
ocfs_journal_handle *handle,
ocfs2_dinode *fe,
struct inode *inode);
-static int ocfs_update_last_eh_blk(ocfs_super *osb, ocfs2_dinode *fe,
+static int ocfs_update_last_eb_blk(ocfs_super *osb, ocfs2_dinode *fe,
struct inode *inode);
static int ocfs_free_vol_block (ocfs_super * osb, ocfs_journal_handle *handle,
@@ -644,8 +644,8 @@
static int ocfs_allocate_new_data_node(ocfs_super *osb,
ocfs2_dinode *fe,
u32 new_clusters,
- struct buffer_head *eh_bh,
- u64 *new_eh_blkno,
+ struct buffer_head *eb_bh,
+ u64 *new_eb_blkno,
ocfs_journal_handle *handle,
struct inode *inode)
{
@@ -659,7 +659,7 @@
u64 phys_blkno;
__u64 fileOffset = 0;
__u64 numSectorsAlloc = 0;
- ocfs2_extent_header *eh = NULL;
+ ocfs2_extent_block *eb = NULL;
ocfs2_extent_list *el = NULL;
struct buffer_head **header_bhs = NULL;
struct buffer_head *bh = NULL;
@@ -668,8 +668,8 @@
LOG_ENTRY ();
- if (eh_bh) {
- status = ocfs_journal_access(handle, eh_bh,
+ if (eb_bh) {
+ status = ocfs_journal_access(handle, eb_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
@@ -677,13 +677,13 @@
goto finally;
}
- eh = OCFS_BH_GET_DATA_WRITE(eh_bh);
- el = &eh->h_list;
+ eb = OCFS_BH_GET_DATA_WRITE(eb_bh);
+ el = &eb->h_list;
bh_locked = 1;
}
- if (eh != NULL) {
+ if (eb != NULL) {
depth = el->l_tree_depth;
- parent_blk = eh->h_blkno;
+ parent_blk = eb->h_blkno;
} else {
depth = fe->i_tree_depth;
parent_blk = fe->i_blkno;
@@ -732,7 +732,7 @@
OCFS_BH_PUT_DATA(header_bhs[i]);
}
- if (eh != NULL) {
+ if (eb != NULL) {
k = el->l_next_free_rec;
el->l_recs[k].e_cpos =
fe->i_clusters;
@@ -749,7 +749,7 @@
/* Fill in all the headers and the leaf */
for (i = 0; i <= depth; i++) {
- ocfs2_extent_header *ext;
+ ocfs2_extent_block *ext;
ocfs2_extent_list *el2;
ext = OCFS_BH_GET_DATA_WRITE(header_bhs[i]);
@@ -760,9 +760,10 @@
ext->h_suballoc_node = osb->node_num;
ext->h_blkno =
(physicalOffset >> osb->sb->s_blocksize_bits) + i;
+ strcpy(ext->signature, OCFS_EXTENT_BLOCK_SIGNATURE);
el2 = &ext->h_list;
- el2->l_count = ocfs_extent_recs_per_eh(osb->sb);
+ el2->l_count = ocfs_extent_recs_per_eb(osb->sb);
el2->l_next_free_rec = 1;
el2->l_recs[0].e_cpos = fe->i_clusters;
el2->l_recs[0].e_clusters = new_clusters;
@@ -771,14 +772,10 @@
if (i != depth) {
/* fill in each header */
el2->l_recs[0].e_blkno = phys_blkno + (i + 1);
- strcpy(ext->signature,
- OCFS_EXTENT_HEADER_SIGNATURE);
} else {
/* fill in the leaf */
el2->l_recs[0].e_blkno = phys_blkno;
- strcpy(ext->signature,
- OCFS_EXTENT_DATA_SIGNATURE);
- *new_eh_blkno = fe->i_last_eh_blk =
+ *new_eb_blkno = fe->i_last_eb_blk =
ext->h_blkno;
}
@@ -794,24 +791,24 @@
}
}
- if (eh != NULL) {
+ if (eb != NULL) {
/* both needed below in for loop */
- u64 tmp_blk = eh->h_parent_blk;
+ u64 tmp_blk = eb->h_parent_blk;
int tree_depth = el->l_tree_depth;
- OCFS_BH_PUT_DATA(eh_bh);
+ OCFS_BH_PUT_DATA(eb_bh);
bh_locked = 0;
- eh = NULL;
+ eb = NULL;
el = NULL;
- status = ocfs_journal_dirty(handle, eh_bh);
+ status = ocfs_journal_dirty(handle, eb_bh);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
/* gotta fix up his parent extents now. We totally
- * reuse the eh and el variables now as they're no
+ * reuse the eb and el variables now as they're no
* longer needed for their original purpose. */
for (i = tree_depth + 1; i < fe->i_tree_depth; i++) {
bh = NULL;
@@ -830,14 +827,14 @@
goto finally;
}
- eh = OCFS_BH_GET_DATA_WRITE(bh);
- if (!IS_VALID_EXTENT_HEADER(eh)) {
+ eb = OCFS_BH_GET_DATA_WRITE(bh);
+ if (!IS_VALID_EXTENT_BLOCK(eb)) {
OCFS_BH_PUT_DATA(bh);
brelse(bh);
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
}
- el = &eh->h_list;
+ el = &eb->h_list;
if (el->l_next_free_rec == 0) {
OCFS_BH_PUT_DATA(bh);
@@ -850,7 +847,7 @@
el->l_recs[k].e_clusters +=
new_clusters;
- tmp_blk = eh->h_parent_blk;
+ tmp_blk = eb->h_parent_blk;
OCFS_BH_PUT_DATA(bh);
status = ocfs_journal_dirty(handle, bh);
@@ -867,7 +864,7 @@
}
finally:
if (bh_locked)
- OCFS_BH_PUT_DATA(eh_bh);
+ OCFS_BH_PUT_DATA(eb_bh);
if (header_bhs) {
for (i = 0; i < numSectorsAlloc; i++)
if (header_bhs[i])
@@ -889,12 +886,12 @@
{
int status = 0;
__s32 k, i;
- ocfs2_extent_header *eh1 = NULL;
- ocfs2_extent_header *eh2 = NULL;
+ ocfs2_extent_block *eb1 = NULL;
+ ocfs2_extent_block *eb2 = NULL;
ocfs2_extent_list *el;
__u64 physicalOffset;
__u64 fileOffset = 0;
- u64 phys_blkno, parent_blk, last_eh_blkno;
+ u64 phys_blkno, parent_blk, last_eb_blkno;
__u32 AllocSize;
u64 new_parent_blk = 0;
struct buffer_head **bhs = NULL;
@@ -959,23 +956,23 @@
goto finally;
}
- eh1 = OCFS_BH_GET_DATA_WRITE(bhs[0]);
+ eb1 = OCFS_BH_GET_DATA_WRITE(bhs[0]);
/* Copy the File Entry information in to the newly allocated sector */
for (k = 0; k < fe->i_records; k++) {
- eh1->h_list.l_recs[k].e_cpos = fe->extents[k].e_cpos;
- eh1->h_list.l_recs[k].e_clusters =
+ eb1->h_list.l_recs[k].e_cpos = fe->extents[k].e_cpos;
+ eb1->h_list.l_recs[k].e_clusters =
fe->extents[k].e_clusters;
- eh1->h_list.l_recs[k].e_blkno = fe->extents[k].e_blkno;
+ eb1->h_list.l_recs[k].e_blkno = fe->extents[k].e_blkno;
}
- last_eh_blkno = fe->i_last_eh_blk;
- eh1->h_blkno =
+ last_eb_blkno = fe->i_last_eb_blk;
+ eb1->h_blkno =
physicalOffset >> osb->sb->s_blocksize_bits;
- new_parent_blk = eh1->h_blkno;
- eh1->h_suballoc_blkno =
+ new_parent_blk = eb1->h_blkno;
+ eb1->h_suballoc_blkno =
fileOffset >> osb->sb->s_blocksize_bits;
- eh1->h_suballoc_node = osb->node_num;
- eh1->h_next_leaf_blk = 0;
+ eb1->h_suballoc_node = osb->node_num;
+ eb1->h_next_leaf_blk = 0;
fe->i_tree_depth++;
LOG_TRACE_ARGS ("Granularity is: %d\n", fe->i_tree_depth);
@@ -988,13 +985,13 @@
parent_blk = fe->i_blkno;
for (i = 0; i < fe->i_tree_depth; i++) {
- eh2 = OCFS_BH_GET_DATA_WRITE(bhs[i]);
- el = &eh2->h_list;
+ eb2 = OCFS_BH_GET_DATA_WRITE(bhs[i]);
+ el = &eb2->h_list;
el->l_tree_depth = (fe->i_tree_depth - 1) - i;
- el->l_count = ocfs_extent_recs_per_eh(osb->sb);
+ el->l_count = ocfs_extent_recs_per_eb(osb->sb);
- strcpy(eh2->signature, OCFS_EXTENT_HEADER_SIGNATURE);
+ strcpy(eb2->signature, OCFS_EXTENT_BLOCK_SIGNATURE);
if (i == 0) {
el->l_recs[fe->i_records].e_blkno = phys_blkno + 1;
@@ -1002,32 +999,32 @@
el->l_recs[fe->i_records].e_clusters = new_clusters;
el->l_next_free_rec = fe->i_records + 1;
- eh2->h_blkno =
+ eb2->h_blkno =
physicalOffset >> osb->sb->s_blocksize_bits;
- eh2->h_parent_blk = parent_blk;
+ eb2->h_parent_blk = parent_blk;
- parent_blk = last_eh_blkno = eh2->h_blkno;
+ parent_blk = last_eb_blkno = eb2->h_blkno;
} else {
el->l_recs[0].e_blkno = phys_blkno + (i + 1);
el->l_recs[0].e_cpos = fe->i_clusters;
el->l_recs[0].e_clusters = new_clusters;
el->l_next_free_rec = 1;
- eh2->h_suballoc_blkno =
+ eb2->h_suballoc_blkno =
(fileOffset >> osb->sb->s_blocksize_bits) + i;
- eh2->h_suballoc_node = osb->node_num;
- eh2->h_blkno =
+ eb2->h_suballoc_node = osb->node_num;
+ eb2->h_blkno =
(physicalOffset >> osb->sb->s_blocksize_bits) + i;
- eh2->h_parent_blk = parent_blk;
+ eb2->h_parent_blk = parent_blk;
- parent_blk = last_eh_blkno = eh2->h_blkno;
+ parent_blk = last_eb_blkno = eb2->h_blkno;
}
OCFS_BH_PUT_DATA(bhs[i]);
}
/* Update the Data Segment, which is the last one in our array */
- eh1 = OCFS_BH_GET_DATA_WRITE(bhs[fe->i_tree_depth]);
- el = &eh1->h_list;
+ eb1 = OCFS_BH_GET_DATA_WRITE(bhs[fe->i_tree_depth]);
+ el = &eb1->h_list;
i = (fe->i_tree_depth) ? 0 : fe->i_records;
@@ -1036,26 +1033,26 @@
/* For the time being we are assuming that the newly allocated Extent */
/* will have one more entry to accomodate the latest allocation */
- strcpy (eh1->signature, OCFS_EXTENT_DATA_SIGNATURE);
+ strcpy(eb1->signature, OCFS_EXTENT_BLOCK_SIGNATURE);
el->l_tree_depth = -1;
- el->l_count = ocfs_extent_recs_per_eh(osb->sb);
+ el->l_count = ocfs_extent_recs_per_eb(osb->sb);
el->l_recs[i].e_cpos = fe->i_clusters;
el->l_recs[i].e_clusters = new_clusters;
el->l_recs[i].e_blkno = blkno;
el->l_next_free_rec = i + 1;
- eh1->h_suballoc_blkno =
+ eb1->h_suballoc_blkno =
(fileOffset >> osb->sb->s_blocksize_bits) +
fe->i_tree_depth;
- eh1->h_suballoc_node = osb->node_num;
- eh1->h_blkno =
+ eb1->h_suballoc_node = osb->node_num;
+ eb1->h_blkno =
(physicalOffset >> osb->sb->s_blocksize_bits) +
fe->i_tree_depth;
- eh1->h_parent_blk = parent_blk;
- eh1->h_next_leaf_blk = 0;
+ eb1->h_parent_blk = parent_blk;
+ eb1->h_next_leaf_blk = 0;
- parent_blk = last_eh_blkno = eh1->h_blkno;
+ parent_blk = last_eb_blkno = eb1->h_blkno;
OCFS_BH_PUT_DATA(bhs[fe->i_tree_depth]);
@@ -1068,11 +1065,11 @@
/* Update the Previous Last Data Extent with this new Data
* Extent Pointer */
- if (fe->i_last_eh_blk != 0) {
+ if (fe->i_last_eb_blk != 0) {
struct buffer_head *bh = NULL;
status = ocfs_read_bh(osb,
- fe->i_last_eh_blk << osb->sb->s_blocksize_bits,
+ fe->i_last_eb_blk << osb->sb->s_blocksize_bits,
&bh, OCFS_BH_COND_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -1086,16 +1083,16 @@
goto finally;
}
- eh1 = OCFS_BH_GET_DATA_WRITE(bh);
- if (!IS_VALID_EXTENT_HEADER(eh1) ||
- (eh1->h_list.l_tree_depth != -1)) {
+ eb1 = OCFS_BH_GET_DATA_WRITE(bh);
+ if (!IS_VALID_EXTENT_BLOCK(eb1) ||
+ (eb1->h_list.l_tree_depth != -1)) {
OCFS_BH_PUT_DATA(bh);
brelse(bh);
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
}
- eh1->h_next_leaf_blk = last_eh_blkno;
+ eb1->h_next_leaf_blk = last_eb_blkno;
OCFS_BH_PUT_DATA(bh);
status = ocfs_journal_dirty(handle, bh);
@@ -1130,8 +1127,8 @@
goto finally;
}
- eh1 = OCFS_BH_GET_DATA_WRITE(bh);
- eh1->h_parent_blk = new_parent_blk;
+ eb1 = OCFS_BH_GET_DATA_WRITE(bh);
+ eb1->h_parent_blk = new_parent_blk;
OCFS_BH_PUT_DATA(bh);
status = ocfs_journal_dirty(handle, bh);
@@ -1155,7 +1152,7 @@
fe->extents[0].e_cpos = 0; /* FIXME: not needed */
fe->extents[0].e_clusters = fe->i_clusters + new_clusters;
fe->extents[0].e_blkno = phys_blkno;
- fe->i_last_eh_blk = last_eh_blkno;
+ fe->i_last_eb_blk = last_eb_blkno;
fe->i_next_free_rec = 1;
finally:
@@ -1184,11 +1181,11 @@
int status = 0;
int IncreaseTreeDepth = 0;
int k = 0, i;
- ocfs2_extent_header *eh1 = NULL, *eh2 = NULL;
+ ocfs2_extent_block *eb1 = NULL, *eb2 = NULL;
ocfs2_extent_list *el1 = NULL, *el2 = NULL;
- struct buffer_head *eh1_bh = NULL, *eh2_bh = NULL;
+ struct buffer_head *eb1_bh = NULL, *eb2_bh = NULL;
int UpdateParent = 0;
- u64 parent_blk, new_eh_blkno;
+ u64 parent_blk, new_eb_blkno;
ocfs2_dinode *fe = NULL;
LOG_ENTRY_ARGS("(blkno=%llu, new_clusters=%u)\n", blkno, new_clusters);
@@ -1245,15 +1242,15 @@
IncreaseTreeDepth = 0;
status = ocfs_read_bh(osb,
- fe->i_last_eh_blk << osb->sb->s_blocksize_bits,
- &eh1_bh, OCFS_BH_COND_CACHED, inode);
+ fe->i_last_eb_blk << osb->sb->s_blocksize_bits,
+ &eb1_bh, OCFS_BH_COND_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
}
- eh1 = OCFS_BH_GET_DATA_WRITE(eh1_bh);
- el1 = &eh1->h_list;
- if (!IS_VALID_EXTENT_HEADER(eh1) ||
+ eb1 = OCFS_BH_GET_DATA_WRITE(eb1_bh);
+ el1 = &eb1->h_list;
+ if (!IS_VALID_EXTENT_BLOCK(eb1) ||
(el1->l_tree_depth != -1)) {
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
@@ -1268,17 +1265,17 @@
* the length */
if (k >= 0 &&
ocfs_extent_contig(inode, &(el1->l_recs[k]), blkno)) {
- OCFS_BH_PUT_DATA(eh1_bh);
+ OCFS_BH_PUT_DATA(eb1_bh);
- status = ocfs_journal_access(handle, eh1_bh,
+ status = ocfs_journal_access(handle, eb1_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
- eh1 = OCFS_BH_GET_DATA_WRITE(eh1_bh);
- el1 = &eh1->h_list;
+ eb1 = OCFS_BH_GET_DATA_WRITE(eb1_bh);
+ el1 = &eb1->h_list;
el1->l_recs[k].e_clusters += new_clusters;
status = 0;
@@ -1291,17 +1288,17 @@
if (k != el1->l_count) {
/* we can just add next extent */
- OCFS_BH_PUT_DATA(eh1_bh);
+ OCFS_BH_PUT_DATA(eb1_bh);
- status = ocfs_journal_access(handle, eh1_bh,
+ status = ocfs_journal_access(handle, eb1_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
- eh1 = OCFS_BH_GET_DATA_WRITE(eh1_bh);
- el1 = &eh1->h_list;
+ eb1 = OCFS_BH_GET_DATA_WRITE(eb1_bh);
+ el1 = &eb1->h_list;
el1->l_recs[k].e_cpos = fe->i_clusters;
el1->l_recs[k].e_clusters = new_clusters;
@@ -1314,31 +1311,31 @@
* at the top and need to create another
* level. */
if (fe->i_tree_depth > 0)
- parent_blk = eh1->h_parent_blk;
+ parent_blk = eb1->h_parent_blk;
else
parent_blk = 0;
for (i = 0; i < fe->i_tree_depth; i++) {
/* if we loop back around */
- if (eh2) {
- OCFS_BH_PUT_DATA(eh2_bh);
- brelse(eh2_bh);
- eh2 = NULL;
+ if (eb2) {
+ OCFS_BH_PUT_DATA(eb2_bh);
+ brelse(eb2_bh);
+ eb2 = NULL;
el2 = NULL;
- eh2_bh =NULL;
+ eb2_bh =NULL;
}
status = ocfs_read_bh(osb,
parent_blk << osb->sb->s_blocksize_bits,
- &eh2_bh,
+ &eb2_bh,
OCFS_BH_COND_CACHED,
inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
- eh2 = OCFS_BH_GET_DATA_READ(eh2_bh);
- el2 = &eh2->h_list;
- if (!IS_VALID_EXTENT_HEADER(eh2) ||
+ eb2 = OCFS_BH_GET_DATA_READ(eb2_bh);
+ el2 = &eb2->h_list;
+ if (!IS_VALID_EXTENT_BLOCK(eb2) ||
(el2->l_tree_depth < 0)) {
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
@@ -1353,12 +1350,12 @@
if (el2->l_next_free_rec != el2->l_count)
break;
- parent_blk = eh2->h_parent_blk;
+ parent_blk = eb2->h_parent_blk;
} /* for (i = 0; i < fe->i_tree_depth; i++) */
- if (eh2) {
- OCFS_BH_PUT_DATA(eh2_bh);
- eh2 = NULL;
+ if (eb2) {
+ OCFS_BH_PUT_DATA(eb2_bh);
+ eb2 = NULL;
el2 = NULL;
/* we may still need the bh so don't brelse */
}
@@ -1376,37 +1373,37 @@
* extent which needs the new leaf */
status = ocfs_allocate_new_data_node(osb, fe,
new_clusters,
- eh2_bh,
- &new_eh_blkno,
+ eb2_bh,
+ &new_eb_blkno,
handle, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
}
- OCFS_BH_PUT_DATA(eh1_bh);
+ OCFS_BH_PUT_DATA(eb1_bh);
- status = ocfs_journal_access(handle, eh1_bh,
+ status = ocfs_journal_access(handle, eb1_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
- eh1 = OCFS_BH_GET_DATA_WRITE(eh1_bh);
+ eb1 = OCFS_BH_GET_DATA_WRITE(eb1_bh);
- eh1->h_next_leaf_blk = fe->i_last_eh_blk = new_eh_blkno;
+ eb1->h_next_leaf_blk = fe->i_last_eb_blk = new_eb_blkno;
}
do_update_parent:
/* before we put the variable away, save off parent_blk as
* we may need it if we update parent */
- parent_blk = eh1->h_parent_blk;
+ parent_blk = eb1->h_parent_blk;
/* gotta put it away to write it ;) */
- OCFS_BH_PUT_DATA(eh1_bh);
- eh1 = NULL;
- status = ocfs_journal_dirty(handle, eh1_bh);
+ OCFS_BH_PUT_DATA(eb1_bh);
+ eb1 = NULL;
+ status = ocfs_journal_dirty(handle, eb1_bh);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
@@ -1416,19 +1413,19 @@
for (i = 0; i < fe->i_tree_depth; i++) {
/* next two if's are for loop around */
- if (eh2_bh) {
- if (eh2) {
- OCFS_BH_PUT_DATA(eh2_bh);
- eh2 = NULL;
+ if (eb2_bh) {
+ if (eb2) {
+ OCFS_BH_PUT_DATA(eb2_bh);
+ eb2 = NULL;
el2 = NULL;
}
- brelse(eh2_bh);
- eh2_bh = NULL;
+ brelse(eb2_bh);
+ eb2_bh = NULL;
}
/* TODO: Can we do a cached read here? */
status = ocfs_read_bh(osb,
parent_blk << osb->sb->s_blocksize_bits,
- &eh2_bh,
+ &eb2_bh,
OCFS_BH_COND_CACHED,
inode);
if (status < 0) {
@@ -1436,16 +1433,16 @@
goto finally;
}
- status = ocfs_journal_access(handle, eh2_bh,
+ status = ocfs_journal_access(handle, eb2_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
}
- eh2 = OCFS_BH_GET_DATA_WRITE(eh2_bh);
- el2 = &eh2->h_list;
- if (!IS_VALID_EXTENT_HEADER(eh2) ||
+ eb2 = OCFS_BH_GET_DATA_WRITE(eb2_bh);
+ el2 = &eb2->h_list;
+ if (!IS_VALID_EXTENT_BLOCK(eb2) ||
(el2->l_tree_depth < 0)) {
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
@@ -1461,13 +1458,13 @@
el2->l_recs[k].e_clusters += new_clusters;
/* gonna need it if we loop around */
- parent_blk = eh2->h_parent_blk;
+ parent_blk = eb2->h_parent_blk;
- OCFS_BH_PUT_DATA(eh2_bh);
- eh2 = NULL;
+ OCFS_BH_PUT_DATA(eb2_bh);
+ eb2 = NULL;
el2 = NULL;
- status = ocfs_journal_dirty(handle, eh2_bh);
+ status = ocfs_journal_dirty(handle, eb2_bh);
if (status < 0) {
goto finally;
}
@@ -1487,14 +1484,14 @@
if (IncreaseTreeDepth) {
OCFS_BH_PUT_DATA(fe_bh);
fe = NULL;
- if (eh1_bh && eh1) {
- OCFS_BH_PUT_DATA(eh1_bh);
- eh1 = NULL;
+ if (eb1_bh && eb1) {
+ OCFS_BH_PUT_DATA(eb1_bh);
+ eb1 = NULL;
el1 = NULL;
}
- if (eh2_bh && eh2) {
- OCFS_BH_PUT_DATA(eh2_bh);
- eh2 = NULL;
+ if (eb2_bh && eb2) {
+ OCFS_BH_PUT_DATA(eb2_bh);
+ eb2 = NULL;
el2 = NULL;
}
@@ -1533,16 +1530,16 @@
/* Buffers are always null if they haven't been mapped and
* non-null if they have.
* Buffer heads are non-NULL if they need to be brelsed */
- if (eh1_bh) {
- if (eh1)
- OCFS_BH_PUT_DATA(eh1_bh);
- brelse(eh1_bh);
+ if (eb1_bh) {
+ if (eb1)
+ OCFS_BH_PUT_DATA(eb1_bh);
+ brelse(eb1_bh);
}
- if (eh2_bh) {
- if (eh2)
- OCFS_BH_PUT_DATA(eh2_bh);
- brelse(eh2_bh);
+ if (eb2_bh) {
+ if (eb2)
+ OCFS_BH_PUT_DATA(eb2_bh);
+ brelse(eb2_bh);
}
if (fe) {
OCFS_BH_PUT_DATA(fe_bh);
@@ -1655,7 +1652,9 @@
* deletion in free_head.
*/
-/* We can't recurse, so we keep a simple stack of ocfs2_extent_headers. */
+/*
+ * We can't recurse, so we keep a simple stack of ocfs2_extent_blocks.
+ */
static int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, ocfs_journal_handle *handle, struct inode *inode)
{
int status = -EFAIL;
@@ -1668,7 +1667,7 @@
ocfs2_extent_rec *ext;
struct buffer_head *tmp_bh = NULL;
char * stack[OCFS_TREE_STACK_SIZE];
- ocfs2_extent_header *cur_eh; /* convenience, points to TOS */
+ ocfs2_extent_block *cur_eb; /* convenience, points to TOS */
ocfs2_extent_list *cur_el;
int tos = 0;
@@ -1683,16 +1682,16 @@
OCFS_BH_PUT_DATA(extent_grp_bh);
do {
- cur_eh = (ocfs2_extent_header *) stack[tos];
- if (!IS_VALID_EXTENT_HEADER(cur_eh)) {
- LOG_ERROR_STR("Invalid extent header!");
+ cur_eb = (ocfs2_extent_block *) stack[tos];
+ if (!IS_VALID_EXTENT_BLOCK(cur_eb)) {
+ LOG_ERROR_STR("Invalid extent block!");
goto bail;
}
- cur_el = &cur_eh->h_list;
+ cur_el = &cur_eb->h_list;
if (cur_el->l_tree_depth == -1) {
- LOG_TRACE_ARGS("found some data to free (%llu)\n", cur_eh->h_blkno);
+ LOG_TRACE_ARGS("found some data to free (%llu)\n", cur_eb->h_blkno);
for(i = 0; i < cur_el->l_next_free_rec; i++) {
/* Free the data associated with each header */
ext = &cur_el->l_recs[i];
@@ -1711,7 +1710,7 @@
/* Did we already kill all his children, or
* are they already dead? */
if (cur_el->l_next_free_rec == 0) {
- LOG_TRACE_ARGS("Popping this header (%llu)\n", cur_eh->h_blkno);
+ LOG_TRACE_ARGS("Popping this header (%llu)\n", cur_eb->h_blkno);
goto free_meta;
}
@@ -1729,7 +1728,7 @@
tmp_off <<= osb->sb->s_blocksize_bits;
cur_el->l_next_free_rec--;
- cur_eh = NULL;
+ cur_eb = NULL;
cur_el = NULL;
tos++;
@@ -1757,8 +1756,8 @@
free_meta:
/* Free the metadata associated with this extent group */
status = ocfs_handle_add_commit_bits(handle, 1,
- cur_eh->h_suballoc_blkno << osb->sb->s_blocksize_bits,
- cur_eh->h_suballoc_node,
+ cur_eb->h_suballoc_blkno << osb->sb->s_blocksize_bits,
+ cur_eb->h_suballoc_node,
DISK_ALLOC_EXTENT_NODE);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -1767,7 +1766,7 @@
/* Pop one off the stack */
kfree(stack[tos]);
stack[tos] = NULL;
- cur_eh = NULL;
+ cur_eb = NULL;
cur_el = NULL;
tos--;
} while (tos >= 0);
@@ -1784,30 +1783,30 @@
#ifndef USERSPACE_TOOL
-static int ocfs_fix_extent_header(ocfs_super *osb,
- struct buffer_head *eh_bh,
- struct inode *inode)
+static int ocfs_fix_extent_block(ocfs_super *osb,
+ struct buffer_head *eb_bh,
+ struct inode *inode)
{
- ocfs2_extent_header *eh = NULL;
+ ocfs2_extent_block *eb = NULL;
ocfs2_extent_list *el;
int status = -EFAIL;
int i;
LOG_ENTRY();
- if (!eh_bh) {
- LOG_ERROR_STR("Invalid extent header bh (NULL)!");
+ if (!eb_bh) {
+ LOG_ERROR_STR("Invalid extent block bh (NULL)!");
goto bail;
}
- eh = OCFS_BH_GET_DATA_WRITE(eh_bh);
+ eb = OCFS_BH_GET_DATA_WRITE(eb_bh);
- if (!IS_VALID_EXTENT_HEADER(eh)) {
- LOG_ERROR_STR("Invalid extent header!");
+ if (!IS_VALID_EXTENT_BLOCK(eb)) {
+ LOG_ERROR_STR("Invalid extent block!");
goto bail;
}
- el = &eh->h_list;
+ el = &eb->h_list;
for(i = el->l_next_free_rec; i < el->l_count; i++) {
el->l_recs[i].e_clusters = 0;
@@ -1815,13 +1814,13 @@
el->l_recs[i].e_cpos = 0;
}
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
status=0;
bail:
- if (eh)
- OCFS_BH_PUT_DATA(eh_bh);
+ if (eb)
+ OCFS_BH_PUT_DATA(eb_bh);
LOG_EXIT_STATUS (status);
return(status);
@@ -1839,7 +1838,7 @@
* TODO: This function should be split up into a couple smaller ones.
*/
static int ocfs_split_this_tree(ocfs_super *osb,
- struct buffer_head *eh_bh,
+ struct buffer_head *eb_bh,
ocfs_journal_handle *handle,
ocfs2_dinode *fe,
struct inode *inode)
@@ -1847,8 +1846,8 @@
int status = -EFAIL;
ocfs2_extent_rec *rec;
struct buffer_head * bh_stack[OCFS_TREE_STACK_SIZE];
- ocfs2_extent_header *alloc_eh = NULL; /* convenience, points to TOS */
- ocfs2_extent_header *eh;
+ ocfs2_extent_block *alloc_eb = NULL; /* convenience, points to TOS */
+ ocfs2_extent_block *eb;
ocfs2_extent_list *el;
struct buffer_head *tmp_bh = NULL, *tmp_bh2 = NULL;
int tos = 0;
@@ -1869,14 +1868,14 @@
LOG_ERROR_STR("Truncating file with tree_depth 3, this is not tested and may be unsafe!");
LOG_TRACE_STR("Found a tree_depth 3 tree, trimming it.\n");
- status = ocfs_journal_access(handle, eh_bh,
+ status = ocfs_journal_access(handle, eb_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- eh = OCFS_BH_GET_DATA_WRITE(eh_bh);
- el = &eh->h_list;
+ eb = OCFS_BH_GET_DATA_WRITE(eb_bh);
+ el = &eb->h_list;
for (i = (el->l_next_free_rec - 1); i >= 0; i--) {
rec = &el->l_recs[i];
@@ -1888,8 +1887,8 @@
&tmp_bh2,
OCFS_BH_COND_CACHED, inode);
if (status < 0) {
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
brelse(tmp_bh2);
LOG_ERROR_STATUS (status);
goto bail;
@@ -1902,8 +1901,8 @@
handle,
inode);
if (status < 0) {
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
el = NULL;
brelse(tmp_bh2);
LOG_ERROR_STATUS (status);
@@ -1921,11 +1920,11 @@
}
/* Write out our new top of the tree duder */
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
el = NULL;
- status = ocfs_journal_dirty(handle, eh_bh);
+ status = ocfs_journal_dirty(handle, eb_bh);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -1936,7 +1935,7 @@
LOG_ERROR_STATUS(-EFAIL);
goto bail;
}
- eh_bh = tmp_bh2;
+ eb_bh = tmp_bh2;
/* We want to do the next bit of stuff too */
gran = 2;
@@ -1949,15 +1948,15 @@
if (gran == 2) {
LOG_TRACE_STR("Found a tree_depth 2 tree, trimming it.\n");
- status = ocfs_journal_access(handle, eh_bh,
+ status = ocfs_journal_access(handle, eb_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- eh = OCFS_BH_GET_DATA_WRITE(eh_bh);
- el = &eh->h_list;
+ eb = OCFS_BH_GET_DATA_WRITE(eb_bh);
+ el = &eb->h_list;
for(i = (el->l_next_free_rec - 1); i >= 0; i--) {
rec = &el->l_recs[i];
@@ -1971,8 +1970,8 @@
OCFS_BH_COND_CACHED,
inode);
if (status < 0) {
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
el = NULL;
brelse(tmp_bh);
LOG_ERROR_STATUS (status);
@@ -1986,8 +1985,8 @@
handle,
inode);
if (status < 0) {
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
el = NULL;
brelse(tmp_bh);
LOG_ERROR_STATUS (status);
@@ -2004,11 +2003,11 @@
}
}
/* Write out our new top of the tree duder */
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
el = NULL;
- status = ocfs_journal_dirty(handle, eh_bh);
+ status = ocfs_journal_dirty(handle, eb_bh);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -2020,7 +2019,7 @@
goto bail;
}
- eh_bh = tmp_bh;
+ eb_bh = tmp_bh;
/* Right now, we don't use 'gran' below here, but just
* in case */
@@ -2033,7 +2032,7 @@
for (i =0; i < OCFS_TREE_STACK_SIZE; i++)
bh_stack[i] = NULL;
- bh_stack[tos] = eh_bh;
+ bh_stack[tos] = eb_bh;
/* Ok, find the splitting point (can be a DAT or HDR) */
do {
@@ -2047,23 +2046,23 @@
goto bail;
}
- alloc_eh = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
- if (!IS_VALID_EXTENT_HEADER(alloc_eh)) {
- LOG_ERROR_STR("Invalid extent header!");
+ alloc_eb = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
+ if (!IS_VALID_EXTENT_BLOCK(alloc_eb)) {
+ LOG_ERROR_STR("Invalid extent block!");
goto bail;
}
- el = &alloc_eh->h_list;
+ el = &alloc_eb->h_list;
if (el->l_tree_depth == -1) {
/* shall we just do away with him? */
if (el->l_recs[0].e_cpos >= fe->i_clusters) {
- LOG_TRACE_ARGS("Killing this data extent (%llu)\n", alloc_eh->h_blkno);
+ LOG_TRACE_ARGS("Killing this data extent (%llu)\n", alloc_eb->h_blkno);
/* Boundary case - what if this guy is
* the last DAT we should delete
* (i.e., split no more ;) */
OCFS_BH_PUT_DATA(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
status = ocfs_kill_this_tree(osb,
bh_stack[tos],
@@ -2074,13 +2073,13 @@
goto bail;
}
/* silly, but what to do? */
- alloc_eh = OCFS_BH_GET_DATA_READ(bh_stack[tos]);
+ alloc_eb = OCFS_BH_GET_DATA_READ(bh_stack[tos]);
} else {
/* Alright, we know for sure that
* we're splitting in this guy. */
- LOG_TRACE_ARGS("Splitting this data extent (%llu)\n", alloc_eh->h_blkno);
- fe->i_last_eh_blk = alloc_eh->h_blkno;
- alloc_eh->h_next_leaf_blk = 0;
+ LOG_TRACE_ARGS("Splitting this data extent (%llu)\n", alloc_eb->h_blkno);
+ fe->i_last_eb_blk = alloc_eb->h_blkno;
+ alloc_eb->h_next_leaf_blk = 0;
/* total_bytes is used below to know
* how much total we've whacked off
* this extent*/
@@ -2153,7 +2152,7 @@
/* Either way, we need to write this back out*/
OCFS_BH_PUT_DATA(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
status = ocfs_journal_dirty(handle,
@@ -2175,8 +2174,8 @@
goto bail;
}
- alloc_eh = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
- el = &alloc_eh->h_list;
+ alloc_eb = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
+ el = &alloc_eb->h_list;
victim = el->l_next_free_rec;
el->l_next_free_rec++;
/* need to also update
@@ -2185,9 +2184,9 @@
rec->e_clusters -=
(u32)(total_bytes >> osb->s_clustersize_bits);
OCFS_BH_PUT_DATA(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
- status = ocfs_fix_extent_header(osb,
+ status = ocfs_fix_extent_block(osb,
bh_stack[tos], inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
@@ -2212,16 +2211,16 @@
if (el->l_next_free_rec == 0) {
/*Ok, we're done with this guy, pop the stack*/
LOG_TRACE_ARGS("Popping this header (%llu)\n",
- alloc_eh->h_blkno);
+ alloc_eb->h_blkno);
- status = ocfs_handle_add_commit_bits(handle, 1, alloc_eh->h_suballoc_blkno << osb->sb->s_blocksize_bits, alloc_eh->h_suballoc_node, DISK_ALLOC_EXTENT_NODE);
+ status = ocfs_handle_add_commit_bits(handle, 1, alloc_eb->h_suballoc_blkno << osb->sb->s_blocksize_bits, alloc_eb->h_suballoc_node, DISK_ALLOC_EXTENT_NODE);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
}
OCFS_BH_PUT_DATA(bh_stack[tos]);
brelse(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
bh_stack[tos] = NULL;
tos--;
@@ -2231,17 +2230,17 @@
/* Do we just delete this whole part of the tree? */
if (el->l_recs[0].e_cpos >= fe->i_clusters) {
LOG_TRACE_ARGS("whacking this tree: (%llu)\n",
- alloc_eh->h_blkno);
+ alloc_eb->h_blkno);
if (el->l_recs[0].e_cpos == fe->i_clusters)
done = 1;
OCFS_BH_PUT_DATA(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
ocfs_kill_this_tree(osb, bh_stack[tos],
handle, inode);
brelse(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
bh_stack[tos] = NULL;
tos--;
@@ -2260,8 +2259,8 @@
goto bail;
}
- alloc_eh = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
- el = &alloc_eh->h_list;
+ alloc_eb = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
+ el = &alloc_eb->h_list;
victim = el->l_next_free_rec;
el->l_recs[victim].e_cpos = 0;
@@ -2269,7 +2268,7 @@
el->l_recs[victim].e_blkno = 0;
el->l_next_free_rec--;
OCFS_BH_PUT_DATA(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
/* Here's an interesting boundary
* case. What if we're truncating on a
@@ -2283,7 +2282,7 @@
LOG_TRACE_STR("Found a boundary " \
"header, almost done " \
" (gonna quit)");
- status = ocfs_fix_extent_header(osb,
+ status = ocfs_fix_extent_block(osb,
bh_stack[tos], inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
@@ -2322,7 +2321,7 @@
rec = &el->l_recs[victim];
tmp_off = rec->e_blkno << osb->sb->s_blocksize_bits;
OCFS_BH_PUT_DATA(bh_stack[tos]);
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
status = ocfs_journal_dirty(handle,
@@ -2351,11 +2350,11 @@
/* We only want to free on our way up the tree */
continue;
}
- if (alloc_eh)
+ if (alloc_eb)
OCFS_BH_PUT_DATA(bh_stack[tos]);
brelse(bh_stack[tos]);
bh_stack[tos] = NULL;
- alloc_eh = NULL;
+ alloc_eb = NULL;
el = NULL;
tos--;
} while (tos >= 0);
@@ -2368,7 +2367,7 @@
bail:
/* brelse the stack. We only brelse the bottom of the stack if
* we know for sure that it wasn't passed from the caller */
- if (alloc_eh)
+ if (alloc_eb)
OCFS_BH_PUT_DATA(bh_stack[tos]);
if (needs_brelse)
brelse(bh_stack[0]);
@@ -2382,22 +2381,22 @@
/*
- * ocfs_update_last_eh_blk
+ * ocfs_update_last_eb_blk
*
- * Travel all the way to the rightmost DAT and set fe->i_last_eh_blk
+ * Travel all the way to the rightmost DAT and set fe->i_last_eb_blk
* to it.
*
* We do cached reads here because we ought to have already read the
* various ext headers and dats off the system previously in the
* truncate path.
*/
-static int ocfs_update_last_eh_blk(ocfs_super *osb,
+static int ocfs_update_last_eb_blk(ocfs_super *osb,
ocfs2_dinode *fe,
struct inode *inode)
{
int status = -EFAIL;
- struct buffer_head *eh_bh = NULL;
- ocfs2_extent_header *eh = NULL;
+ struct buffer_head *eb_bh = NULL;
+ ocfs2_extent_block *eb = NULL;
ocfs2_extent_list *el;
u64 next_blk;
int victim;
@@ -2406,7 +2405,7 @@
if (fe->i_next_free_rec == 0) {
LOG_TRACE_STR("setting to zero as there isn't any used extents");
- fe->i_last_eh_blk = 0;
+ fe->i_last_eb_blk = 0;
status = 0;
goto bail;
}
@@ -2419,60 +2418,60 @@
victim = fe->i_next_free_rec - 1;
status = ocfs_read_bh(osb,
fe->extents[victim].e_blkno << osb->sb->s_blocksize_bits,
- &eh_bh,
+ &eb_bh,
OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- eh = OCFS_BH_GET_DATA_READ(eh_bh);
+ eb = OCFS_BH_GET_DATA_READ(eb_bh);
- if (!IS_VALID_EXTENT_HEADER(eh)) {
- LOG_ERROR_STR("Invalid extent header!");
+ if (!IS_VALID_EXTENT_BLOCK(eb)) {
+ LOG_ERROR_STR("Invalid extent block!");
goto bail;
}
- el = &eh->h_list;
+ el = &eb->h_list;
while (el->l_tree_depth >= 0) {
- if (!IS_VALID_EXTENT_HEADER(eh)) {
- LOG_ERROR_STR("Invalid extent header!");
+ if (!IS_VALID_EXTENT_BLOCK(eb)) {
+ LOG_ERROR_STR("Invalid extent block!");
goto bail;
}
- el = &eh->h_list;
+ el = &eb->h_list;
next_blk = el->l_recs[el->l_next_free_rec - 1].e_blkno;
- OCFS_BH_PUT_DATA(eh_bh);
- brelse(eh_bh);
- eh = NULL;
- eh_bh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ brelse(eb_bh);
+ eb = NULL;
+ eb_bh = NULL;
status = ocfs_read_bh(osb,
next_blk << osb->sb->s_blocksize_bits,
- &eh_bh,
+ &eb_bh,
OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- eh = OCFS_BH_GET_DATA_READ(eh_bh);
+ eb = OCFS_BH_GET_DATA_READ(eb_bh);
}
- fe->i_last_eh_blk = eh->h_blkno;
+ fe->i_last_eb_blk = eb->h_blkno;
status = 0;
bail:
- if (eh_bh) {
- if (eh)
- OCFS_BH_PUT_DATA(eh_bh);
- brelse(eh_bh);
+ if (eb_bh) {
+ if (eb)
+ OCFS_BH_PUT_DATA(eb_bh);
+ brelse(eb_bh);
}
LOG_EXIT_STATUS(status);
return(status);
-} /* ocfs_update_last_eh_blk */
+} /* ocfs_update_last_eb_blk */
/*
* ocfs_free_extents_for_truncate()
@@ -2489,7 +2488,7 @@
int status = 0;
struct buffer_head *extent_bh = NULL;
int i, j;
- int updated_leb; /* used to mark whether fe->i_last_eh_blk has
+ int updated_leb; /* used to mark whether fe->i_last_eb_blk has
* been updated */
LOG_ENTRY ();
@@ -2512,7 +2511,7 @@
updated_leb = 0;
- /* Loop backwards through only the used free extent headers here */
+ /* Loop backwards through only the used free extent block here */
for (i = (fe->i_next_free_rec - 1); i >= 0; i--) {
LOG_TRACE_ARGS("at top of loop, i = %d\n", i);
/* Go ahead and read that bit of the tree - we'll need it. */
@@ -2570,13 +2569,13 @@
/* Ok, trunc to zero is a special case, doofus */
if (fe->i_clusters == 0) {
- fe->i_last_eh_blk = 0;
+ fe->i_last_eb_blk = 0;
fe->i_tree_depth = -1;
updated_leb = 1;
}
if (!updated_leb) {
- status = ocfs_update_last_eh_blk(osb, fe, inode);
+ status = ocfs_update_last_eb_blk(osb, fe, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
@@ -2609,8 +2608,8 @@
int status = -EFAIL;
ocfs2_dinode *fe = NULL;
struct buffer_head *fe_bh = NULL;
- ocfs2_extent_header *eh = NULL;
- struct buffer_head *eh_bh = NULL;
+ ocfs2_extent_block *eb = NULL;
+ struct buffer_head *eb_bh = NULL;
u64 next_leaf;
__u64 remainingLength = 0;
__s64 localVbo;
@@ -2676,17 +2675,17 @@
* Local Extents for this File Entry. */
status = ocfs_get_leaf_extent(osb, fe, localVbo,
- &eh_bh, inode);
+ &eb_bh, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
- eh = OCFS_BH_GET_DATA_READ(eh_bh);
+ eb = OCFS_BH_GET_DATA_READ(eb_bh);
while (1) {
status = ocfs_update_extent_map(osb,
&OCFS_I(inode)->map,
- eh, &localVbo,
+ eb, &localVbo,
&remainingLength,
NONLOCAL_EXT);
if (status < 0) {
@@ -2695,35 +2694,35 @@
}
if (remainingLength > 0) {
- if (!eh->h_next_leaf_blk) {
+ if (!eb->h_next_leaf_blk) {
LOG_ERROR_ARGS ("localVbo=%llu, "
"alloc_size=%llu, "
" thisext=%llu",
localVbo,
OCFS_I(inode)->alloc_size,
- eh->h_blkno);
+ eb->h_blkno);
status = -EFAIL;
goto finally;
}
- next_leaf = eh->h_next_leaf_blk;
+ next_leaf = eb->h_next_leaf_blk;
- OCFS_BH_PUT_DATA(eh_bh);
- brelse(eh_bh);
- eh_bh = NULL;
- eh = NULL;
+ OCFS_BH_PUT_DATA(eb_bh);
+ brelse(eb_bh);
+ eb_bh = NULL;
+ eb = NULL;
status = ocfs_read_bh(osb,
next_leaf << osb->sb->s_blocksize_bits,
- &eh_bh,
+ &eb_bh,
OCFS_BH_COND_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
}
- eh = OCFS_BH_GET_DATA_READ(eh_bh);
- if (!IS_VALID_EXTENT_HEADER(eh) ||
- (eh->h_list.l_tree_depth != -1)) {
+ eb = OCFS_BH_GET_DATA_READ(eb_bh);
+ if (!IS_VALID_EXTENT_BLOCK(eb) ||
+ (eb->h_list.l_tree_depth != -1)) {
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
}
@@ -2750,10 +2749,10 @@
brelse(fe_bh);
}
- if (eh_bh) {
- if (eh)
- OCFS_BH_PUT_DATA(eh_bh);
- brelse(eh_bh);
+ if (eb_bh) {
+ if (eb)
+ OCFS_BH_PUT_DATA(eb_bh);
+ brelse(eb_bh);
}
LOG_EXIT_STATUS (status);
return (status);
@@ -2770,9 +2769,9 @@
int status = 0, tempstat;
__u32 i, j;
struct buffer_head *ext_bh = NULL;
- ocfs2_extent_header *eh = NULL;
+ ocfs2_extent_block *eb = NULL;
ocfs2_extent_list *el;
- ocfs2_extent_header *tmp = NULL;
+ ocfs2_extent_block *tmp = NULL;
__u64 childDiskOffset = 0;
LOG_ENTRY ();
@@ -2796,12 +2795,12 @@
goto finally;
}
- eh = OCFS_BH_GET_DATA_READ(ext_bh);
- if (!IS_VALID_EXTENT_HEADER(eh)) {
+ eb = OCFS_BH_GET_DATA_READ(ext_bh);
+ if (!IS_VALID_EXTENT_BLOCK(eb)) {
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
}
- el = &eh->h_list;
+ el = &eb->h_list;
for (j = 0; j < el->l_next_free_rec; j++) {
if ((__s64)((u64)(el->l_recs[j].e_cpos + el->l_recs[j].e_clusters) << osb->s_clustersize_bits) > Vbo)
@@ -2815,7 +2814,7 @@
OCFS_BH_PUT_DATA(ext_bh);
brelse(ext_bh);
ext_bh = NULL;
- eh = NULL;
+ eb = NULL;
}
if (*data_extent_bh) {
@@ -2831,7 +2830,7 @@
}
tmp = OCFS_BH_GET_DATA_READ(*data_extent_bh);
- if (!IS_VALID_EXTENT_HEADER(tmp) ||
+ if (!IS_VALID_EXTENT_BLOCK(tmp) ||
(tmp->h_list.l_tree_depth != -1)) {
LOG_ERROR_STATUS (status = -EINVAL);
OCFS_BH_PUT_DATA(*data_extent_bh);
@@ -2843,7 +2842,7 @@
OCFS_BH_PUT_DATA(*data_extent_bh);
finally:
if (ext_bh) {
- if (eh)
+ if (eb)
OCFS_BH_PUT_DATA(ext_bh);
brelse(ext_bh);
}
@@ -3298,7 +3297,7 @@
int status = 0;
__u32 i;
__u32 numBitsAllocated = 0, bitmapOffset = 0;
- ocfs2_extent_header *extent = NULL;
+ ocfs2_extent_block *extent = NULL;
struct buffer_head *extent_bh = NULL;
ocfs2_dinode *fe = NULL;
__u64 offset;
@@ -3339,7 +3338,7 @@
goto leave;
}
extent = OCFS_BH_GET_DATA_READ(extent_bh);
- if (fe->i_tree_depth && !IS_VALID_EXTENT_HEADER(extent)) {
+ if (fe->i_tree_depth && !IS_VALID_EXTENT_BLOCK(extent)) {
status = -EINVAL;
LOG_ERROR_STATUS(status);
goto leave;
Modified: branches/format-changes/src/extmap.c
===================================================================
--- branches/format-changes/src/extmap.c 2004-06-11 01:07:13 UTC (rev 1048)
+++ branches/format-changes/src/extmap.c 2004-06-11 01:32:03 UTC (rev 1049)
@@ -588,7 +588,7 @@
{
int ret = -EFAIL;
ocfs2_dinode *fe;
- ocfs2_extent_header *eh;
+ ocfs2_extent_block *eb;
ocfs2_extent_list *el;
__s64 tempVbo;
__u64 tempSize;
@@ -616,8 +616,8 @@
} else {
__u64 localLength = 0;
- eh = Buffer;
- el = &eh->h_list;
+ eb = Buffer;
+ el = &eb->h_list;
for (j = 0; j < el->l_next_free_rec; j++) {
if ((__s64)((u64)(el->l_recs[j].e_cpos + el->l_recs[j].e_clusters) << osb->s_clustersize_bits) > (*localVbo)) {
Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c 2004-06-11 01:07:13 UTC (rev 1048)
+++ branches/format-changes/src/file.c 2004-06-11 01:32:03 UTC (rev 1049)
@@ -423,9 +423,9 @@
int ret = 0;
int j;
__u64 tempoff;
- ocfs2_extent_header *eh = NULL;
+ ocfs2_extent_block *eb = NULL;
ocfs2_extent_list *el;
- struct buffer_head *eh_bh = NULL;
+ struct buffer_head *eb_bh = NULL;
ocfs2_dinode *fe = NULL;
void *tmp;
@@ -465,17 +465,17 @@
/* Extents are branched and we are no longer using */
/* Local Extents for this File Entry. */
- ret = ocfs_get_leaf_extent (osb, fe, 0, &eh_bh, inode);
+ ret = ocfs_get_leaf_extent (osb, fe, 0, &eb_bh, inode);
if (ret < 0) {
LOG_ERROR_STATUS (ret);
goto leave;
}
while (1) {
- eh = OCFS_BH_GET_DATA_READ(eh_bh);
- el = &eh->h_list;
+ eb = OCFS_BH_GET_DATA_READ(eb_bh);
+ el = &eb->h_list;
- if (!IS_VALID_EXTENT_HEADER(eh) ||
+ if (!IS_VALID_EXTENT_BLOCK(eb) ||
(el->l_tree_depth != -1)) {
LOG_ERROR_STATUS(ret = -EFAIL);
goto leave;
@@ -493,19 +493,19 @@
}
}
- if (eh->h_next_leaf_blk > 0) {
- if (!eh->h_next_leaf_blk) {
+ if (eb->h_next_leaf_blk > 0) {
+ if (!eb->h_next_leaf_blk) {
LOG_ERROR_STATUS (ret = -EFAIL);
goto leave;
}
- next_leaf = eh->h_next_leaf_blk;
- OCFS_BH_PUT_DATA(eh_bh);
- eh = NULL;
- eh_bh = NULL;
+ next_leaf = eb->h_next_leaf_blk;
+ OCFS_BH_PUT_DATA(eb_bh);
+ eb = NULL;
+ eb_bh = NULL;
ret = ocfs_read_bh(osb,
next_leaf << osb->sb->s_blocksize_bits,
- &eh_bh,
+ &eb_bh,
OCFS_BH_COND_CACHED, inode);
if (ret < 0) {
LOG_ERROR_STATUS(ret);
@@ -521,10 +521,10 @@
if (fe)
ocfs_release_file_entry (fe);
- if (eh_bh) {
- if (eh)
- OCFS_BH_PUT_DATA(eh_bh);
- brelse(eh_bh);
+ if (eb_bh) {
+ if (eb)
+ OCFS_BH_PUT_DATA(eb_bh);
+ brelse(eb_bh);
}
LOG_EXIT_STATUS (ret);
Modified: branches/format-changes/src/namei.c
===================================================================
--- branches/format-changes/src/namei.c 2004-06-11 01:07:13 UTC (rev 1048)
+++ branches/format-changes/src/namei.c 2004-06-11 01:32:03 UTC (rev 1049)
@@ -399,7 +399,7 @@
fe->i_tree_depth = -1;
fe->i_next_free_rec = 0;
- fe->i_last_eh_blk = 0;
+ fe->i_last_eb_blk = 0;
strcpy (fe->i_signature, OCFS_FILE_ENTRY_SIGNATURE);
fe->i_records = ocfs_extent_recs_per_inode(osb->sb);
fe->i_flags |= OCFS2_VALID_FL;
Modified: branches/format-changes/src/ocfs.h
===================================================================
--- branches/format-changes/src/ocfs.h 2004-06-11 01:07:13 UTC (rev 1048)
+++ branches/format-changes/src/ocfs.h 2004-06-11 01:32:03 UTC (rev 1049)
@@ -322,11 +322,10 @@
#define OCFS2_SYSTEM_FL (0x10)
-#define INVALID_NODE_POINTER -1
-#define OCFS_FILE_ENTRY_SIGNATURE "INODE01"
-#define OCFS_EXTENT_HEADER_SIGNATURE "EXHDR01"
-#define OCFS_EXTENT_DATA_SIGNATURE OCFS_EXTENT_HEADER_SIGNATURE
-#define OCFS_LOCAL_ALLOC_SIGNATURE "LCLBMP"
+#define INVALID_NODE_POINTER -1
+#define OCFS_FILE_ENTRY_SIGNATURE "INODE01"
+#define OCFS_EXTENT_BLOCK_SIGNATURE "EXBLK01"
+#define OCFS_LOCAL_ALLOC_SIGNATURE "LCLBMP"
#define MAX_IP_ADDR_LEN 32
@@ -385,8 +384,8 @@
/* sm - ocfs 1.0 fails to set fe->sig for dirs */
#define IS_VALID_FILE_ENTRY(ptr) \
(!strcmp((ptr)->i_signature, OCFS_FILE_ENTRY_SIGNATURE))
-#define IS_VALID_EXTENT_HEADER(ptr) \
- (!strcmp((ptr)->signature, OCFS_EXTENT_HEADER_SIGNATURE))
+#define IS_VALID_EXTENT_BLOCK(ptr) \
+ (!strcmp((ptr)->signature, OCFS_EXTENT_BLOCK_SIGNATURE))
#define IS_VALID_NODE_NUM(node) \
(((node) >= 0) && ((node) < OCFS_MAXIMUM_NODES))
@@ -1237,7 +1236,7 @@
__u32 total_bits;
} bitinfo;
} u;
-/*98*/ __u64 i_last_eh_blk; /* Pointer to last extdat */
+/*98*/ __u64 i_last_eb_blk; /* Pointer to last extdat */
/*A0*/ __s16 i_tree_depth; /* Extent tree depth
-1 means data extents hang
directly off of the
@@ -1249,9 +1248,9 @@
} ocfs2_dinode;
/*
- * On disk extent header (indirect blocks) for OCFSv2
+ * On disk extent block (indirect block) for OCFSv2
*/
-typedef struct _ocfs2_extent_header
+typedef struct _ocfs2_extent_block
{
/*00*/ __u8 signature[8]; /* Signature for verification */
__u64 h_suballoc_blkno; /* Node suballocator offset,
@@ -1268,7 +1267,7 @@
of next leaf header pointing
to data */
/*30*/ ocfs2_extent_list h_list; /* Extent record list */
-} ocfs2_extent_header;
+} ocfs2_extent_block;
typedef struct _ocfs_dlm_msg_hdr
{
@@ -1744,11 +1743,11 @@
}
static inline int ocfs_extent_for_offset(struct super_block *sb,
- ocfs2_extent_header *eh,
+ ocfs2_extent_block *eb,
u64 vbo)
{
int k;
- ocfs2_extent_list *el = &eh->h_list;
+ ocfs2_extent_list *el = &eb->h_list;
ocfs2_extent_rec *ext;
u32 cluster;
u64 byte_off;
@@ -1794,12 +1793,12 @@
return size / sizeof(struct _ocfs2_extent_rec);
}
-static inline int ocfs_extent_recs_per_eh(struct super_block *sb)
+static inline int ocfs_extent_recs_per_eb(struct super_block *sb)
{
int size;
size = sb->s_blocksize -
- offsetof(struct _ocfs2_extent_header, h_list.l_recs);
+ offsetof(struct _ocfs2_extent_block, h_list.l_recs);
return size / sizeof(struct _ocfs2_extent_rec);
}
Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c 2004-06-11 01:07:13 UTC (rev 1048)
+++ branches/format-changes/src/sysfile.c 2004-06-11 01:32:03 UTC (rev 1049)
@@ -475,7 +475,7 @@
__u32 k = 0, j;
__u32 Runs, Runoffset;
struct buffer_head *extent_bh = NULL;
- ocfs2_extent_header *extent = NULL;
+ ocfs2_extent_block *extent = NULL;
ocfs_io_runs *IoRuns;
__u64 newOffset = 0, searchVbo, remainingLength = 0;
@@ -510,7 +510,7 @@
size = 3;
while (pow)
{
- size *= ocfs_extent_recs_per_eh(osb->sb);
+ size *= ocfs_extent_recs_per_eb(osb->sb);
pow--;
}
size *= sizeof (ocfs_io_runs);
@@ -592,7 +592,7 @@
while (extent->h_list.l_tree_depth >= 0) {
__u64 diskoffset;
- if (!IS_VALID_EXTENT_HEADER(extent)) {
+ if (!IS_VALID_EXTENT_BLOCK(extent)) {
LOG_ERROR_STATUS(status = -EFAIL);
goto leave;
}
@@ -628,7 +628,7 @@
OCFS_ASSERT(extent->h_list.l_tree_depth == -1);
- if (!IS_VALID_EXTENT_HEADER(extent)) {
+ if (!IS_VALID_EXTENT_BLOCK(extent)) {
LOG_ERROR_STATUS(status = -EFAIL);
goto leave;
}
More information about the Ocfs2-commits
mailing list