Index: uspace/lib/ext4/src/filesystem.c
===================================================================
--- uspace/lib/ext4/src/filesystem.c	(revision b7fd2a02e4161f4edd38548e7f8456b8021549be)
+++ uspace/lib/ext4/src/filesystem.c	(revision 8800b13065d75eefbc778f2b003bc4253f57fc29)
@@ -289,5 +289,5 @@
 		return EOK;
 	}
-	
+
 	/*
 	 * Check incompatible features - if filesystem has some,
@@ -300,5 +300,5 @@
 	if (incompatible_features > 0)
 		return ENOTSUP;
-	
+
 	/*
 	 * Check read-only features, if filesystem has some,
@@ -313,5 +313,5 @@
 		return EOK;
 	}
-	
+
 	return EOK;
 }
@@ -331,5 +331,5 @@
 	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
 	uint32_t first_block = ext4_superblock_get_first_data_block(sb);
-	
+
 	/* First block == 0 or 1 */
 	if (first_block == 0)
@@ -351,5 +351,5 @@
 {
 	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-	
+
 	if (ext4_superblock_get_first_data_block(sb) == 0)
 		return bgid * blocks_per_group + index;
@@ -392,5 +392,5 @@
 	uint64_t bitmap_inode_addr = ext4_block_group_get_inode_bitmap(
 	    bg_ref->block_group, bg_ref->fs->superblock);
-	
+
 	block_t *bitmap_block;
 	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
@@ -398,11 +398,11 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	uint8_t *bitmap = bitmap_block->data;
-	
+
 	/* Initialize all bitmap bits to zero */
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
 	memset(bitmap, 0, block_size);
-	
+
 	/* Determine the number of reserved blocks in the group */
 	uint32_t reserved_cnt = ext4_filesystem_bg_get_backup_blocks(bg_ref);
@@ -439,5 +439,5 @@
 
 	bitmap_block->dirty = true;
-	
+
 	/* Save bitmap */
 	return block_put(bitmap_block);
@@ -457,12 +457,12 @@
 	    bg_ref->block_group, bg_ref->fs->superblock);
 	block_t *bitmap_block;
-	
+
 	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
 	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
 	if (rc != EOK)
 		return rc;
-	
+
 	uint8_t *bitmap = bitmap_block->data;
-	
+
 	/* Initialize all bitmap bits to zero */
 	uint32_t block_size = ext4_superblock_get_block_size(bg_ref->fs->superblock);
@@ -470,17 +470,17 @@
 	    ext4_superblock_get_inodes_per_group(bg_ref->fs->superblock);
 	memset(bitmap, 0, (inodes_per_group + 7) / 8);
-	
+
 	uint32_t start_bit = inodes_per_group;
 	uint32_t end_bit = block_size * 8;
-	
+
 	uint32_t i;
 	for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
 		ext4_bitmap_set_bit(bitmap, i);
-	
+
 	if (i < end_bit)
 		memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
-	
+
 	bitmap_block->dirty = true;
-	
+
 	/* Save bitmap */
 	return block_put(bitmap_block);
@@ -497,23 +497,23 @@
 {
 	ext4_superblock_t *sb = bg_ref->fs->superblock;
-	
+
 	uint32_t inode_size = ext4_superblock_get_inode_size(sb);
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
 	uint32_t inodes_per_block = block_size / inode_size;
-	
+
 	uint32_t inodes_in_group =
 	    ext4_superblock_get_inodes_in_group(sb, bg_ref->index);
-	
+
 	uint32_t table_blocks = inodes_in_group / inodes_per_block;
-	
+
 	if (inodes_in_group % inodes_per_block)
 		table_blocks++;
-	
+
 	/* Compute initialization bounds */
 	uint32_t first_block = ext4_block_group_get_inode_table_first_block(
 	    bg_ref->block_group, sb);
-	
+
 	uint32_t last_block = first_block + table_blocks - 1;
-	
+
 	/* Initialization of all itable blocks */
 	for (uint32_t fblock = first_block; fblock <= last_block; ++fblock) {
@@ -523,13 +523,13 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		memset(block->data, 0, block_size);
 		block->dirty = true;
-		
+
 		rc = block_put(block);
 		if (rc != EOK)
 			return rc;
 	}
-	
+
 	return EOK;
 }
