Index: uspace/lib/ext4/libext4.h
===================================================================
--- uspace/lib/ext4/libext4.h	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4.h	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -49,5 +49,5 @@
 
 #include <stdio.h>
-#define EXT4FS_DBG(format, ...) {if (true) printf("ext4fs: %s: " format "\n", __FUNCTION__, ##__VA_ARGS__);}
+#define EXT4FS_DBG(format, ...) {printf("ext4fs: %s: " format "\n", __FUNCTION__, ##__VA_ARGS__);}
 
 #endif
Index: uspace/lib/ext4/libext4_balloc.c
===================================================================
--- uspace/lib/ext4/libext4_balloc.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_balloc.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -60,5 +60,4 @@
 }
 
-
 /** Free block.
  *
@@ -83,5 +82,4 @@
 	rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in loading bg_ref \%d", rc);
 		return rc;
 	}
@@ -93,5 +91,4 @@
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in loading bitmap \%d", rc);
 		return rc;
 	}
@@ -107,5 +104,4 @@
 		/* Error in saving bitmap */
 		ext4_filesystem_put_block_group_ref(bg_ref);
-		EXT4FS_DBG("error in saving bitmap \%d", rc);
 		return rc;
 	}
@@ -135,5 +131,4 @@
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in saving bg_ref \%d", rc);
 		return rc;
 	}
@@ -169,5 +164,4 @@
 	rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in loading bg_ref \%d", rc);
 		return rc;
 	}
@@ -184,5 +178,4 @@
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in loading bitmap \%d", rc);
 		return rc;
 	}
@@ -197,5 +190,4 @@
 		/* Error in saving bitmap */
 		ext4_filesystem_put_block_group_ref(bg_ref);
-		EXT4FS_DBG("error in saving bitmap \%d", rc);
 		return rc;
 	}
@@ -225,5 +217,4 @@
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in saving bg_ref \%d", rc);
 		return rc;
 	}
@@ -368,5 +359,4 @@
 	if (goal == 0) {
 		/* no goal found => partition is full */
-		EXT4FS_DBG("ERROR (goal == 0)");
 		return ENOSPC;
 	}
@@ -384,5 +374,4 @@
 	rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, block_group, &bg_ref);
 	if (rc != EOK) {
-		EXT4FS_DBG("initial BG ref not loaded");
 		return rc;
 	}
@@ -407,5 +396,4 @@
 	if (rc != EOK) {
 		ext4_filesystem_put_block_group_ref(bg_ref);
-		EXT4FS_DBG("initial bitmap not loaded");
 		return rc;
 	}
@@ -417,5 +405,4 @@
 		rc = block_put(bitmap_block);
 		if (rc != EOK) {
-			EXT4FS_DBG("goal check: error in saving bitmap \%d", rc);
 			ext4_filesystem_put_block_group_ref(bg_ref);
 			return rc;
@@ -444,5 +431,4 @@
 			rc = block_put(bitmap_block);
 			if (rc != EOK) {
-				EXT4FS_DBG("near blocks: error in saving initial bitmap \%d", rc);
 				return rc;
 			}
@@ -462,5 +448,4 @@
 		rc = block_put(bitmap_block);
 		if (rc != EOK) {
-			EXT4FS_DBG("free byte: error in saving initial bitmap \%d", rc);
 			return rc;
 		}
@@ -478,5 +463,4 @@
 		rc = block_put(bitmap_block);
 		if (rc != EOK) {
-			EXT4FS_DBG("free bit: error in saving initial bitmap \%d", rc);
 			return rc;
 		}
@@ -501,5 +485,4 @@
 		rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, bgid, &bg_ref);
 		if (rc != EOK) {
-			EXT4FS_DBG("ERROR: unable to load block group \%u", bgid);
 			return rc;
 		}
@@ -512,5 +495,4 @@
 		if (rc != EOK) {
 			ext4_filesystem_put_block_group_ref(bg_ref);
-			EXT4FS_DBG("ERROR: unable to load bitmap block");
 			return rc;
 		}
@@ -531,10 +513,10 @@
 
 		/* Try to find free byte in bitmap */
