Index: uspace/lib/ext2/libext2_directory.c
===================================================================
--- uspace/lib/ext2/libext2_directory.c	(revision 18626b313017dbffad370b7856191b8c62bae88e)
+++ uspace/lib/ext2/libext2_directory.c	(revision 16b2ea806772c8248f22d7bca76ce18008b836be)
@@ -93,5 +93,5 @@
 	it->fs = fs;
 	
-	// Get the first data block, so we can get first entry
+	/* Get the first data block, so we can get the first entry */
 	rc = ext2_filesystem_get_inode_data_block_index(fs, inode_ref->inode, 0, 
 	    &block_id);
@@ -133,5 +133,5 @@
 	size = ext2_inode_get_size(it->fs->superblock, it->inode_ref->inode);
 	
-	// Are we at the end?
+	/* Are we at the end? */
 	if (it->current_offset + skip >= size) {
 		rc = block_put(it->current_block);
@@ -150,6 +150,7 @@
 	next_block_idx = (it->current_offset + skip) / block_size;
 	
-	// If we are moving accross block boundary,
-	// we need to get another block
+	/* If we are moving accross block boundary,
+	 * we need to get another block
+	 */
 	if (current_block_idx != next_block_idx) {
 		rc = block_put(it->current_block);
@@ -176,5 +177,5 @@
 	offset_in_block = (it->current_offset + skip) % block_size;
 	
-	// Ensure proper alignment
+	/* Ensure proper alignment */
 	if ((offset_in_block % 4) != 0) {
 		it->current = NULL;
@@ -182,5 +183,5 @@
 	}
 	
-	// Ensure that the core of the entry does not overflow the block
+	/* Ensure that the core of the entry does not overflow the block */
 	if (offset_in_block > block_size - 8) {
 		it->current = NULL;
@@ -191,5 +192,5 @@
 	it->current_offset += skip;
 	
-	// Ensure that the whole entry does not overflow the block
+	/* Ensure that the whole entry does not overflow the block */
 	skip = ext2_directory_entry_ll_get_entry_length(it->current);
 	if (offset_in_block + skip > block_size) {
@@ -198,5 +199,5 @@
 	}
 	
-	// Ensure the name length is not too large
+	/* Ensure the name length is not too large */
 	if (ext2_directory_entry_ll_get_name_length(it->fs->superblock, 
 	    it->current) > skip-8) {
Index: uspace/lib/ext2/libext2_filesystem.c
===================================================================
--- uspace/lib/ext2/libext2_filesystem.c	(revision 18626b313017dbffad370b7856191b8c62bae88e)
+++ uspace/lib/ext2/libext2_filesystem.c	(revision 16b2ea806772c8248f22d7bca76ce18008b836be)
@@ -117,8 +117,8 @@
 int ext2_filesystem_check_flags(ext2_filesystem_t *fs, bool *o_read_only)
 {
-	// feature flags are present in rev 1 and later
+	/* feature flags are present in rev 1 and later */
 	if (ext2_superblock_get_rev_major(fs->superblock) == 0) {
 		*o_read_only = false;
-		return 0;
+		return EOK;
 	}
 	
@@ -129,5 +129,7 @@
 	read_only = ext2_superblock_get_features_read_only(fs->superblock);
 	
-	// unset any supported features
+	/* check whether we support all features
+	 * first unset any supported feature flags
+	 * and see whether any unspported feature remains */
 	incompatible &= ~EXT2_SUPPORTED_INCOMPATIBLE_FEATURES;
 	read_only &= ~EXT2_SUPPORTED_READ_ONLY_FEATURES;
@@ -171,8 +173,8 @@
 	    / EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE;
 	
-	// Block group descriptor table starts at the next block after superblock
+	/* Block group descriptor table starts at the next block after superblock */
 	block_id = ext2_superblock_get_first_block(fs->superblock) + 1;
 	
-	// Find the block containing the descriptor we are looking for
+	/* Find the block containing the descriptor we are looking for */
 	block_id += bgid / descriptors_per_block;
 	offset = (bgid % descriptors_per_block) * EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE;
@@ -240,5 +242,7 @@
 	inodes_per_group = ext2_superblock_get_inodes_per_group(fs->superblock);
 	
-	// inode numbers are 1-based
+	/* inode numbers are 1-based, but it is simpler to work with 0-based
+	 * when computing indices
+	 */
 	index -= 1;
 	block_group = index / inodes_per_group;
@@ -269,5 +273,8 @@
 	
 	newref->inode = newref->block->data + offset_in_block;
-	newref->index = index+1; // we decremented index above
+	/* we decremented index above, but need to store the original value
+	 * in the reference
+	 */
+	newref->index = index+1;
 	
 	*ref = newref;
@@ -315,4 +322,5 @@
 	block_t *block;
 	
+	/* Handle simple case when we are dealing with direct reference */ 
 	if (iblock < EXT2_INODE_DIRECT_BLOCKS) {
 		current_block = ext2_inode_get_direct_block(inode, (uint32_t)iblock);
@@ -321,6 +329,7 @@
 	}
 	
-	// Compute limits for indirect block levels
-	// TODO: compute this once when loading filesystem and store in ext2_filesystem_t
+	/* Compute limits for indirect block levels
+	 * TODO: compute this once when loading filesystem and store in ext2_filesystem_t
+	 */
 	block_ids_per_block = ext2_superblock_get_block_size(fs->superblock) / sizeof(uint32_t);
 	limits[0] = EXT2_INODE_DIRECT_BLOCKS;
@@ -332,5 +341,5 @@
 	}
 	
-	// Determine the indirection level needed to get the desired block
+	/* Determine the indirection level needed to get the desired block */
 	level = -1;
 	for (i = 1; i < 4; i++) {
@@ -345,8 +354,12 @@
 	}
 	
+	/* Compute offsets for the topmost level */
 	block_offset_in_level = iblock - limits[level-1];
 	current_block = ext2_inode_get_indirect_block(inode, level-1);
 	offset_in_block = block_offset_in_level / blocks_per_level[level-1];
 	
+	/* Navigate through other levels, until we find the block number
+	 * or find null reference meaning we are dealing with sparse file
+	 */
 	while (level > 0) {
 		rc = block_get(&block, fs->device, current_block, 0);
@@ -364,4 +377,5 @@
 		
 		if (current_block == 0) {
+			/* This is a sparse file */
 			*fblock = 0;
 			return EOK;
@@ -370,8 +384,12 @@
 		level -= 1;
 		
+		/* If we are on the last level, break here as
+		 * there is no next level to visit
+		 */
 		if (level == 0) {
 			break;
 		}
 		
+		/* Visit the next level */
 		block_offset_in_level %= blocks_per_level[level];
 		offset_in_block = block_offset_in_level / blocks_per_level[level-1];
@@ -385,4 +403,7 @@
 /**
  * Allocate a given number of blocks and store their ids in blocks
+ * 
+ * @todo TODO: This function is not finished and really has never been
+ *             used (and tested) yet
  * 
  * @param fs pointer to filesystem
@@ -420,5 +441,5 @@
 	idx = 0;
 	
-	// Read the block group descriptor
+	/* Read the block group descriptor */
 	rc = ext2_filesystem_get_block_group_ref(fs, block_group, &bg);
 	if (rc != EOK) {
@@ -444,5 +465,5 @@
 		}
 		
-		// We found a block group with free block, let's look at the block bitmap
+		/* We found a block group with free block, let's look at the block bitmap */
 		bb_block = ext2_block_group_get_block_bitmap_block(bg->block_group);
 		
@@ -452,5 +473,5 @@
 		}
 		
-		// Use all blocks from this block group
+		/* Use all blocks from this block group */
 		for (bb_idx = 0; bb_idx < block_size && idx < count; bb_idx++) {
 			uint8_t *data = (uint8_t *) block->data;
@@ -458,5 +479,5 @@
 				continue;
 			}
-			// find an empty bit
+			/* find an empty bit */
 			uint8_t mask;
 			for (mask = 1, bb_bit = 0;