@@ -552,19 +552,19 @@
 	if (newref == NULL)
 		return ENOMEM;
-	
+
 	/* Compute number of descriptors, that fits in one data block */
 	uint32_t descriptors_per_block =
 	    ext4_superblock_get_block_size(fs->superblock) /
 	    ext4_superblock_get_desc_size(fs->superblock);
-	
+
 	/* Block group descriptor table starts at the next block after superblock */
 	aoff64_t block_id =
 	    ext4_superblock_get_first_data_block(fs->superblock) + 1;
-	
+
 	/* Find the block containing the descriptor we are looking for */
 	block_id += bgid / descriptors_per_block;
 	uint32_t offset = (bgid % descriptors_per_block) *
 	    ext4_superblock_get_desc_size(fs->superblock);
-	
+
 	/* Load block with descriptors */
 	errno_t rc = block_get(&newref->block, fs->device, block_id, 0);
@@ -573,5 +573,5 @@
 		return rc;
 	}
-	
+
 	/* Initialize in-memory representation */
 	newref->block_group = newref->block->data + offset;
@@ -579,7 +579,7 @@
 	newref->index = bgid;
 	newref->dirty = false;
-	
+
 	*ref = newref;
-	
+
 	if (ext4_block_group_has_flag(newref->block_group,
 	    EXT4_BLOCK_GROUP_BLOCK_UNINIT)) {
@@ -590,11 +590,11 @@
 			return rc;
 		}
-		
+
 		ext4_block_group_clear_flag(newref->block_group,
 		    EXT4_BLOCK_GROUP_BLOCK_UNINIT);
-		
+
 		newref->dirty = true;
 	}
-	
+
 	if (ext4_block_group_has_flag(newref->block_group,
 	    EXT4_BLOCK_GROUP_INODE_UNINIT)) {
@@ -605,8 +605,8 @@
 			return rc;
 		}
-		
+
 		ext4_block_group_clear_flag(newref->block_group,
 		    EXT4_BLOCK_GROUP_INODE_UNINIT);
-		
+
 		if (!ext4_block_group_has_flag(newref->block_group,
 		    EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
@@ -614,12 +614,12 @@
 			if (rc != EOK)
 				return rc;
-			
+
 			ext4_block_group_set_flag(newref->block_group,
 			    EXT4_BLOCK_GROUP_ITABLE_ZEROED);
 		}
-		
+
 		newref->dirty = true;
 	}
-	
+
 	return EOK;
 }
@@ -645,22 +645,22 @@
 		void *base = bg;
 		void *checksum = &bg->checksum;
-		
+
 		uint32_t offset = (uint32_t) (checksum - base);
-		
+
 		/* Convert block group index to little endian */
 		uint32_t le_group = host2uint32_t_le(bgid);
-		
+
 		/* Initialization */
 		crc = crc16_ibm(~0, sb->uuid, sizeof(sb->uuid));
-		
+
 		/* Include index of block group */
 		crc = crc16_ibm(crc, (uint8_t *) &le_group, sizeof(le_group));
-		
+
 		/* Compute crc from the first part (stop before checksum field) */
 		crc = crc16_ibm(crc, (uint8_t *) bg, offset);
-		
+
 		/* Skip checksum */
 		offset += sizeof(bg->checksum);
-		
+
 		/* Checksum of the rest of block group descriptor */
 		if ((ext4_superblock_has_feature_incompatible(sb,
@@ -670,5 +670,5 @@
 			    ext4_superblock_get_desc_size(sb) - offset);
 	}
-	
+
 	return crc;
 }
