Index: uspace/lib/ext4/libext4_extent.c
===================================================================
--- uspace/lib/ext4/libext4_extent.c	(revision 728d771b70f52d20161ed3599fe51a7d6d8ee239)
+++ uspace/lib/ext4/libext4_extent.c	(revision ee3b615091b763680035bf1f5392ac0e39642c36)
@@ -523,7 +523,14 @@
 }
 
-// TODO comments
-
-// Recursive release
+/** Recursively release the whole branch of the extent tree.
+ *
+ * For each entry of the node release the subbranch and finally release
+ * the node. In the leaf node all extents will be released.
+ *
+ * @param inode_ref		i-node where the branch is released
+ * @param index			index in the non-leaf node to be released
+ * 						with the whole subtree
+ * @return				error code
+ */
 static int ext4_extent_release_branch(ext4_inode_ref_t *inode_ref,
 		ext4_extent_index_t *index)
@@ -534,6 +541,4 @@
 
 	uint32_t fblock = ext4_extent_index_get_leaf(index);
-
-//	EXT4FS_DBG("fblock = \%u", fblock);
 
 	rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NOREAD);
@@ -547,6 +552,9 @@
 	if (ext4_extent_header_get_depth(header)) {
 
+		// The node is non-leaf, do recursion
+
 		ext4_extent_index_t *idx = EXT4_EXTENT_FIRST_INDEX(header);
 
+		// Release all subbranches
 		for (uint32_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i, ++idx) {
 			rc = ext4_extent_release_branch(inode_ref, idx);
@@ -557,5 +565,9 @@
 		}
 	} else {
+
+		// Leaf node reached
 		ext4_extent_t *ext = EXT4_EXTENT_FIRST(header);
+
+		// Release all extents and stop recursion
 
 		for (uint32_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i, ++ext) {
@@ -568,4 +580,6 @@
 	}
 
+	// Release data block where the node was stored
+
 	rc = block_put(block);
 	if (rc != EOK) {
@@ -579,4 +593,9 @@
 }
 
+/** Release all data blocks starting from specified logical block.
+ *
+ * @param inode_ref		i-node to release blocks from
+ * @param iblock_from	first logical block to release
+ */
 int ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref,
 		uint32_t iblock_from)
@@ -609,4 +628,5 @@
 			ext4_extent_get_start(path_ptr->extent);
 
+	// Release all blocks
 	rc = ext4_balloc_free_blocks(inode_ref, first_fblock, delete_count);
 	if (rc != EOK) {
@@ -614,7 +634,9 @@
 	}
 
+	// Correct counter
 	block_count -= delete_count;
 	ext4_extent_set_block_count(path_ptr->extent, block_count);
 
+	// Initialize the following loop
 	uint16_t entries = ext4_extent_header_get_entries_count(path_ptr->header);
 	ext4_extent_t *tmp_ext = path_ptr->extent + 1;
@@ -658,6 +680,6 @@
 	--path_ptr;
 
