Index: uspace/lib/ext4/src/balloc.c
===================================================================
--- uspace/lib/ext4/src/balloc.c	(revision b7fd2a02e4161f4edd38548e7f8456b8021549be)
+++ uspace/lib/ext4/src/balloc.c	(revision a35b458e9db1ca95e679799dc7c1b12c83359ca3)
@@ -57,10 +57,10 @@
 	ext4_filesystem_t *fs = inode_ref->fs;
 	ext4_superblock_t *sb = fs->superblock;
-	
+
 	/* Compute indexes */
 	uint32_t block_group = ext4_filesystem_blockaddr2group(sb, block_addr);
 	uint32_t index_in_group =
 	    ext4_filesystem_blockaddr2_index_in_group(sb, block_addr);
-	
+
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
@@ -68,5 +68,5 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	/* Load block with bitmap */
 	uint32_t bitmap_block_addr =
@@ -78,9 +78,9 @@
 		return rc;
 	}
-	
+
 	/* Modify bitmap */
 	ext4_bitmap_free_bit(bitmap_block->data, index_in_group);
 	bitmap_block->dirty = true;
-	
+
 	/* Release block with bitmap */
 	rc = block_put(bitmap_block);
@@ -90,7 +90,7 @@
 		return rc;
 	}
-	
+
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	
+
 	/* Update superblock free blocks count */
 	uint32_t sb_free_blocks =
@@ -98,5 +98,5 @@
 	sb_free_blocks++;
 	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-	
+
 	/* Update inode blocks count */
 	uint64_t ino_blocks =
@@ -105,5 +105,5 @@
 	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
 	inode_ref->dirty = true;
-	
+
 	/* Update block group free blocks count */
 	uint32_t free_blocks =
@@ -113,5 +113,5 @@
 	    sb, free_blocks);
 	bg_ref->dirty = true;
-	
+
 	/* Release block group reference */
 	return ext4_filesystem_put_block_group_ref(bg_ref);
@@ -346,5 +346,5 @@
 {
 	uint32_t allocated_block = 0;
-	
+
 	uint32_t bitmap_block_addr;
 	block_t *bitmap_block;
@@ -352,5 +352,5 @@
 	uint32_t free_blocks;
 	uint32_t goal;
-	
+
 	/* Find GOAL */
 	errno_t rc = ext4_balloc_find_goal(inode_ref, &goal);
@@ -359,10 +359,10 @@
 
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
-	
+
 	/* Load block group number for goal and relative index */
 	uint32_t block_group = ext4_filesystem_blockaddr2group(sb, goal);
 	uint32_t index_in_group =
 	    ext4_filesystem_blockaddr2_index_in_group(sb, goal);
-	
+
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
@@ -378,19 +378,19 @@
 		goto goal_failed;
 	}
-	
+
 	/* Compute indexes */
 	uint32_t first_in_group =
 	    ext4_balloc_get_first_data_block_in_group(sb, bg_ref);
-	
+
 	uint32_t first_in_group_index =
 	    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
-	
+
 	if (index_in_group < first_in_group_index)
 		index_in_group = first_in_group_index;
-	
+
 	/* Load block with bitmap */
 	bitmap_block_addr =
 	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
-	
+
 	rc = block_get(&bitmap_block, inode_ref->fs->device,
 	    bitmap_block_addr, BLOCK_FLAGS_NONE);
@@ -399,5 +399,5 @@
 		return rc;
 	}
-	
+
 	/* Check if goal is free */
 	if (ext4_bitmap_is_free_bit(bitmap_block->data, index_in_group)) {
@@ -409,19 +409,19 @@
 			return rc;
 		}
-		
+
 		allocated_block =
 		    ext4_filesystem_index_in_group2blockaddr(sb, index_in_group,
 		    block_group);
-		
+
 		goto success;
 	}
-	
+
 	uint32_t blocks_in_group =
 	    ext4_superblock_get_blocks_in_group(sb, block_group);
-	
+
 	uint32_t end_idx = (index_in_group + 63) & ~63;
 	if (end_idx > blocks_in_group)
 		end_idx = blocks_in_group;
-	
+
 	/* Try to find free block near to goal */
 	for (uint32_t tmp_idx = index_in_group + 1; tmp_idx < end_idx;
@@ -433,13 +433,13 @@
 			if (rc != EOK)
 				return rc;
-			
+
 			allocated_block =
 			    ext4_filesystem_index_in_group2blockaddr(sb, tmp_idx,
 			    block_group);
-			
+
 			goto success;
 		}
 	}
-	
+
 	/* Find free BYTE in bitmap */
 	rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