@@ -813,13 +813,13 @@
 		    ref->block_group);
 		ext4_block_group_set_checksum(ref->block_group, checksum);
-		
+
 		/* Mark block dirty for writing changes to physical device */
 		ref->block->dirty = true;
 	}
-	
+
 	/* Put back block, that contains block group descriptor */
 	errno_t rc = block_put(ref->block);
 	free(ref);
-	
+
 	return rc;
 }
@@ -842,9 +842,9 @@
 	if (newref == NULL)
 		return ENOMEM;
-	
+
 	/* Compute number of i-nodes, that fits in one data block */
 	uint32_t inodes_per_group =
 	    ext4_superblock_get_inodes_per_group(fs->superblock);
-	
+
 	/*
 	 * Inode numbers are 1-based, but it is simpler to work with 0-based
@@ -854,5 +854,5 @@
 	uint32_t block_group = index / inodes_per_group;
 	uint32_t offset_in_group = index % inodes_per_group;
-	
+
 	/* Load block group, where i-node is located */
 	ext4_block_group_ref_t *bg_ref;
@@ -862,10 +862,10 @@
 		return rc;
 	}
-	
+
 	/* Load block address, where i-node table is located */
 	uint32_t inode_table_start =
 	    ext4_block_group_get_inode_table_first_block(bg_ref->block_group,
 	    fs->superblock);
-	
+
 	/* Put back block group reference (not needed more) */
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
@@ -874,10 +874,10 @@
 		return rc;
 	}
-	
+
 	/* Compute position of i-node in the block group */
 	uint16_t inode_size = ext4_superblock_get_inode_size(fs->superblock);
 	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
 	uint32_t byte_offset_in_group = offset_in_group * inode_size;
-	
+
 	/* Compute block address */
 	aoff64_t block_id = inode_table_start + (byte_offset_in_group / block_size);
@@ -887,16 +887,16 @@
 		return rc;
 	}
-	
+
 	/* Compute position of i-node in the data block */
 	uint32_t offset_in_block = byte_offset_in_group % block_size;
 	newref->inode = newref->block->data + offset_in_block;
-	
+
 	/* We need to store the original value of index in the reference */
 	newref->index = index + 1;
 	newref->fs = fs;
 	newref->dirty = false;
-	
+
 	*ref = newref;
-	
+
 	return EOK;
 }
@@ -916,9 +916,9 @@
 		ref->block->dirty = true;
 	}
-	
+
 	/* Put back block, that contains i-node */
 	errno_t rc = block_put(ref->block);
 	free(ref);
-	
+
 	return rc;
 }
@@ -940,5 +940,5 @@
 	if (flags & L_DIRECTORY)
 		is_dir = true;
-	
+
 	/* Allocate inode by allocation algorithm */
 	uint32_t index;
@@ -946,5 +946,5 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	/* Load i-node from on-disk i-node table */
 	rc = ext4_filesystem_get_inode_ref(fs, index, inode_ref);
@@ -953,8 +953,8 @@
 		return rc;
 	}
-	
+
 	/* Initialize i-node */
 	ext4_inode_t *inode = (*inode_ref)->inode;
-	
+
 	uint16_t mode;
 	if (is_dir) {
@@ -963,5 +963,5 @@
 		 * 0777 (octal) == rwxrwxrwx
 		 */
-		
+
 		mode = 0777;
 		mode |= EXT4_INODE_MODE_DIRECTORY;
@@ -973,5 +973,5 @@
 		 * 0666 (octal) == rw-rw-rw-
 		 */
-		
+
 		mode = 0666;
 		mode |= EXT4_INODE_MODE_FILE;
@@ -979,5 +979,5 @@
 		ext4_inode_set_links_count(inode, 0);
 	}
-	
+
 	ext4_inode_set_uid(inode, 0);
 	ext4_inode_set_gid(inode, 0);
@@ -990,14 +990,14 @@
 	ext4_inode_set_flags(inode, 0);
 	ext4_inode_set_generation(inode, 0);
