mballoc patches
Alex actually pointed me the new mballoc patches at ftp://ftp.clusterfs.com/pub/people/alex/mballoc3
The series is the forward port of the same on top of d4ac2477fad0f2680e84ec12e387ce67682c5c13 (v2.6.23-rc2)
I guess the mballoc3 patch at clusterfs.com is based on a patched ext3(I guess it is ext3 + extent tree local to clusterfs ? ). The following series is based on ext4.
I tested the changes with different blocks per group combination and it seems to be working fine. (The last series did panic with mke2fs -g 800 )
I will now look at splitting this to smaller patches.
NOTE : I am not sure whether patch 2 will be able to make the list. if not is there a place i can ftp/scp them so that others can access the same ?
I haven't split the patches in any order and didn't bothered to write any meaningful commit messages since this is mostly work in progress.
-aneesh
PATCH 3/4 This is the equivalent of ext3-mballoc3-sles10.patch
In reply to a message not in the archive--- fs/ext4/Makefile | 2 +- fs/ext4/balloc.c | 58 ++++++++++++++++++++++++++++++++++----------- fs/ext4/extents.c | 44 +++++++++++++++++++++++++++------- fs/ext4/inode.c | 14 +++++----- fs/ext4/super.c | 18 ++++++++++++++ fs/ext4/xattr.c | 4 +- include/linux/ext4_fs.h | 1 + include/linux/ext4_fs_i.h | 4 +++ 8 files changed, 112 insertions(+), 33 deletions(-)
fs/ext4/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o ext4dev-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \ - ext4_jbd2.o + ext4_jbd2.o mballoc.o ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o
fs/ext4/balloc.c +44 -14
96 lines not on this page · raw message
fs/ext4/extents.c +35 -9
117 lines not on this page · raw message
fs/ext4/inode.c +7 -7
@@ -559,7 +559,7 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode,return ret; failed_out:for (i =0 ; i <index; i++) -ext4_free_blocks (handle, inode, new_blocks[i],1 ); +ext4_free_blocks (handle, inode, new_blocks[i],1 ,0 );return ret; }
@@ -658,9 +658,9 @@ failed:ext4_journal_forget (handle, branch[i].bh); }for (i =0 ; i <indirect_blks; i++) -ext4_free_blocks (handle, inode, new_blocks[i],1 ); +ext4_free_blocks (handle, inode, new_blocks[i],1 ,0 ); -ext4_free_blocks (handle, inode, new_blocks[i], num); +ext4_free_blocks (handle, inode, new_blocks[i], num,0 );return err; }
@@ -757,9 +757,9 @@ err_out:for (i =1 ; i <= num; i++) {BUFFER_TRACE (where[i].bh,"call jbd2_journal_forget" );ext4_journal_forget (handle, where[i].bh); -ext4_free_blocks (handle,inode,le32_to_cpu (where[i-1 ].key),1 ); +ext4_free_blocks (handle,inode,le32_to_cpu (where[i-1 ].key),1 ,0 ); } -ext4_free_blocks (handle, inode,le32_to_cpu (where[num].key), blks); +ext4_free_blocks (handle, inode,le32_to_cpu (where[num].key), blks,0 );return err; }
@@ -1990,7 +1990,7 @@ static void ext4_clear_blocks(handle_t *handle, struct inode *inode, } } -ext4_free_blocks (handle, inode, block_to_free, count); +ext4_free_blocks (handle, inode, block_to_free, count,0 ); }/**
@@ -2163,7 +2163,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,ext4_journal_test_restart (handle, inode); } -ext4_free_blocks (handle, inode, nr,1 ); +ext4_free_blocks (handle, inode, nr,1 ,1 );if (parent_bh) {/*
fs/ext4/super.c +18 -0
@@ -739,6 +739,7 @@ enum { Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, Opt_grpquota, Opt_extents, Opt_noextents, + Opt_mballoc, Opt_nomballoc, Opt_stripe, }; static match_table_t tokens = {
@@ -790,6 +791,9 @@ static match_table_t tokens = { {Opt_barrier, "barrier=%u"}, {Opt_extents, "extents"}, {Opt_noextents, "noextents"}, + {Opt_mballoc, "mballoc"}, + {Opt_nomballoc, "nomballoc"}, + {Opt_stripe, "stripe=%u"}, {Opt_err, NULL}, {Opt_resize, "resize"}, };
@@ -1128,6 +1132,19 @@ clear_qf_name:case Opt_noextents:clear_opt (sbi->s_mount_opt,EXTENTS );break ; +case Opt_mballoc: +set_opt (sbi->s_mount_opt,MBALLOC ); +break ; +case Opt_nomballoc: +clear_opt (sbi->s_mount_opt,MBALLOC ); +break ; +case Opt_stripe: +if (match_int (&args[0 ], &option)) +return 0 ; +if (option <0 ) +return 0 ; + sbi->s_stripe = option; +break ;default :printk (KERN_ERR "EXT4-fs: Unrecognized mount option \"%s\" "
@@ -1926,6 +1943,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) "writeback");ext4_ext_init (sb); +ext4_mb_init (sb, needs_recovery);lock_kernel ();return 0 ;
fs/ext4/xattr.c +2 -2
@@ -480,7 +480,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,ea_bdebug (bh,"refcount now=0; freeing" );if (ce)mb_cache_entry_free (ce); -ext4_free_blocks (handle, inode, bh->b_blocknr,1 ); +ext4_free_blocks (handle, inode, bh->b_blocknr,1 ,1 );get_bh (bh);ext4_forget (handle,1 , inode, bh, bh->b_blocknr); }else {
@@ -822,7 +822,7 @@ inserted: new_bh =sb_getblk (sb, block);if (!new_bh) { getblk_failed: -ext4_free_blocks (handle, inode, block,1 ); +ext4_free_blocks (handle, inode, block,1 ,1 ); error = -EIO ; goto cleanup; }
include/linux/ext4_fs.h +1 -0
@@ -507,6 +507,7 @@ do { \#define EXT4_MOUNT_USRQUOTA 0x100000/* "old" user quota */ #define EXT4_MOUNT_GRPQUOTA 0x200000/* "old" group quota */ #define EXT4_MOUNT_EXTENTS 0x400000/* Extents support */ +#define EXT4_MOUNT_MBALLOC 0x800000/* Buddy allocation support */ /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ #ifndef _LINUX_EXT2_FS_H
include/linux/ext4_fs_i.h +4 -0
@@ -158,6 +158,10 @@ struct ext4_inode_info {* struct timespec i_{a,c,m}time in the generic inode. */ struct timespec i_crtime; + +/* mballoc */ +struct list_head i_prealloc_list; + spinlock_t i_prealloc_lock; };#endif /* _LINUX_EXT4_FS_I */
Signature · 1 line
1.5.3.rc4.67.gf9286-dirty
PATCH 4/4 Fixes to make it build and run
--- fs/ext4/balloc.c | 37 +++++++++++++++--- fs/ext4/extents.c | 7 +-- fs/ext4/mballoc.c | 96 ++++++++++++++-------------------------------- include/linux/ext4_fs.h | 19 +++++---- 4 files changed, 74 insertions(+), 85 deletions(-)
fs/ext4/balloc.c +31 -6
@@ -626,7 +626,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, int metadata) {struct super_block * sb; -int freed; +unsigned long dquot_freed_blocks;/* this isn't the right place to decide whether block is metadata * inode.c/extents.c knows better, but for safety ... */
@@ -637,11 +637,13 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, sb = inode->i_sb;if (!test_opt (sb,MBALLOC ) || !EXT4_SB (sb)->s_group_info) -ext4_free_blocks_sb (handle, sb, block, count, &freed); +ext4_free_blocks_sb (handle, sb, block, count, + &dquot_freed_blocks);else -ext4_mb_free_blocks (handle, inode, block, count, metadata, &freed); -if (freed) -DQUOT_FREE_BLOCK (inode, freed); +ext4_mb_free_blocks (handle, inode, block, count, + metadata, &dquot_freed_blocks); +if (dquot_freed_blocks) +DQUOT_FREE_BLOCK (inode, dquot_freed_blocks);return ; }
@@ -1417,7 +1419,7 @@ int ext4_should_retry_alloc(struct super_block *sb, int *retries) }/** -* ext4_new_blocks() -- core block(s) allocation function +* ext4_new_blocks_old() -- core block(s) allocation function * @handle: handle to this transaction * @inode: file inode * @goal: given target block(filesystem wide)
@@ -1715,9 +1717,32 @@ ext4_fsblk_t ext4_new_block(handle_t *handle, struct inode *inode,return ret; } +ext4_fsblk_t ext4_new_blocks (handle_t *handle,struct inode *inode, +ext4_fsblk_t goal,unsigned long *count,int *errp) +{ +struct ext4_allocation_request ar; +ext4_fsblk_t ret; +if (!test_opt (inode->i_sb,MBALLOC )) { + ret =ext4_new_blocks_old (handle, inode, goal, count, errp); +return ret; + } + + ar.inode = inode; + ar.goal = goal; + ar.len = *count; + ar.logical =0 ; + ar.lleft =0 ; + ar.pleft =0 ; + ar.lright =0 ; + ar.pright =0 ; + ar.flags =0 ; + ret =ext4_mb_new_blocks (handle, &ar, errp); + *count = ar.len; +return ret; } +/** * ext4_count_free_blocks() -- count filesystem free blocks * @sb: superblock
fs/ext4/extents.c +3 -4
@@ -1863,7 +1863,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,unsigned short ee_len =ext4_ext_get_actual_len (ex);int i, metadata =0 ; -if (S_ISDIR (tree->inode->i_mode) ||S_ISLNK (tree->inode->i_mode)) +if (S_ISDIR (inode->i_mode) ||S_ISLNK (inode->i_mode)) metadata =1 ;#ifdef EXTENTS_STATS {
@@ -2496,14 +2496,13 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,/* find neighbour allocated blocks */ ar.lleft = iblock; - err =ext4_ext_search_left (&tree, path, &ar.lleft, &ar.pleft); + err =ext4_ext_search_left (inode, path, &ar.lleft, &ar.pleft);if (err) goto out2; ar.lright = iblock; - err =ext4_ext_search_right (&tree, path, &ar.lright, &ar.pright); + err =ext4_ext_search_right (inode, path, &ar.lright, &ar.pright);if (err) goto out2; -/* FIXME!! allocated is updated with resepec to ar.pright */ /* * See if request is beyond maximum number of blocks we can have in
fs/ext4/mballoc.c +29 -67
222 lines not on this page · raw message
include/linux/ext4_fs.h +11 -8
@@ -20,6 +20,8 @@#include <linux/blkdev.h> #include <linux/magic.h> +#include <linux/ext4_fs_i.h> +/* * The second extended filesystem constants/structures */
@@ -70,12 +72,12 @@struct ext4_allocation_request {struct inode *inode;/* target inode for block we're allocating */ -unsigned long logical;/* logical block in target inode */ -unsigned long goal;/* phys. target (a hint) */ -unsigned long lleft;/* the closest logical allocated block to the left */ -unsigned long pleft;/* phys. block for ^^^ */ -unsigned long lright;/* the closest logical allocated block to the right */ -unsigned long pright;/* phys. block for ^^^ */ +ext4_fsblk_t logical;/* logical block in target inode */ +ext4_fsblk_t goal;/* phys. target (a hint) */ +ext4_fsblk_t lleft;/* the closest logical allocated block to the left */ +ext4_fsblk_t pleft;/* phys. block for ^^^ */ +ext4_fsblk_t lright;/* the closest logical allocated block to the right */ +ext4_fsblk_t pright;/* phys. block for ^^^ */ unsigned long len;/* how many blocks we want to allocate */ unsigned long flags;/* flags. see above EXT4_MB_HINT_* */ };
@@ -930,7 +932,7 @@ extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,extern ext4_fsblk_t ext4_new_blocks (handle_t *handle,struct inode *inode,ext4_fsblk_t goal,unsigned long *count,int *errp);extern void ext4_free_blocks (handle_t *handle,struct inode *inode, -ext4_fsblk_t block,unsigned long count); +ext4_fsblk_t block,unsigned long count,int metadata);extern void ext4_free_blocks_sb (handle_t *handle,struct super_block *sb,ext4_fsblk_t block,unsigned long count,unsigned long *pdquot_freed_blocks);
@@ -980,7 +982,8 @@ extern void ext4_mb_release_blocks(struct super_block *, int);extern void ext4_mb_discard_inode_preallocations (struct inode *);extern int __init init_ext4_proc (void );extern void exit_ext4_proc (void ); -extern void ext4_mb_free_blocks (handle_t *,struct inode *,unsigned long ,unsigned long ,int ,int *); +extern void ext4_mb_free_blocks (handle_t *,struct inode *, +unsigned long ,unsigned long ,int ,unsigned long *);/* inode.c */
Signature · 1 line
1.5.3.rc4.67.gf9286-dirty
PATCH 1/4 Add some new function for searching extent tree.
In reply to Aneesh Kumar K.VFrom: Alex Tomas <[email protected]>
ext4_ext_search_leftext4_ext_search_right
--- fs/ext4/extents.c | 142 +++++++++++++++++++++++++++++++++++++++ include/linux/ext4_fs_extents.h | 2 + 2 files changed, 144 insertions(+), 0 deletions(-)
fs/ext4/extents.c +142 -0
@@ -1015,6 +1015,148 @@ out: }/* +* search the closest allocated block to the left for *logical +* and returns it at @logical + it's physical address at @phys +* if *logical is the smallest allocated block, the function +* returns 0 at @phys +* return value contains 0 (success) or error code +*/ +int +ext4_ext_search_left (struct inode *inode,struct ext4_ext_path *path, +ext4_fsblk_t *logical,ext4_fsblk_t *phys) +{ +struct ext4_extent_idx *ix; +struct ext4_extent *ex; +int depth; + +BUG_ON (path ==NULL ); + depth = path->p_depth; + *phys =0 ; + +if (depth ==0 && path->p_ext ==NULL ) +return 0 ; + +/* usually extent in the path covers blocks smaller +* then *logical, but it can be that extent is the +* first one in the file */ + + ex = path[depth].p_ext; +if (*logical <le32_to_cpu (ex->ee_block)) { +BUG_ON (EXT_FIRST_EXTENT (path[depth].p_hdr) != ex); +while (--depth >=0 ) { + ix = path[depth].p_idx; +BUG_ON (ix !=EXT_FIRST_INDEX (path[depth].p_hdr)); + } +return 0 ; + } + +BUG_ON (*logical <le32_to_cpu (ex->ee_block) +le16_to_cpu (ex->ee_len)); + + *logical =le32_to_cpu (ex->ee_block) +le16_to_cpu (ex->ee_len) -1 ; + *phys =ext_pblock (ex) +le16_to_cpu (ex->ee_len) -1 ; +return 0 ; +} + +/* +* search the closest allocated block to the right for *logical +* and returns it at @logical + it's physical address at @phys +* if *logical is the smallest allocated block, the function +* returns 0 at @phys +* return value contains 0 (success) or error code +*/ +int +ext4_ext_search_right (struct inode *inode,struct ext4_ext_path *path, +ext4_fsblk_t *logical,ext4_fsblk_t *phys) +{ +struct buffer_head *bh =NULL ; +struct ext4_extent_header *eh; +struct ext4_extent_idx *ix; +struct ext4_extent *ex; +ext4_fsblk_t block; +int depth; + +BUG_ON (path ==NULL ); + depth = path->p_depth; + *phys =0 ; + +if (depth ==0 && path->p_ext ==NULL ) +return 0 ; + +/* usually extent in the path covers blocks smaller +* then *logical, but it can be that extent is the +* first one in the file */ + + ex = path[depth].p_ext; +if (*logical <le32_to_cpu (ex->ee_block)) { +BUG_ON (EXT_FIRST_EXTENT (path[depth].p_hdr) != ex); +while (--depth >=0 ) { + ix = path[depth].p_idx; +BUG_ON (ix !=EXT_FIRST_INDEX (path[depth].p_hdr)); + } + *logical =le32_to_cpu (ex->ee_block); + *phys =ext_pblock (ex); +return 0 ; + } + +BUG_ON (*logical <le32_to_cpu (ex->ee_block) +le16_to_cpu (ex->ee_len)); + +if (ex !=EXT_LAST_EXTENT (path[depth].p_hdr)) { +/* next allocated block in this leaf */ + ex++; + *logical =le32_to_cpu (ex->ee_block); + *phys =ext_pblock (ex); +return 0 ; + } + +/* go up and search for index to the right */ +while (--depth >=0 ) { + ix = path[depth].p_idx; +if (ix !=EXT_LAST_INDEX (path[depth].p_hdr)) +break ; + } + +if (depth <0 ) { +/* we've gone up to the root and +* found no index to the right */ +return 0 ; + } + +/* we've found index to the right, let's +* follow it and find the closest allocated +* block to the right */ + ix++; + block =idx_pblock (ix); +while (++depth < path->p_depth) { + bh =sb_bread (inode->i_sb, block); +if (bh ==NULL ) +return -EIO ; + eh =ext_block_hdr (bh); +if (ext4_ext_check_header (inode, eh, depth)) { +brelse (bh); +return -EIO ; + } + ix =EXT_FIRST_INDEX (eh); + block =idx_pblock (ix); +brelse (bh); + } + + bh =sb_bread (inode->i_sb, block); +if (bh ==NULL ) +return -EIO ; + eh =ext_block_hdr (bh); +if (ext4_ext_check_header (inode, eh, depth)) { +brelse (bh); +return -EIO ; + } + ex =EXT_FIRST_EXTENT (eh); + *logical =le32_to_cpu (ex->ee_block); + *phys =ext_pblock (ex); +brelse (bh); +return 0 ; + +} + +/* * ext4_ext_next_allocated_block: * returns allocated block in subsequent extent or EXT_MAX_BLOCK. * NOTE: it considers block number from index entry as
include/linux/ext4_fs_extents.h +2 -0
@@ -236,5 +236,7 @@ extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_paextern int ext4_ext_walk_space (struct inode *,unsigned long ,unsigned long ,ext_prepare_callback ,void *);extern struct ext4_ext_path *ext4_ext_find_extent (struct inode *,int ,struct ext4_ext_path *); +extern int ext4_ext_search_left (struct inode *,struct ext4_ext_path *,ext4_fsblk_t *,ext4_fsblk_t *); +extern int ext4_ext_search_right (struct inode *,struct ext4_ext_path *,ext4_fsblk_t *,ext4_fsblk_t *);#endif /* _LINUX_EXT4_EXTENTS */
Signature · 1 line
1.5.3.rc4.67.gf9286-dirty
Quoted 17 lines · Aneesh Kumar K.V
Alex actually pointed me the new mballoc patches at ftp://ftp.clusterfs.com/pub/people/alex/mballoc3
The series is the forward port of the same on top of
d4ac2477fad0f2680e84ec12e387ce67682c5c13(v2.6.23-rc2)I guess the mballoc3 patch at clusterfs.com is based on a patched ext3(I guess it is ext3 + extent tree local to clusterfs ? ). The following series is based on ext4.
I tested the changes with different blocks per group combination and it seems to be working fine. (The last series did panic with mke2fs -g 800 )
Quoted 7 lines
I will now look at splitting this to smaller patches.
NOTE : I am not sure whether patch 2 will be able to make the list. if not is there a place i can ftp/scp them so that others can access the same ?
I am attaching below the PATCH 2/4 in .gz format. The uncompressed one got dropped by the list.
-aneesh
Quoted 6 lines · Aneesh Kumar K.V
I am attaching below the PATCH 2/4 in .gz format. The uncompressed one got dropped by the list.
-aneesh
hmm makes it hard to comment in-line though :) So basing this on the patch currently in the git repo.
+/*
+ * default stripe size = 1MB
+ */
+#define MB_DEFAULT_STRIPE 256
Units? Doesn't seem to matter anyway as it's never referenced.
+ /* tunables */ + unsigned long s_mb_factor; + unsigned long s_stripe; + unsigned long s_mb_small_req; + unsigned long s_mb_large_req; + unsigned long s_mb_max_to_scan; + unsigned long s_mb_min_to_scan;
could we get some comments here as to what these are, and what units?
Same is true many places... for example
+static int mb_find_extent(struct ext4_buddy *e3b, int order, int block,
+ int needed, struct ext4_free_extent *ex)
how many "what" are needed?
And perhaps an addition of the new mount options to Documentation/fs/ext4.txt would be good.
+#define EXT4_MB_BITMAP(e3b) ((e3b)->bd_bitmap)
+#define EXT4_MB_BUDDY(e3b) ((e3b)->bd_buddy)
For the sake of consistency should these (and others) be e4b?
Also there are a *lot* of BUGs and BUG_ONs added in this patch... are none of these recoverable?
Thanks,
-Eric
Review
Quoted 4 lines · Eric Sandeen
(quoted diff) +4
-0+/* + * default stripe size = 1MB + */ +#define MB_DEFAULT_STRIPE 256
agree, though seems we'd better make it blocksize-insensitive
Quoted 11 lines
Units? Doesn't seem to matter anyway as it's never referenced.
(quoted diff) +7
-0+ /* tunables */ + unsigned long s_mb_factor; + unsigned long s_stripe; + unsigned long s_mb_small_req; + unsigned long s_mb_large_req; + unsigned long s_mb_max_to_scan; + unsigned long s_mb_min_to_scan;
Quoted 1 line
could we get some comments here as to what these are, and what units?
OK, I'll do as well as policy (and tunning) description.
Quoted 7 lines
Same is true many places... for example
(quoted diff) +2
-0+static int mb_find_extent(struct ext4_buddy *e3b, int order, int block, + int needed, struct ext4_free_extent *ex)how many "what" are needed?
well, blocks :)
Quoted 7 lines
And perhaps an addition of the new mount options to
Documentation/fs/ext4.txtwould be good.(quoted diff) +2
-0+#define EXT4_MB_BITMAP(e3b) ((e3b)->bd_bitmap) +#define EXT4_MB_BUDDY(e3b) ((e3b)->bd_buddy)For the sake of consistency should these (and others) be e4b?
OK
Quoted 3 lines
Also there are a *lot* of BUGs and
BUG_ONsadded in this patch... are none of these recoverable?
well, I'll review the code in this regard again, but most of them are not. not that I like kernel panics, but BUG_ON() are very helpful to maintain code, especially in long-term.
thanks, Alex
Quoted 7 lines · Alex Tomas
Review
Quoted 4 lines · Eric Sandeen
(quoted diff) +4
-0+/* + * default stripe size = 1MB + */ +#define MB_DEFAULT_STRIPE 256agree, though seems we'd better make it blocksize-insensitive
Well, for now this isn't even used at *all* so might as well just remove it.
Quoted 6 lines
Quoted 4 lines
(quoted diff) +2
-0+static int mb_find_extent(struct ext4_buddy *e3b, int order, int block, + int needed, struct ext4_free_extent *ex)how many "what" are needed?
well, blocks :)
I figured, though bytes is a possibility. :) In general, being explicit about units helps; xfs suffers a bit from byte/block/sector confusion in the code, in some places.
Quoted 6 lines
Quoted 2 lines
Also there are a *lot* of BUGs and
BUG_ONsadded in this patch... are none of these recoverable?well, I'll review the code in this regard again, but most of them are not. not that I like kernel panics, but
BUG_ON()are very helpful to maintain code, especially in long-term.
Ok, I just think there might be upstream pushback on these, at one point at least they were trying to reduce the nr. of BUG calls in the code...
Thanks,
-Eric