@@ -450,12 +450,12 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		allocated_block =
 		    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
 		    block_group);
-		
+
 		goto success;
 	}
-	
+
 	/* Find free bit in bitmap */
 	rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
@@ -466,12 +466,12 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		allocated_block =
 		    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
 		    block_group);
-		
+
 		goto success;
 	}
-	
+
 	/* No free block found yet */
 	rc = block_put(bitmap_block);
@@ -486,11 +486,11 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	/* Try other block groups */
 	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-	
+
 	uint32_t bgid = (block_group + 1) % block_group_count;
 	uint32_t count = block_group_count;
-	
+
 	while (count > 0) {
 		rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, bgid,
@@ -509,5 +509,5 @@
 		bitmap_block_addr =
 		    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
-		
+
 		rc = block_get(&bitmap_block, inode_ref->fs->device,
 		    bitmap_block_addr, 0);
@@ -516,5 +516,5 @@
 			return rc;
 		}
-		
+
 		/* Compute indexes */
 		first_in_group =
@@ -523,11 +523,11 @@
 		    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
 		blocks_in_group = ext4_superblock_get_blocks_in_group(sb, bgid);
-		
+
 		first_in_group_index =
 		    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
-		
+
 		if (index_in_group < first_in_group_index)
 			index_in_group = first_in_group_index;
-		
+
 		/* Try to find free byte in bitmap */
 		rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
@@ -540,12 +540,12 @@
 				return rc;
 			}
-			
+
 			allocated_block =
 			    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
 			    bgid);
-			
+
 			goto success;
 		}
-		
+
 		/* Try to find free bit in bitmap */
 		rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
@@ -558,12 +558,12 @@
 				return rc;
 			}
-			
+
 			allocated_block =
 			    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
 			    bgid);
-			
+
 			goto success;
 		}
-		
+
 		rc = block_put(bitmap_block);
 		if (rc != EOK) {
@@ -576,23 +576,23 @@
 		if (rc != EOK)
 			return rc;
-		
+
 		/* Goto next group */
 		bgid = (bgid + 1) % block_group_count;
 		count--;
 	}
-	
+
 	return ENOSPC;
-	
+
 success:
 	/* Empty command - because of syntax */
 	;
-	
+
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	
+
 	/* Update superblock free blocks count */
 	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
 	sb_free_blocks--;
 	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-	
+
 	/* Update inode blocks (different block size!) count */
 	uint64_t ino_blocks =
@@ -601,5 +601,5 @@
 	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
 	inode_ref->dirty = true;
-	
+
 	/* Update block group free blocks count */
 	uint32_t bg_free_blocks =
@@ -609,7 +609,7 @@
 	    bg_free_blocks);
 	bg_ref->dirty = true;
-	
+
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	
+
 	*fblock = allocated_block;
 	return rc;
@@ -629,13 +629,13 @@
 {
 	errno_t rc;
-	
+
 	ext4_filesystem_t *fs = inode_ref->fs;
 	ext4_superblock_t *sb = fs->superblock;
-	
+
 	/* Compute indexes */
 	uint32_t block_group = ext4_filesystem_blockaddr2group(sb, fblock);
 	uint32_t index_in_group =
 	    ext4_filesystem_blockaddr2_index_in_group(sb, fblock);
-	
+
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
@@ -643,5 +643,5 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	/* Load block with bitmap */
 	uint32_t bitmap_block_addr =
@@ -653,8 +653,8 @@
 		return rc;
 	}
-	
+
 	/* Check if block is free */
 	*free = ext4_bitmap_is_free_bit(bitmap_block->data, index_in_group);
-	
+
 	/* Allocate block if possible */
 	if (*free) {
@@ -662,5 +662,5 @@
 		bitmap_block->dirty = true;
 	}
-	
+
 	/* Release block with bitmap */
 	rc = block_put(bitmap_block);
@@ -670,16 +670,16 @@
 		return rc;
 	}
-	
+
 	/* If block is not free, return */
 	if (!(*free))
 		goto terminate;
-	
+
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	
+
 	/* Update superblock free blocks count */
 	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
 	sb_free_blocks--;
 	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-	
+
 	/* Update inode blocks count */
 	uint64_t ino_blocks =
@@ -688,5 +688,5 @@
 	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
 	inode_ref->dirty = true;
-	
+
 	/* Update block group free blocks count */
 	uint32_t free_blocks =
@@ -696,5 +696,5 @@
 	    sb, free_blocks);
 	bg_ref->dirty = true;
-	
+
 terminate:
 	return ext4_filesystem_put_block_group_ref(bg_ref);