-	
+
 	/* Reset blocks array */
 	for (uint32_t i = 0; i < EXT4_INODE_BLOCKS; i++)
 		inode->blocks[i] = 0;
-	
+
 	/* Initialize extents if needed */
 	if (ext4_superblock_has_feature_incompatible(
 	    fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
 		ext4_inode_set_flag(inode, EXT4_INODE_FLAG_EXTENTS);
-		
+
 		/* Initialize extent root header */
 		ext4_extent_header_t *header = ext4_inode_get_extent_header(inode);
@@ -1006,13 +1006,13 @@
 		ext4_extent_header_set_generation(header, 0);
 		ext4_extent_header_set_magic(header, EXT4_EXTENT_MAGIC);
-		
+
 		uint16_t max_entries = (EXT4_INODE_BLOCKS * sizeof(uint32_t) -
 		    sizeof(ext4_extent_header_t)) / sizeof(ext4_extent_t);
-		
+
 		ext4_extent_header_set_max_entries_count(header, max_entries);
 	}
-	
+
 	(*inode_ref)->dirty = true;
-	
+
 	return EOK;
 }
@@ -1028,5 +1028,5 @@
 {
 	ext4_filesystem_t *fs = inode_ref->fs;
-	
+
 	/* For extents must be data block destroyed by other way */
 	if ((ext4_superblock_has_feature_incompatible(fs->superblock,
@@ -1036,7 +1036,7 @@
 		goto finish;
 	}
-	
+
 	/* Release all indirect (no data) blocks */
-	
+
 	/* 1) Single indirect */
 	uint32_t fblock = ext4_inode_get_indirect_block(inode_ref->inode, 0);
@@ -1045,12 +1045,12 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		ext4_inode_set_indirect_block(inode_ref->inode, 0, 0);
 	}
-	
+
 	block_t *block;
 	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
 	uint32_t count = block_size / sizeof(uint32_t);
-	
+
 	/* 2) Double indirect */
 	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 1);
@@ -1059,9 +1059,9 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		uint32_t ind_block;
 		for (uint32_t offset = 0; offset < count; ++offset) {
 			ind_block = uint32_t_le2host(((uint32_t *) block->data)[offset]);
-			
+
 			if (ind_block != 0) {
 				rc = ext4_balloc_free_block(inode_ref, ind_block);
@@ -1072,5 +1072,5 @@
 			}
 		}
-		
+
 		rc = block_put(block);
 		if (rc != EOK)
@@ -1080,8 +1080,8 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		ext4_inode_set_indirect_block(inode_ref->inode, 1, 0);
 	}
-	
+
 	/* 3) Tripple indirect */
 	block_t *subblock;
@@ -1091,9 +1091,9 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		uint32_t ind_block;
 		for (uint32_t offset = 0; offset < count; ++offset) {
 			ind_block = uint32_t_le2host(((uint32_t *) block->data)[offset]);
-			
+
 			if (ind_block != 0) {
 				rc = block_get(&subblock, fs->device, ind_block,
@@ -1103,5 +1103,5 @@
 					return rc;
 				}
-				
+
 				uint32_t ind_subblock;
 				for (uint32_t suboffset = 0; suboffset < count;
@@ -1109,5 +1109,5 @@
 					ind_subblock = uint32_t_le2host(((uint32_t *)
 					    subblock->data)[suboffset]);
-					
+
 					if (ind_subblock != 0) {
 						rc = ext4_balloc_free_block(inode_ref, ind_subblock);
@@ -1119,5 +1119,5 @@
 					}
 				}
-				
+
 				rc = block_put(subblock);
 				if (rc != EOK) {
@@ -1126,5 +1126,5 @@
 				}
 			}
-			
+
 			rc = ext4_balloc_free_block(inode_ref, ind_block);
 			if (rc != EOK) {
@@ -1133,5 +1133,5 @@
 			}
 		}
-		
+
 		rc = block_put(block);
 		if (rc != EOK)