-		rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data, index_in_group, &rel_block_idx, blocks_in_group);
+		rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
+				index_in_group, &rel_block_idx, blocks_in_group);
 		if (rc == EOK) {
 			bitmap_block->dirty = true;
 			rc = block_put(bitmap_block);
 			if (rc != EOK) {
-				EXT4FS_DBG("ERROR: unable to save bitmap block");
 				return rc;
 			}
@@ -552,5 +534,4 @@
 			rc = block_put(bitmap_block);
 			if (rc != EOK) {
-				EXT4FS_DBG("ERROR: unable to save bitmap block");
 				return rc;
 			}
@@ -625,5 +606,4 @@
 	rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in loading bg_ref \%d", rc);
 		return rc;
 	}
@@ -635,5 +615,4 @@
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in loading bitmap \%d", rc);
 		return rc;
 	}
@@ -653,5 +632,4 @@
 		/* Error in saving bitmap */
 		ext4_filesystem_put_block_group_ref(bg_ref);
-		EXT4FS_DBG("error in saving bitmap \%d", rc);
 		return rc;
 	}
@@ -687,5 +665,4 @@
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in saving bg_ref \%d", rc);
 		return rc;
 	}
Index: uspace/lib/ext4/libext4_directory.c
===================================================================
--- uspace/lib/ext4/libext4_directory.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_directory.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -413,6 +413,4 @@
 		ext4_inode_clear_flag(parent->inode, EXT4_INODE_FLAG_INDEX);
 		parent->dirty = true;
-
-		EXT4FS_DBG("index is corrupted - doing linear algorithm, index flag cleared");
 	}
 
@@ -522,5 +520,4 @@
 		parent->dirty = true;
 
-		EXT4FS_DBG("index is corrupted - doing linear search");
 	}
 
Index: uspace/lib/ext4/libext4_directory_index.c
===================================================================
--- uspace/lib/ext4/libext4_directory_index.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_directory_index.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -318,5 +318,4 @@
 	/* Check unused flags */
 	if (root->info.unused_flags != 0) {
-		EXT4FS_DBG("ERR: unused_flags = \%u", root->info.unused_flags);
 		return EXT4_ERR_BAD_DX_DIR;
 	}
@@ -324,5 +323,4 @@
 	/* Check indirect levels */
 	if (root->info.indirect_levels > 1) {
-		EXT4FS_DBG("ERR: indirect_levels = \%u", root->info.indirect_levels);
 		return EXT4_ERR_BAD_DX_DIR;
 	}
@@ -897,5 +895,4 @@
 		/* Linux limitation */
 		if ((levels > 0) && (root_limit == root_count)) {
-			EXT4FS_DBG("Directory index is full");
 			return ENOSPC;
 		}
@@ -1039,5 +1036,4 @@
 	if (rc != EOK) {
 		block_put(root_block);
-		EXT4FS_DBG("hinfo initialization error");
 		return EXT4_ERR_BAD_DX_DIR;
 	}
@@ -1048,5 +1044,4 @@
 	rc = ext4_directory_dx_get_leaf(&hinfo, parent, root_block, &dx_block, dx_blocks);
 	if (rc != EOK) {
-		EXT4FS_DBG("get leaf error");
 		rc = EXT4_ERR_BAD_DX_DIR;
 		goto release_index;
@@ -1102,5 +1097,4 @@
 	rc = block_put(new_block);
 	if (rc != EOK) {
-		EXT4FS_DBG("error writing new block");
 		return rc;
 	}
@@ -1114,5 +1108,4 @@
 	rc = block_put(target_block);
 	if (rc != EOK) {
-		EXT4FS_DBG("error writing target block");
 		return rc;
 	}
@@ -1129,5 +1122,4 @@
 		rc = block_put(dx_it->block);
 		if (rc != EOK) {
-			EXT4FS_DBG("error writing index block");
 			return rc;
 		}
Index: uspace/lib/ext4/libext4_extent.c
===================================================================
--- uspace/lib/ext4/libext4_extent.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_extent.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -506,5 +506,4 @@
 	rc = ext4_balloc_free_blocks(inode_ref, start, block_count);
 	if (rc != EOK) {
-		EXT4FS_DBG("Error in releasing data blocks");
 		return rc;
 	}
@@ -534,5 +533,4 @@
 	rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
 	if (rc != EOK) {
-		EXT4FS_DBG("ERROR get_block");
 		return rc;
 	}
@@ -550,5 +548,4 @@
 			rc = ext4_extent_release_branch(inode_ref, idx);
 			if (rc != EOK) {
-				EXT4FS_DBG("error recursion");
 				return rc;
 			}
@@ -564,5 +561,4 @@
 			rc = ext4_extent_release(inode_ref, ext);
 			if (rc != EOK) {
-				EXT4FS_DBG("error recursion");
 				return rc;
 			}
@@ -574,5 +570,4 @@
 	rc = block_put(block);
 	if (rc != EOK) {
-		EXT4FS_DBG("ERROR block_put returned \%d", rc);
 		return rc;
 	}
@@ -837,5 +832,4 @@
 		rc = ext4_balloc_alloc_block(inode_ref, &new_fblock);
 		if (rc != EOK) {
-			EXT4FS_DBG("error in block allocation");
 			return rc;
 		}
@@ -845,5 +839,4 @@
 				new_fblock, BLOCK_FLAGS_NOREAD);
 		if (rc != EOK) {
-			EXT4FS_DBG("error in block_get");
 			return rc;
 		}
