[Ocfs2-commits] jlbec commits r2255 - branches/alloc_inode/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon May 16 20:26:26 CDT 2005
Author: jlbec
Date: 2005-05-16 20:26:24 -0500 (Mon, 16 May 2005)
New Revision: 2255
Modified:
branches/alloc_inode/fs/ocfs2/alloc.c
branches/alloc_inode/fs/ocfs2/aops.c
branches/alloc_inode/fs/ocfs2/dlmglue.c
branches/alloc_inode/fs/ocfs2/extent_map.c
branches/alloc_inode/fs/ocfs2/file.c
branches/alloc_inode/fs/ocfs2/inode.c
branches/alloc_inode/fs/ocfs2/journal.c
branches/alloc_inode/fs/ocfs2/localalloc.c
branches/alloc_inode/fs/ocfs2/ocfs.h
branches/alloc_inode/fs/ocfs2/proc.c
branches/alloc_inode/fs/ocfs2/suballoc.c
branches/alloc_inode/fs/ocfs2/super.c
Log:
o Merged 2243:2249 from trunk:
- [2247] Update alloc stats, enable local alloc for all cluster
sizes, alloc block groups from local alloc.
- [2248] Print useful info when bad metadata found.
- [2249] Fix truncate clusters/blocks bug.
Modified: branches/alloc_inode/fs/ocfs2/alloc.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/alloc.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/alloc.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -119,7 +119,7 @@
mlog_entry_void();
- OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
if (fe->i_last_eb_blk) {
retval = ocfs_read_block(osb, fe->i_last_eb_blk, &eb_bh,
@@ -314,7 +314,7 @@
for(i = 0; i < new_blocks; i++) {
bh = new_eb_bhs[i];
eb = (ocfs2_extent_block *) bh->b_data;
- OCFS_ASSERT(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
eb_el = &eb->h_list;
status = ocfs_journal_access(handle, inode, bh,
@@ -440,7 +440,7 @@
}
eb = (ocfs2_extent_block *) new_eb_bh->b_data;
- OCFS_ASSERT(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
eb_el = &eb->h_list;
fe = (ocfs2_dinode *) fe_bh->b_data;
fe_el = &fe->id2.i_list;
@@ -570,7 +570,7 @@
goto bail;
}
eb = (ocfs2_extent_block *) eb_bhs[i]->b_data;
- OCFS_ASSERT_RO(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
status = ocfs_journal_access(handle, inode, eb_bhs[i],
OCFS_JOURNAL_ACCESS_WRITE);
@@ -730,7 +730,7 @@
}
eb = (ocfs2_extent_block *) bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
el = &eb->h_list;
if (el->l_next_free_rec < el->l_count) {
@@ -879,7 +879,7 @@
ocfs2_extent_list *el;
struct buffer_head *bh = NULL;
- OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
*new_last_eb = NULL;
@@ -928,7 +928,7 @@
}
eb = (ocfs2_extent_block *) bh->b_data;
el = &(eb->h_list);
- OCFS_ASSERT(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
} while (el->l_tree_depth);
*new_last_eb = bh;
@@ -997,7 +997,9 @@
* we need to record the offset of the next level extent block
* as we may overwrite it. */
if (!el->l_tree_depth)
- delete_blk = el->l_recs[i].e_blkno + el->l_recs[i].e_clusters;
+ delete_blk = el->l_recs[i].e_blkno
+ + ocfs2_clusters_to_blocks(osb->sb,
+ el->l_recs[i].e_clusters);
else
next_eb = el->l_recs[i].e_blkno;
@@ -1055,7 +1057,7 @@
goto bail;
}
eb = (ocfs2_extent_block *)eb_bh->b_data;
- OCFS_ASSERT(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
el = &(eb->h_list);
status = ocfs_journal_access(handle, inode, eb_bh,
@@ -1082,8 +1084,9 @@
next_eb = el->l_recs[i].e_blkno;
/* bottom-most block requires us to delete data.*/
if (!el->l_tree_depth)
- delete_blk = el->l_recs[i].e_blkno +
- el->l_recs[i].e_clusters;
+ delete_blk = el->l_recs[i].e_blkno
+ + ocfs2_clusters_to_blocks(osb->sb,
+ el->l_recs[i].e_clusters);
if (!el->l_recs[i].e_clusters) {
el->l_recs[i].e_cpos = 0;
el->l_recs[i].e_blkno = 0;
@@ -1214,7 +1217,7 @@
goto bail;
}
eb = (ocfs2_extent_block *) last_eb_bh->b_data;
- OCFS_ASSERT(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
el = &(eb->h_list);
}
@@ -1338,7 +1341,7 @@
goto bail;
}
eb = (ocfs2_extent_block *) last_eb_bh->b_data;
- OCFS_ASSERT(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
el = &(eb->h_list);
if (el->l_recs[0].e_cpos >= new_i_clusters)
metadata_delete = 1;
Modified: branches/alloc_inode/fs/ocfs2/aops.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/aops.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/aops.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -70,16 +70,16 @@
}
fe = (ocfs2_dinode *) bh->b_data;
- if (!IS_VALID_FILE_ENTRY(fe)) {
- mlog(ML_ERROR, "Invalid fe at blkno %llu",
- (unsigned long long)OCFS_I(inode)->ip_blkno);
+ if (!OCFS2_IS_VALID_DINODE(fe)) {
+ mlog(ML_ERROR, "Invalid dinode #%"MLFu64": signature = %.*s\n",
+ fe->i_blkno, 7, fe->i_signature);
goto bail;
}
if ((u64)iblock >= ocfs2_clusters_to_blocks(inode->i_sb,
fe->i_clusters)) {
- mlog(ML_ERROR, "block offset is outside the allocated size: %llu",
- (unsigned long long)iblock);
+ mlog(ML_ERROR, "block offset is outside the allocated size: "
+ "%llu\n", (unsigned long long)iblock);
goto bail;
}
Modified: branches/alloc_inode/fs/ocfs2/dlmglue.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/dlmglue.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/dlmglue.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -1397,9 +1397,7 @@
/* This is a good chance to make sure we're not
* locking an invalid object. */
- mlog_bug_on_msg(!IS_VALID_FILE_ENTRY(fe),
- "Invalid dinode %"MLFu64" Signature: %s\n",
- OCFS_I(inode)->ip_blkno, fe->i_signature);
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
mlog_bug_on_msg(inode->i_generation !=
le32_to_cpu(fe->i_generation),
"Invalid dinode %"MLFu64" disk generation: %u "
Modified: branches/alloc_inode/fs/ocfs2/extent_map.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/extent_map.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/extent_map.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -227,7 +227,7 @@
if (ret)
goto out_free;
eb = (ocfs2_extent_block *)eb_bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
el = &eb->h_list;
}
@@ -288,7 +288,7 @@
return ret;
}
eb = (ocfs2_extent_block *)bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_EXTENT_BLOCK(eb));
+ OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(eb);
el = &eb->h_list;
} else {
spin_unlock(&OCFS_I(inode)->ip_lock);
@@ -302,7 +302,7 @@
return ret;
}
di = (ocfs2_dinode *)bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_FILE_ENTRY(di));
+ OCFS2_BUG_ON_INVALID_DINODE(di);
el = &di->id2.i_list;
}
Modified: branches/alloc_inode/fs/ocfs2/file.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/file.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/file.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -458,7 +458,7 @@
}
fe = (ocfs2_dinode *) fe_bh->b_data;
- OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
OCFS_ASSERT(fe->i_size == i_size_read(inode));
if (new_i_size > fe->i_size) {
@@ -743,7 +743,7 @@
}
fe = (ocfs2_dinode *) bh->b_data;
- OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
OCFS_ASSERT(i_size_read(inode) == (fe->i_size - *bytes_extended));
OCFS_ASSERT(new_i_size >= i_size_read(inode));
Modified: branches/alloc_inode/fs/ocfs2/inode.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/inode.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/inode.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -250,13 +250,13 @@
sb = inode->i_sb;
osb = OCFS2_SB(sb);
- // this means that read_inode cannot create a superblock
- // inode today. change if needed.
- if (!IS_VALID_FILE_ENTRY(fe) || !(fe->i_flags & OCFS2_VALID_FL)) {
- mlog(ML_ERROR, "invalid file entry! i_ino=%lu, "
- "fe->i_blkno=%"MLFu64", valid_flag = %d\n",
- inode->i_ino, fe->i_blkno,
- (fe->i_flags & OCFS2_VALID_FL));
+ /* this means that read_inode cannot create a superblock inode
+ * today. change if needed. */
+ if (!OCFS2_IS_VALID_DINODE(fe) || !(fe->i_flags & OCFS2_VALID_FL)) {
+ mlog(ML_ERROR, "Invalid dinode: i_ino=%lu, i_blkno=%"MLFu64", "
+ "signature = %.*s, flags = 0x%x\n",
+ inode->i_ino, fe->i_blkno, 7, fe->i_signature,
+ fe->i_flags);
goto bail;
}
@@ -384,7 +384,7 @@
if (!args) {
mlog(ML_ERROR, "bad inode args\n");
- make_bad_inode (inode);
+ make_bad_inode(inode);
goto bail;
}
@@ -394,13 +394,15 @@
status = ocfs_read_block(osb, args->blkno, &bh, 0, NULL);
if (status < 0) {
mlog_errno(status);
- make_bad_inode (inode);
+ make_bad_inode(inode);
goto bail;
}
fe = (ocfs2_dinode *) bh->b_data;
- if(!IS_VALID_FILE_ENTRY(fe)) {
- make_bad_inode (inode);
+ if (!OCFS2_IS_VALID_DINODE(fe)) {
+ mlog(ML_ERROR, "Invalid dinode #%"MLFu64": signature = %.*s\n",
+ fe->i_blkno, 7, fe->i_signature);
+ make_bad_inode(inode);
goto bail;
}
@@ -412,7 +414,7 @@
if (ocfs_populate_inode (inode, fe, 0) < 0) {
mlog(ML_ERROR, "populate inode failed! i_blkno=%"MLFu64", "
"i_ino=%lu\n", fe->i_blkno, inode->i_ino);
- make_bad_inode (inode);
+ make_bad_inode(inode);
goto bail;
}
Modified: branches/alloc_inode/fs/ocfs2/journal.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/journal.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/journal.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -609,7 +609,7 @@
mlog_entry_void();
fe = (ocfs2_dinode *) bh->b_data;
- OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
flags = le32_to_cpu(fe->id1.journal1.ij_flags);
if (dirty)
Modified: branches/alloc_inode/fs/ocfs2/localalloc.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/localalloc.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/localalloc.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -45,12 +45,6 @@
#include "buffer_head_io.h"
-/* The largest cluster size where we even consider using local alloc. */
-#define OCFS_LOCAL_ALLOC_MAX_CSIZE (128 * 1024)
-
-/* The largest allocation to use the local bitmap for. */
-#define OCFS_LOCAL_ALLOC_MAX_ALLOC (2 * 1024 * 1024)
-
static inline int ocfs_local_alloc_window_bits(ocfs_super *osb);
static u32 ocfs_local_alloc_count_bits(ocfs2_dinode *alloc);
@@ -83,49 +77,40 @@
/*
* ocfs_local_alloc_window_bits
*
- * Determine how large our local alloc window should be, in bits. This
- * is entirely changeable -- just replace this function. Right now as
- * a *testing* default, we have a function that takes cluster size
- * into account in the following manner:
- *
- * 4k -> 1024 bits, 8k -> 512 bits, 16k -> 256 bits,
- * 32k -> 128 bits, 64k -> 64 bits
+ * Determine how large our local alloc window should be, in bits.
+ *
+ * These values (and the behavior in ocfs_alloc_should_use_local) have
+ * been chosen so that most allocations, including new block groups go
+ * through local alloc.
*/
static inline int ocfs_local_alloc_window_bits(ocfs_super *osb)
{
- int numbits;
+ BUG_ON(osb->s_clustersize_bits < 12);
- switch (osb->s_clustersize) {
- case (4*1024):
- numbits = 1024;
- break;
+ return 2048 >> (osb->s_clustersize_bits - 12);
+}
- case (8*1024):
- numbits = 512;
- break;
+/*
+ * ocfs_alloc_should_use_local
+ *
+ * Tell us whether a given allocation should use the local alloc
+ * file. Otherwise, it has to go to the main bitmap.
+ */
+int ocfs_alloc_should_use_local(ocfs_super *osb, u64 bits)
+{
+ int la_bits = ocfs_local_alloc_window_bits(osb);
- case (16*1024):
- numbits = 256;
- break;
+ if (osb->local_alloc_state != OCFS2_LA_ENABLED)
+ return 0;
- case (32*1024):
- numbits = 128;
- break;
+ /* la_bits should be at least twice the size (in clusters) of
+ * a new block group. We want to be sure block group
+ * allocations go through the local alloc, so allow an
+ * allocation to take up to half the bitmap. */
+ if (bits > (la_bits / 2))
+ return 0;
- default:
- numbits = 64;
- break;
- }
- return numbits;
-} /* ocfs_local_alloc_window_bits */
-
-int ocfs_alloc_should_use_local(ocfs_super *osb, u64 bits)
-{
- if ((osb->local_alloc_state == OCFS2_LA_ENABLED)
- && (ocfs2_clusters_to_bytes(osb->sb, bits) <= OCFS_LOCAL_ALLOC_MAX_ALLOC)
- && (bits <= ocfs_local_alloc_window_bits(osb)))
- return 1;
- return 0;
+ return 1;
}
/*
@@ -141,10 +126,6 @@
mlog_entry_void();
- /* we don't enable local alloc on cluster sizes >= 128k */
- if (osb->s_clustersize > OCFS_LOCAL_ALLOC_MAX_CSIZE)
- goto bail;
-
/* read the alloc off disk */
inode = ocfs_get_system_file_inode(osb, LOCAL_ALLOC_SYSTEM_INODE,
osb->slot_num);
@@ -510,13 +491,6 @@
goto bail;
}
- if (bits_wanted > ocfs2_clusters_for_bytes(osb->sb,
- OCFS_LOCAL_ALLOC_MAX_ALLOC)) {
- mlog(0, "Asking for more than max local alloction!\n");
- status = -ENOSPC;
- goto bail;
- }
-
if (bits_wanted > ocfs_local_alloc_window_bits(osb)) {
mlog(0, "Asking for more than my max window size!\n");
status = -ENOSPC;
@@ -882,7 +856,6 @@
mlog_errno(status);
goto bail;
}
- atomic_inc(&osb->alloc_stats.bitmap_data);
alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;
Modified: branches/alloc_inode/fs/ocfs2/ocfs.h
===================================================================
--- branches/alloc_inode/fs/ocfs2/ocfs.h 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/ocfs.h 2005-05-17 01:26:24 UTC (rev 2255)
@@ -60,13 +60,36 @@
#define OCFS_INVALID_NODE_NUM -1
-#define IS_VALID_FILE_ENTRY(ptr) \
+#define OCFS2_IS_VALID_DINODE(ptr) \
(!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE))
-#define IS_VALID_EXTENT_BLOCK(ptr) \
+
+#define OCFS2_BUG_ON_INVALID_DINODE(__di) do { \
+ mlog_bug_on_msg(!OCFS2_IS_VALID_DINODE((__di)), \
+ "Dinode # %"MLFu64" has bad signature %.*s\n", \
+ (__di)->i_blkno, 7, \
+ (__di)->i_signature); \
+} while (0);
+
+#define OCFS2_IS_VALID_EXTENT_BLOCK(ptr) \
(!strcmp((ptr)->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE))
-#define IS_VALID_GROUP_DESC(ptr) \
+
+#define OCFS2_BUG_ON_INVALID_EXTENT_BLOCK(__eb) do { \
+ mlog_bug_on_msg(!OCFS2_IS_VALID_EXTENT_BLOCK((__eb)), \
+ "Extent Block # %"MLFu64" has bad signature %.*s\n", \
+ (__eb)->h_blkno, 7, \
+ (__eb)->h_signature); \
+} while (0);
+
+#define OCFS2_IS_VALID_GROUP_DESC(ptr) \
(!strcmp((ptr)->bg_signature, OCFS2_GROUP_DESC_SIGNATURE))
+#define OCFS2_BUG_ON_INVALID_GROUP_DESC(__gd) do { \
+ mlog_bug_on_msg(!OCFS2_IS_VALID_GROUP_DESC((__gd)), \
+ "Group Descriptor # %"MLFu64" has bad signature %.*s\n",\
+ (__gd)->bg_blkno, 7, \
+ (__gd)->bg_signature); \
+} while (0);
+
/*
** Structures...
*/
@@ -240,11 +263,8 @@
atomic_t moves;
atomic_t local_data;
atomic_t bitmap_data;
- atomic_t bitmap_meta;
- atomic_t ext_allocs;
- atomic_t ext_extends;
- atomic_t inode_allocs;
- atomic_t inode_extends;
+ atomic_t bg_allocs;
+ atomic_t bg_extends;
} ocfs_alloc_stats;
enum ocfs2_local_alloc_state
Modified: branches/alloc_inode/fs/ocfs2/proc.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/proc.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/proc.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -179,8 +179,6 @@
len = sprintf(page, "%s\n", "*** Disk Allocation Stats ***");
- len += sprintf(page + len, "\n%s\n", "(Data Allocs)");
-
if (osb->local_alloc_state == OCFS2_LA_ENABLED)
la_state = "enabled";
else if (osb->local_alloc_state == OCFS2_LA_DISABLED)
@@ -195,19 +193,11 @@
atomic_read(&osb->alloc_stats.local_data));
len += sprintf(page + len, ALLOC_STATS_HDR, "Bitmap Allocs",
atomic_read(&osb->alloc_stats.bitmap_data));
+ len += sprintf(page + len, ALLOC_STATS_HDR, "Block Group Allocs",
+ atomic_read(&osb->alloc_stats.bg_allocs));
+ len += sprintf(page + len, ALLOC_STATS_HDR, "Block Group Adds",
+ atomic_read(&osb->alloc_stats.bg_extends));
- len += sprintf(page + len, "\n%s\n", "(Metadata Allocs)");
- len += sprintf(page + len, ALLOC_STATS_HDR, "Bitmap Allocs",
- atomic_read(&osb->alloc_stats.bitmap_meta));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Ext bitmap Allocs",
- atomic_read(&osb->alloc_stats.ext_allocs));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Ext file Extends",
- atomic_read(&osb->alloc_stats.ext_extends));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Inode bitmap Allocs",
- atomic_read(&osb->alloc_stats.inode_allocs));
- len += sprintf(page + len, ALLOC_STATS_HDR, "Inode file Extends",
- atomic_read(&osb->alloc_stats.inode_extends));
-
ret = ocfs_proc_calc_metrics(page, start, off, count, eof, len);
mlog_exit(ret);
Modified: branches/alloc_inode/fs/ocfs2/suballoc.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/suballoc.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/suballoc.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -365,7 +365,7 @@
}
fe = (ocfs2_dinode *) bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
OCFS_ASSERT_RO(fe->i_flags & OCFS2_CHAIN_FL);
free_bits = le32_to_cpu(fe->id1.bitmap1.i_total) -
@@ -386,6 +386,8 @@
mlog_errno(status);
goto bail;
}
+ atomic_inc(&osb->alloc_stats.bg_extends);
+
/* You should never ask for this much metadata */
OCFS_ASSERT(bits_wanted <=
(le32_to_cpu(fe->id1.bitmap1.i_total)
@@ -642,7 +644,7 @@
int offset, start, found, status = 0;
ocfs2_group_desc *bg = (ocfs2_group_desc *) bg_bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(bg));
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(bg);
found = start = best_offset = best_size = 0;
bitmap = bg->bg_bitmap;
@@ -709,7 +711,7 @@
mlog_entry_void();
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(bg));
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(bg);
OCFS_ASSERT(bg->bg_free_bits_count >= num_bits);
mlog(0, "block_group_set_bits: off = %u, num = %u\n", bit_off,
@@ -777,9 +779,9 @@
ocfs2_group_desc *bg = (ocfs2_group_desc *) bg_bh->b_data;
ocfs2_group_desc *prev_bg = (ocfs2_group_desc *) prev_bg_bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_FILE_ENTRY(fe));
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(bg));
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(prev_bg));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(bg);
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(prev_bg);
mlog(0, "In suballoc %"MLFu64", chain %u, move group %"MLFu64" to "
"top, prev = %"MLFu64"\n",
@@ -932,7 +934,7 @@
goto bail;
}
bg = (ocfs2_group_desc *) group_bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(bg));
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(bg);
status = -ENOSPC;
/* for now, the chain search is a bit simplistic. We just use
@@ -958,7 +960,7 @@
goto bail;
}
bg = (ocfs2_group_desc *) group_bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(bg));
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(bg);
}
if (status < 0) {
if (status != -ENOSPC)
@@ -1066,7 +1068,7 @@
OCFS_ASSERT(ac->ac_bh);
fe = (ocfs2_dinode *) ac->ac_bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
OCFS_ASSERT_RO(le32_to_cpu(fe->id1.bitmap1.i_used) <
le32_to_cpu(fe->id1.bitmap1.i_total));
@@ -1143,6 +1145,7 @@
mlog_errno(status);
goto bail;
}
+ atomic_inc(&osb->alloc_stats.bg_allocs);
*blkno_start = bg_blkno + (u64) *suballoc_bit_start;
ac->ac_bits_given += (*num_bits);
@@ -1181,6 +1184,7 @@
mlog_errno(status);
goto bail;
}
+ atomic_inc(&osb->alloc_stats.bg_allocs);
OCFS_ASSERT(num_bits == 1);
@@ -1282,6 +1286,8 @@
bits_wanted,
cluster_start,
num_clusters);
+ if (!status)
+ atomic_inc(&osb->alloc_stats.local_data);
} else {
if (min_clusters > (osb->bitmap_cpg - 1)) {
/* The only paths asking for contiguousness
@@ -1302,11 +1308,13 @@
&bg_bit_off,
num_clusters,
&bg_blkno);
- if (!status)
+ if (!status) {
*cluster_start =
ocfs2_desc_bitmap_to_cluster_off(ac->ac_inode,
bg_blkno,
bg_bit_off);
+ atomic_inc(&osb->alloc_stats.bitmap_data);
+ }
}
if (status < 0) {
if (status != -ENOSPC)
@@ -1335,7 +1343,7 @@
mlog_entry_void();
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(bg));
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(bg);
mlog(0, "off = %u, num = %u\n", bit_off, num_bits);
@@ -1389,7 +1397,7 @@
mlog_entry_void();
- OCFS_ASSERT_RO(IS_VALID_FILE_ENTRY(fe));
+ OCFS2_BUG_ON_INVALID_DINODE(fe);
OCFS_ASSERT((count + start_bit)
<= ((u32) cl->cl_cpg * (u32) cl->cl_bpc));
@@ -1405,7 +1413,7 @@
}
group = (ocfs2_group_desc *) group_bh->b_data;
- OCFS_ASSERT_RO(IS_VALID_GROUP_DESC(group));
+ OCFS2_BUG_ON_INVALID_GROUP_DESC(group);
OCFS_ASSERT((count + start_bit) <= group->bg_bits);
status = ocfs_block_group_clear_bits(handle, alloc_inode,
@@ -1491,6 +1499,10 @@
mlog_entry_void();
+ /* This is expensive. We can safely remove once this stuff has
+ * gotten tested really well. */
+ BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));
+
fe = (ocfs2_dinode *) bitmap_bh->b_data;
ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
Modified: branches/alloc_inode/fs/ocfs2/super.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/super.c 2005-05-17 01:18:58 UTC (rev 2254)
+++ branches/alloc_inode/fs/ocfs2/super.c 2005-05-17 01:26:24 UTC (rev 2255)
@@ -1057,6 +1057,12 @@
/* we sync with this work queue (and sb ref) on unmount */
INIT_WORK(&osb->osb_okp_teardown_work, okp_teardown_from_list, osb);
+ atomic_set(&osb->alloc_stats.moves, 0);
+ atomic_set(&osb->alloc_stats.local_data, 0);
+ atomic_set(&osb->alloc_stats.bitmap_data, 0);
+ atomic_set(&osb->alloc_stats.bg_allocs, 0);
+ atomic_set(&osb->alloc_stats.bg_extends, 0);
+
/* FIXME
* This should be done in ocfs_journal_init(), but unknown
* ordering issues will cause the filesystem to crash.
More information about the Ocfs2-commits
mailing list