@@ -1141,12 +1141,12 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		ext4_inode_set_indirect_block(inode_ref->inode, 2, 0);
 	}
-	
+
 finish:
 	/* Mark inode dirty for writing to the physical device */
 	inode_ref->dirty = true;
-	
+
 	/* Free block with extended attributes if present */
 	uint32_t xattr_block = ext4_inode_get_file_acl(
@@ -1156,8 +1156,8 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		ext4_inode_set_file_acl(inode_ref->inode, fs->superblock, 0);
 	}
-	
+
 	/* Free inode by allocator */
 	errno_t rc;
@@ -1167,5 +1167,5 @@
 	else
 		rc = ext4_ialloc_free_inode(fs, inode_ref->index, false);
-	
+
 	return rc;
 }
@@ -1183,18 +1183,18 @@
 {
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
-	
+
 	/* Check flags, if i-node can be truncated */
 	if (!ext4_inode_can_truncate(sb, inode_ref->inode))
 		return EINVAL;
-	
+
 	/* If sizes are equal, nothing has to be done. */
 	aoff64_t old_size = ext4_inode_get_size(sb, inode_ref->inode);
 	if (old_size == new_size)
 		return EOK;
-	
+
 	/* It's not suppported to make the larger file by truncate operation */
 	if (old_size < new_size)
 		return EINVAL;
-	
+
 	/* Compute how many blocks will be released */
 	aoff64_t size_diff = old_size - new_size;
@@ -1203,9 +1203,9 @@
 	if (size_diff % block_size != 0)
 		diff_blocks_count++;
-	
+
 	uint32_t old_blocks_count = old_size / block_size;
 	if (old_size % block_size != 0)
 		old_blocks_count++;
-	
+
 	if ((ext4_superblock_has_feature_incompatible(inode_ref->fs->superblock,
 	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
@@ -1218,5 +1218,5 @@
 	} else {
 		/* Release data blocks from the end of file */
-		
+
 		/* Starting from 1 because of logical blocks are numbered from 0 */
 		for (uint32_t i = 1; i <= diff_blocks_count; ++i) {
@@ -1227,9 +1227,9 @@
 		}
 	}
-	
+
 	/* Update i-node */
 	ext4_inode_set_size(inode_ref->inode, new_size);
 	inode_ref->dirty = true;
-	
+
 	return EOK;
 }
@@ -1248,5 +1248,5 @@
 {
 	ext4_filesystem_t *fs = inode_ref->fs;
-	
+
 	/* For empty file is situation simple */
 	if (ext4_inode_get_size(fs->superblock, inode_ref->inode) == 0) {
@@ -1254,7 +1254,7 @@
 		return EOK;
 	}
-	
+
 	uint32_t current_block;
-	
+
 	/* Handle i-node using extents */
 	if ((ext4_superblock_has_feature_incompatible(fs->superblock,
@@ -1264,11 +1264,11 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		*fblock = current_block;
 		return EOK;
 	}
-	
+
 	ext4_inode_t *inode = inode_ref->inode;
-	
+
 	/* Direct block are read directly from array in i-node structure */
 	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
@@ -1277,5 +1277,5 @@
 		return EOK;
 	}
-	
+
 	/* Determine indirection level of the target block */
 	unsigned int level = 0;
@@ -1286,8 +1286,8 @@
 		}
 	}
-	
+
 	if (level == 0)
 		return EIO;
-	
+
 	/* Compute offsets for the topmost level */
 	aoff64_t block_offset_in_level =
@@ -1296,5 +1296,5 @@
 	uint32_t offset_in_block =
 	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-	
+
 	/* Sparse file */
 	if (current_block == 0) {
@@ -1302,7 +1302,7 @@
 		return EOK;
 	}
-	
+
 	block_t *block;
-	
+
 	/*
 	 * Navigate through other levels, until we find the block number
@@ -1314,14 +1314,14 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		/* Read block address from indirect block */
 		current_block =
 		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
-		
+
 		/* Put back indirect block untouched */
 		rc = block_put(block);
 		if (rc != EOK)
 			return rc;
-		
+
 		/* Check for sparse file */
 		if (current_block == 0) {
@@ -1329,12 +1329,12 @@
 			return EOK;
 		}
-		
+
 		/* Jump to the next level */
 		level--;
-		
+
 		/* Termination condition - we have address of data block loaded */
 		if (level == 0)
 			break;
-		
+
 		/* Visit the next level */
 		block_offset_in_level %= fs->inode_blocks_per_level[level];
@@ -1342,7 +1342,7 @@
 		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
 	}
-	
+
 	*fblock = current_block;
-	
+
 	return EOK;
 }