@@ -1049,5 +1042,4 @@
 	rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
 	if (rc != EOK) {
-		EXT4FS_DBG("error in block allocation, rc = \%d", rc);
 		goto finish;
 	}
Index: uspace/lib/ext4/libext4_filesystem.c
===================================================================
--- uspace/lib/ext4/libext4_filesystem.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_filesystem.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -56,5 +56,4 @@
 	rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
 	if (rc != EOK) {
-		EXT4FS_DBG("block init error: \%d", rc);
 		return rc;
 	}
@@ -65,5 +64,4 @@
 	if (rc != EOK) {
 		block_fini(fs->device);
-		EXT4FS_DBG("superblock read error: \%d", rc);
 		return rc;
 	}
@@ -73,5 +71,4 @@
 	if (block_size > EXT4_MAX_BLOCK_SIZE) {
 		block_fini(fs->device);
-		EXT4FS_DBG("get blocksize error: \%d", rc);
 		return ENOTSUP;
 	}
@@ -81,5 +78,4 @@
 	if (rc != EOK) {
 		block_fini(fs->device);
-		EXT4FS_DBG("block cache init error: \%d", rc);
 		return rc;
 	}
@@ -104,5 +100,4 @@
 		block_cache_fini(fs->device);
 		block_fini(fs->device);
-		EXT4FS_DBG("Unable to mount: Invalid state error");
 		return ENOTSUP;
 	}
@@ -114,5 +109,4 @@
 		block_cache_fini(fs->device);
 		block_fini(fs->device);
-		EXT4FS_DBG("state write error: \%d", rc);
 		return rc;
 	}
@@ -192,5 +186,4 @@
 	incompatible_features &= ~EXT4_FEATURE_INCOMPAT_SUPP;
 	if (incompatible_features > 0) {
-		EXT4FS_DBG("Not supported incompatible features");
 		return ENOTSUP;
 	}
