Index: uspace/srv/fs/ext4fs/ext4fs_ops.c
===================================================================
--- uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision 052e82dfac59bea7c0d7db91b59a859e54aedf73)
+++ uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision 12b4a7f3cd0106fa01c156269c7f25c868a33bbf)
@@ -954,7 +954,11 @@
 	fs = enode->instance->filesystem;
 
+
+	if (! ext4_inode_can_truncate(inode_ref->inode)) {
+		// Unable to truncate
+		return EINVAL;
+	}
+
 	old_size = ext4_inode_get_size(fs->superblock, inode_ref->inode);
-
-	printf("old size = \%llu, new size = \%llu\n", old_size, new_size);
 
 	if (old_size == new_size) {
@@ -962,5 +966,4 @@
 	} else {
 
-		//int rc;
 		uint32_t block_size;
 		uint32_t blocks_count, total_blocks;
@@ -970,10 +973,9 @@
 
 		if (old_size < new_size) {
-			// TODO don't return immediately
-			EXT4FS_DBG("expand the file");
+			// Currently not supported to expand the file
+			// TODO
+			EXT4FS_DBG("trying to expand the file");
 			return EINVAL;
 		}
-
-		EXT4FS_DBG("cut the end of the file !");
 
 		size_diff = old_size - new_size;
@@ -990,6 +992,9 @@
 		inode_ref->dirty = true;
 
-		for (i = 0; i< blocks_count; ++i) {
+		// starting from 1 because of logical blocks are numbered from 0
+		for (i = 1; i <= blocks_count; ++i) {
 			// TODO check retval
+			// TODO decrement inode->blocks_count
+
 			ext4_filesystem_release_inode_block(fs, inode_ref, total_blocks - i);
 		}