@@ -1361,5 +1361,5 @@
 {
 	ext4_filesystem_t *fs = inode_ref->fs;
-	
+
 	/* Handle inode using extents */
 	if ((ext4_superblock_has_feature_compatible(fs->superblock,
@@ -1369,13 +1369,13 @@
 		return ENOTSUP;
 	}
-	
+
 	/* Handle simple case when we are dealing with direct reference */
 	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
 		ext4_inode_set_direct_block(inode_ref->inode, (uint32_t) iblock, fblock);
 		inode_ref->dirty = true;
-		
+
 		return EOK;
 	}
-	
+
 	/* Determine the indirection level needed to get the desired block */
 	unsigned int level = 0;
@@ -1386,10 +1386,10 @@
 		}
 	}
-	
+
 	if (level == 0)
 		return EIO;
-	
+
 	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
-	
+
 	/* Compute offsets for the topmost level */
 	aoff64_t block_offset_in_level =
@@ -1399,9 +1399,9 @@
 	uint32_t offset_in_block =
 	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-	
+
 	uint32_t new_block_addr;
 	block_t *block;
 	block_t *new_block;
-	
+
 	/* Is needed to allocate indirect block on the i-node level */
 	if (current_block == 0) {
@@ -1410,10 +1410,10 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		/* Update i-node */
 		ext4_inode_set_indirect_block(inode_ref->inode, level - 1,
 		    new_block_addr);
 		inode_ref->dirty = true;
-		
+
 		/* Load newly allocated block */
 		rc = block_get(&new_block, fs->device, new_block_addr,
@@ -1423,17 +1423,17 @@
 			return rc;
 		}
-		
+
 		/* Initialize new block */
 		memset(new_block->data, 0, block_size);
 		new_block->dirty = true;
-		
+
 		/* Put back the allocated block */
 		rc = block_put(new_block);
 		if (rc != EOK)
 			return rc;
-		
+
 		current_block = new_block_addr;
 	}
-	
+
 	/*
 	 * Navigate through other levels, until we find the block number
@@ -1444,8 +1444,8 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		current_block =
 		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
-		
+
 		if ((level > 1) && (current_block == 0)) {
 			/* Allocate new block */
@@ -1455,5 +1455,5 @@
 				return rc;
 			}
-			
+
 			/* Load newly allocated block */
 			rc = block_get(&new_block, fs->device, new_block_addr,
@@ -1463,9 +1463,9 @@
 				return rc;
 			}
-			
+
 			/* Initialize allocated block */
 			memset(new_block->data, 0, block_size);
 			new_block->dirty = true;
-			
+
 			rc = block_put(new_block);
 			if (rc != EOK) {
@@ -1473,5 +1473,5 @@
 				return rc;
 			}
-			
+
 			/* Write block address to the parent */
 			((uint32_t *) block->data)[offset_in_block] =
@@ -1480,5 +1480,5 @@
 			current_block = new_block_addr;
 		}
-		
+
 		/* Will be finished, write the fblock address */
 		if (level == 1) {
@@ -1487,11 +1487,11 @@
 			block->dirty = true;
 		}
-		
+
 		rc = block_put(block);
 		if (rc != EOK)
 			return rc;
-		
+
 		level--;
