Index: uspace/srv/fs/ext2fs/ext2fs_ops.c
===================================================================
--- uspace/srv/fs/ext2fs/ext2fs_ops.c	(revision b72efe87f3e33beaa3b0d0cf7c8b598a58f6a6de)
+++ uspace/srv/fs/ext2fs/ext2fs_ops.c	(revision eccd20e6a5014c7d48ea641625b8f4e6c0a5e031)
@@ -240,5 +240,5 @@
 	}
 	
-	rc = ext2_directory_iterator_init(&it, fs, eparent->inode_ref);
+	rc = ext2_directory_iterator_init(&it, fs, eparent->inode_ref, 0);
 	if (rc != EOK) {
 		return rc;
@@ -478,5 +478,5 @@
 	}
 	
-	rc = ext2_directory_iterator_init(&it, fs, enode->inode_ref);
+	rc = ext2_directory_iterator_init(&it, fs, enode->inode_ref, 0);
 	if (rc != EOK) {
 		EXT2FS_DBG("error %u", rc);
@@ -818,5 +818,5 @@
 {
 	ext2_directory_iterator_t it;
-	aoff64_t cur;
+	aoff64_t next;
 	uint8_t *buf;
 	size_t name_size;
@@ -824,5 +824,5 @@
 	bool found = false;
 	
-	rc = ext2_directory_iterator_init(&it, inst->filesystem, inode_ref);
+	rc = ext2_directory_iterator_init(&it, inst->filesystem, inode_ref, pos);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -831,11 +831,8 @@
 	}
 	
-	/* Find the index we want to read
-	 * Note that we need to iterate and count as
-	 * the underlying structure is a linked list
-	 * Moreover, we want to skip . and .. entries
+	/* Find next interesting directory entry.
+	 * We want to skip . and .. entries
 	 * as these are not used in HelenOS
 	 */
-	cur = 0;
 	while (it.current != NULL) {
 		if (it.current->inode == 0) {
@@ -851,25 +848,21 @@
 		}
 		
-		/* Is this the dir entry we want to read? */
-		if (cur == pos) {
-			/* The on-disk entry does not contain \0 at the end
-			 * end of entry name, so we copy it to new buffer
-			 * and add the \0 at the end
-			 */
-			buf = malloc(name_size+1);
-			if (buf == NULL) {
-				ext2_directory_iterator_fini(&it);
-				async_answer_0(callid, ENOMEM);
-				async_answer_0(rid, ENOMEM);
-				return;
-			}
-			memcpy(buf, &it.current->name, name_size);
-			*(buf+name_size) = 0;
-			found = true;
-			(void) async_data_read_finalize(callid, buf, name_size+1);
-			free(buf);
-			break;
-		}
-		cur++;
+		/* The on-disk entry does not contain \0 at the end
+			* end of entry name, so we copy it to new buffer
+			* and add the \0 at the end
+			*/
+		buf = malloc(name_size+1);
+		if (buf == NULL) {
+			ext2_directory_iterator_fini(&it);
+			async_answer_0(callid, ENOMEM);
+			async_answer_0(rid, ENOMEM);
+			return;
+		}
+		memcpy(buf, &it.current->name, name_size);
+		*(buf+name_size) = 0;
+		found = true;
+		(void) async_data_read_finalize(callid, buf, name_size+1);
+		free(buf);
+		break;
 		
 skip:
@@ -883,4 +876,13 @@
 	}
 	
+	if (found) {
+		rc = ext2_directory_iterator_next(&it);
+		if (rc != EOK) {
+			async_answer_0(rid, rc);
+			return;
+		}
+		next = it.current_offset;
+	}
+	
 	rc = ext2_directory_iterator_fini(&it);
 	if (rc != EOK) {
@@ -890,5 +892,5 @@
 	
 	if (found) {
-		async_answer_1(rid, EOK, 1);
+		async_answer_1(rid, EOK, next-pos);
 	}
 	else {