-	// release all successors in all levels
-	while(path_ptr >= path) {
+	// release all successors in all tree levels
+	while (path_ptr >= path) {
 		entries = ext4_extent_header_get_entries_count(path_ptr->header);
 		ext4_extent_index_t *index = path_ptr->index + 1;
@@ -665,9 +687,14 @@
 				EXT4_EXTENT_FIRST_INDEX(path_ptr->header) + entries;
 
+		// Correct entry because of changes in the previous iteration
 		if (check_tree) {
 			entries--;
 			ext4_extent_header_set_entries_count(path_ptr->header, entries);
-		}
-
+		} else {
+			// TODO check this condition
+			break;
+		}
+
+		// Iterate over all entries and release the whole subtrees
 		while (index < stop) {
 			rc = ext4_extent_release_branch(inode_ref, index);
@@ -682,4 +709,5 @@
 		path_ptr->block->dirty = true;
 
+		// Free the node if it is empty
 		if ((entries == 0) && (path_ptr != path)) {
 			rc = ext4_balloc_free_block(inode_ref, path_ptr->block->lba);
@@ -687,4 +715,6 @@
 				goto cleanup;
 			}
+
+			// Mark parent to be checked
 			check_tree = true;
 		} else {
@@ -711,4 +741,7 @@
 }
 
+/** TODO
+ *
+ */
 static int ext4_extent_append_extent(ext4_inode_ref_t *inode_ref,
 		ext4_extent_path_t *path, ext4_extent_path_t **last_path_item,
Index: uspace/lib/ext4/libext4_hash.c
===================================================================
--- uspace/lib/ext4/libext4_hash.c	(revision 728d771b70f52d20161ed3599fe51a7d6d8ee239)
+++ uspace/lib/ext4/libext4_hash.c	(revision ee3b615091b763680035bf1f5392ac0e39642c36)
@@ -227,4 +227,14 @@
 }
 
+
+/** Compute hash value of the string.
+ *
+ * @param hinfo		hash info structure with information about
+ * 					the algorithm, hash seed and with the place
+ * 					for the output hash value
+ * @param len		length of the name
+ * @param name		name to be hashed
+ * @return			error code
+ */
 int ext4_hash_string(ext4_hash_info_t *hinfo, int len, const char *name)
 {
Index: uspace/lib/ext4/libext4_ialloc.c
===================================================================
--- uspace/lib/ext4/libext4_ialloc.c	(revision 728d771b70f52d20161ed3599fe51a7d6d8ee239)
+++ uspace/lib/ext4/libext4_ialloc.c	(revision ee3b615091b763680035bf1f5392ac0e39642c36)
@@ -40,4 +40,11 @@
 #include "libext4.h"
 
+
+/** Convert i-node number to relative index in block group.
+ *
+ * @param sb	superblock
+ * @param inode	i-node number to be converted
+ * @return		index of the i-node in the block group
+ */
 static uint32_t ext4_ialloc_inode2index_in_group(ext4_superblock_t *sb,
 		uint32_t inode)
@@ -47,4 +54,10 @@
 }
 
+/** Convert relative index of i-node to absolute i-node number.
+ *
+ * @param sb	superblock
+ * @param inode	index to be converted
+ * @return		absolute number of the i-node
+ */
 static uint32_t ext4_ialloc_index_in_group2inode(ext4_superblock_t *sb,
 		uint32_t index, uint32_t bgid)
@@ -54,4 +67,10 @@
 }
 
+/** Compute block group number from the i-node number.
+ *
+ * @param sb		superblock
+ * @param inode		i-node number to be found the block group for
+ * @return			block group number computed from i-node number
+ */
 static uint32_t ext4_ialloc_get_bgid_of_inode(ext4_superblock_t *sb,
 		uint32_t inode)
@@ -63,4 +82,10 @@
 
 
+/** Free i-node number and modify filesystem data structers.
+ *
+ * @param fs		filesystem, where the i-node is located
+ * @param index		index of i-node to be release
+ * @param is_dir	flag us for information whether i-node is directory or not
+ */
 int ext4_ialloc_free_inode(ext4_filesystem_t *fs, uint32_t index, bool is_dir)
 {
@@ -69,4 +94,5 @@
 	ext4_superblock_t *sb = fs->superblock;
 
+	// Compute index of block group and load it
 	uint32_t block_group = ext4_ialloc_get_bgid_of_inode(sb, index);
 
@@ -77,4 +103,5 @@
 	}
 
+	// Load i-node bitmap
 	uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
 			bg_ref->block_group, sb);
@@ -85,8 +112,10 @@
 	}
 
+	// Free i-node in the bitmap
 	uint32_t index_in_group = ext4_ialloc_inode2index_in_group(sb, index);
 	ext4_bitmap_free_bit(bitmap_block->data, index_in_group);
 	bitmap_block->dirty = true;
 
+	// Put back the block with bitmap
 	rc = block_put(bitmap_block);
 	if (rc != EOK) {
@@ -96,5 +125,5 @@
 	}
 