@@ -203,5 +196,4 @@
 	compatible_read_only &= ~EXT4_FEATURE_RO_COMPAT_SUPP;
 	if (compatible_read_only > 0) {
-		EXT4FS_DBG("Not supported readonly features - mounting READ-ONLY");
 		*read_only = true;
 		return EOK;
@@ -357,5 +349,6 @@
  * @param bg_ref	reference to block group
  * @return			error code
- */static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
+ */
+static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
 {
 	int rc;
@@ -1405,90 +1398,4 @@
 }
 
-/** Add orphaned i-node to the orphans linked list.
- *
- * @param inode_ref		i-node to be added to orphans list
- * @return				error code
- */
-int ext4_filesystem_add_orphan(ext4_inode_ref_t *inode_ref)
-{
-	uint32_t next_orphan = ext4_superblock_get_last_orphan(
-			inode_ref->fs->superblock);
-
-	/* Deletion time is used for holding next item of the list */
-	ext4_inode_set_deletion_time(inode_ref->inode, next_orphan);
-
-	/* Head of the list is in the superblock */
-	ext4_superblock_set_last_orphan(
-			inode_ref->fs->superblock, inode_ref->index);
-	inode_ref->dirty = true;
-
-	return EOK;
-}
-
-/** Delete orphaned i-node from the orphans linked list.
- *
- * @param inode_ref		i-node to be deleted from the orphans list
- * @return				error code
- */
-int ext4_filesystem_delete_orphan(ext4_inode_ref_t *inode_ref)
-{
-	int rc;
-
-	/* Get head of the linked list */
-	uint32_t last_orphan = ext4_superblock_get_last_orphan(
-			inode_ref->fs->superblock);
-
-	assert (last_orphan != 0);
-
-	ext4_inode_ref_t *current;
-	rc = ext4_filesystem_get_inode_ref(inode_ref->fs, last_orphan, &current);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	uint32_t next_orphan = ext4_inode_get_deletion_time(current->inode);
-
-	/* Check if the head is the target */
-	if (last_orphan == inode_ref->index) {
-		ext4_superblock_set_last_orphan(inode_ref->fs->superblock, next_orphan);
-		return EOK;
-	}
-
-	bool found = false;
-
-	/* Walk thourgh the linked list */
-	while (next_orphan != 0) {
-
-		/* Found? */
-		if (next_orphan == inode_ref->index) {
-			next_orphan = ext4_inode_get_deletion_time(inode_ref->inode);
-			ext4_inode_set_deletion_time(current->inode, next_orphan);
-			current->dirty = true;
-			found = true;
-			break;
-		}
-
-		ext4_filesystem_put_inode_ref(current);
-
-		rc = ext4_filesystem_get_inode_ref(inode_ref->fs, next_orphan, &current);
-		if (rc != EOK) {
-			return rc;
-		}
-		next_orphan = ext4_inode_get_deletion_time(current->inode);
-
-	}
-
-	rc = ext4_filesystem_put_inode_ref(current);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	if (!found) {
-		return ENOENT;
-	} else {
-		return EOK;
-	}
-}
-
 /**
  * @}
Index: uspace/lib/ext4/libext4_filesystem.h
===================================================================
--- uspace/lib/ext4/libext4_filesystem.h	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_filesystem.h	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -64,9 +64,4 @@
 		uint32_t *, uint32_t *);
 
-extern int ext4_filesystem_add_orphan(ext4_inode_ref_t *);
-extern int ext4_filesystem_delete_orphan(ext4_inode_ref_t *);
-
-extern uint16_t ext4_group_desc_csum(ext4_superblock_t *, uint32_t,
-		ext4_block_group_t *);
 #endif
 
Index: uspace/lib/ext4/libext4_ialloc.c
===================================================================
--- uspace/lib/ext4/libext4_ialloc.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_ialloc.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -244,5 +244,4 @@
 			rc = ext4_filesystem_put_block_group_ref(bg_ref);
 			if (rc != EOK) {
-				EXT4FS_DBG("ERROR: unable to put block group reference");
 				return rc;
 			}
Index: uspace/lib/ext4/libext4_superblock.c
===================================================================
--- uspace/lib/ext4/libext4_superblock.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/lib/ext4/libext4_superblock.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -1081,6 +1081,4 @@
 	}
 
-	// TODO more checks !!!
-
 	return EOK;
 }
Index: uspace/srv/fs/ext4fs/ext4fs_ops.c
===================================================================
--- uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision 34bc2fe78a94616e57eca85354f1cab7e65d0363)
+++ uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision fe61181fa59a4e6299307c453129da8aa2539451)
@@ -553,16 +553,4 @@
 	}
 
-	/* Handle orphans */
-	// TODO this code should be deleted
-//	ext4_filesystem_t *fs = enode->instance->filesystem;
-//	uint32_t rev_level = ext4_superblock_get_rev_level(fs->superblock);
-//	uint16_t lnk_count = ext4_inode_get_links_count(inode_ref->inode);
-//	if ((rev_level > 0) && (lnk_count == 0)) {
-//		rc = ext4_filesystem_delete_orphan(inode_ref);
-//		if (rc != EOK) {
-//			EXT4FS_DBG("delete orphan error, rc = \%d", rc);
-//		}
-//	}
-
 	// TODO set real deletion time when it will be supported, temporary set fake time
 //	time_t now = time(NULL);
@@ -704,13 +692,4 @@
 		parent->dirty = true;
 	}
-
-//	ext4_filesystem_t *fs = EXT4FS_NODE(pfn)->instance->filesystem;
-//	uint32_t rev_level = ext4_superblock_get_rev_level(fs->superblock);
-//	if ((rev_level > 0) && (lnk_count == 0)) {
-//		rc = ext4_filesystem_add_orphan(child_inode_ref);
-//		if (rc != EOK) {
-//			EXT4FS_DBG("add orphan error, rc = \%d", rc);
-//		}
-//	}
 
 	// TODO set timestamps for parent (when we have wall-clock time)