-		
+
 		/*
 		 * If we are on the last level, break here as
@@ -1500,5 +1500,5 @@
 		if (level == 0)
 			break;
-		
+
 		/* Visit the next level */
 		block_offset_in_level %= fs->inode_blocks_per_level[level];
@@ -1506,5 +1506,5 @@
 		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
 	}
-	
+
 	return EOK;
 }
@@ -1522,26 +1522,26 @@
 {
 	uint32_t fblock;
-	
+
 	ext4_filesystem_t *fs = inode_ref->fs;
-	
+
 	/* Extents are handled otherwise = there is not support in this function */
 	assert(!(ext4_superblock_has_feature_incompatible(fs->superblock,
 	    EXT4_FEATURE_INCOMPAT_EXTENTS) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))));
-	
+
 	ext4_inode_t *inode = inode_ref->inode;
-	
+
 	/* Handle simple case when we are dealing with direct reference */
 	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
 		fblock = ext4_inode_get_direct_block(inode, iblock);
-		
+
 		/* Sparse file */
 		if (fblock == 0)
 			return EOK;
-		
+
 		ext4_inode_set_direct_block(inode, iblock, 0);
 		return ext4_balloc_free_block(inode_ref, fblock);
 	}
-	
+
 	/* Determine the indirection level needed to get the desired block */
 	unsigned int level = 0;
@@ -1552,8 +1552,8 @@
 		}
 	}
-	
+
 	if (level == 0)
 		return EIO;
-	
+
 	/* Compute offsets for the topmost level */
 	aoff64_t block_offset_in_level =
@@ -1563,5 +1563,5 @@
 	uint32_t offset_in_block =
 	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-	
+
 	/*
 	 * Navigate through other levels, until we find the block number
@@ -1570,16 +1570,16 @@
 	block_t *block;
 	while (level > 0) {
-		
+
 		/* Sparse check */
 		if (current_block == 0)
 			return EOK;
-		
+
 		errno_t rc = block_get(&block, fs->device, current_block, 0);
 		if (rc != EOK)
 			return rc;
-		
+
 		current_block =
 		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
-		
+
 		/* Set zero if physical data block address found */
 		if (level == 1) {
@@ -1588,11 +1588,11 @@
 			block->dirty = true;
 		}
-		
+
 		rc = block_put(block);
 		if (rc != EOK)
 			return rc;
-		
+
 		level--;
-		
+
 		/*
 		 * If we are on the last level, break here as
@@ -1601,5 +1601,5 @@
 		if (level == 0)
 			break;
-		
+
 		/* Visit the next level */
 		block_offset_in_level %= fs->inode_blocks_per_level[level];
@@ -1607,9 +1607,9 @@
 		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
 	}
-	
+
 	fblock = current_block;
 	if (fblock == 0)
 		return EOK;
-	
+
 	/* Physical block is not referenced, it can be released */
 	return ext4_balloc_free_block(inode_ref, fblock);
@@ -1633,18 +1633,18 @@
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)))
 		return ext4_extent_append_block(inode_ref, iblock, fblock, true);
-	
+
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
-	
+
 	/* Compute next block index and allocate data block */
 	uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	
+
 	/* Align size i-node size */
 	if ((inode_size % block_size) != 0)
 		inode_size += block_size - (inode_size % block_size);
-	
+
 	/* Logical blocks are numbered from 0 */
 	uint32_t new_block_idx = inode_size / block_size;
-	
+
 	/* Allocate new physical block */
 	uint32_t phys_block;
@@ -1652,5 +1652,5 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	/* Add physical block address to the i-node */
 	rc = ext4_filesystem_set_inode_data_block_index(inode_ref,
@@ -1660,12 +1660,12 @@
 		return rc;
 	}
-	
+
 	/* Update i-node */
 	ext4_inode_set_size(inode_ref->inode, inode_size + block_size);
 	inode_ref->dirty = true;
-	
+
 	*fblock = phys_block;
 	*iblock = new_block_idx;
-	
+
 	return EOK;
 }