-	// if inode is directory, decrement used directories count
+	// If released i-node is a directory, decrement used directories count
 	if (is_dir) {
 		uint32_t bg_used_dirs = ext4_block_group_get_used_dirs_count(
@@ -112,4 +141,5 @@
 			sb, free_inodes);
 
+	// Set unused i-nodes count if supported
 	if (ext4_block_group_has_flag(bg_ref->block_group, EXT4_BLOCK_GROUP_INODE_UNINIT)) {
 		uint32_t unused_inodes = ext4_block_group_get_itable_unused(
@@ -121,4 +151,5 @@
 	bg_ref->dirty = true;
 
+	// Put back the modified block group
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
 	if (rc != EOK) {
@@ -134,4 +165,13 @@
 }
 
+/** I-node allocation algorithm.
+ *
+ * This is more simple algorithm, than Orlov allocator used in the Linux kernel
+ *
+ * @param fs		filesystem to allocate i-node on
+ * @param index		output value - allocated i-node number
+ * @param is_dir 	flag if allocated i-node will be file or directory
+ * @return			error code
+ */
 int ext4_ialloc_alloc_inode(ext4_filesystem_t *fs, uint32_t *index, bool is_dir)
 {
@@ -145,6 +185,8 @@
 	uint32_t avg_free_inodes = sb_free_inodes / bg_count;
 
+	// Try to find free i-node in all block groups
 	while (bgid < bg_count) {
 
+		// Load block group to check
 		ext4_block_group_ref_t *bg_ref;
 		rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
@@ -152,12 +194,16 @@
 			return rc;
 		}
+
 		ext4_block_group_t *bg = bg_ref->block_group;
 
+		// Read necessary values for algorithm
 		uint32_t free_blocks = ext4_block_group_get_free_blocks_count(bg, sb);
 		uint32_t free_inodes = ext4_block_group_get_free_inodes_count(bg, sb);
 		uint32_t used_dirs = ext4_block_group_get_used_dirs_count(bg, sb);
 
+		// Check if this block group is good candidate for allocation
 		if ((free_inodes >= avg_free_inodes) && (free_blocks > 0)) {
 
+			// Load block with bitmap
 			uint32_t bitmap_block_addr =  ext4_block_group_get_inode_bitmap(
 					bg_ref->block_group, sb);
@@ -170,5 +216,5 @@
 			}
 
-			// Alloc bit
+			// Try to allocate i-node in the bitmap
 			uint32_t inodes_in_group = ext4_superblock_get_inodes_in_group(sb, bgid);
 			uint32_t index_in_group;
@@ -176,5 +222,5 @@
 					bitmap_block->data, 0, &index_in_group, inodes_in_group);
 
-			// Block group is full (inodes)
+			// Block group has not any free i-node
 			if (rc == ENOSPC) {
 				block_put(bitmap_block);
@@ -183,4 +229,5 @@
 			}
 
+			// Free i-node found, save the bitmap
 			bitmap_block->dirty = true;
 
@@ -194,4 +241,5 @@
 			ext4_block_group_set_free_inodes_count(bg, sb, free_inodes);
 
+			// Decrement unused i-nodes counter if supported
 			if (ext4_block_group_has_flag(bg, EXT4_BLOCK_GROUP_INODE_UNINIT)) {
 				uint16_t unused_inodes = ext4_block_group_get_itable_unused(bg, sb);
@@ -200,4 +248,5 @@
 			}
 
+			// Increment used directories counter
 			if (is_dir) {
 				used_dirs++;
@@ -205,4 +254,5 @@
 			}
 
+			// Save modified block group
 			bg_ref->dirty = true;
 
@@ -213,7 +263,9 @@
 			}
 
+			// Update superblock
 			sb_free_inodes--;
 			ext4_superblock_set_free_inodes_count(sb, sb_free_inodes);
 
+			// Compute the absolute i-nodex number
 			*index = ext4_ialloc_index_in_group2inode(sb, index_in_group, bgid);
 
@@ -222,5 +274,5 @@
 		}
 
-		// Not modified
+		// Block group not modified, put it and jump to the next block group
 		ext4_filesystem_put_block_group_ref(bg_ref);
 		++bgid;
