Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision c6aca755b65757a1896cad57817e83b4b16237ab)
+++ uspace/srv/fs/fat/fat_ops.c	(revision b85c19a1309177a4189e260ffc97c146054a6e0d)
@@ -391,5 +391,5 @@
 			/* hit */
 			fat_node_t *nodep;
-			aoff64_t o = (di.pos-1) % (BPS(di.bs) / sizeof(fat_dentry_t));
+			aoff64_t o = di.pos % (BPS(di.bs) / sizeof(fat_dentry_t));
 			fat_idx_t *idx = fat_idx_get_by_pos(devmap_handle,
 				parentp->firstc, di.bnum * DPS(di.bs) + o);
@@ -413,4 +413,8 @@
 				(void) fat_node_put(*rfn);
 			return rc;
+		} else {
+			rc = fat_directory_next(&di);
+			if (rc != EOK)
+				break;
 		}
 	}
@@ -757,7 +761,4 @@
 	fat_node_t *parentp = FAT_NODE(pfn);
 	fat_node_t *childp = FAT_NODE(cfn);
-	fat_bs_t *bs;
-	fat_dentry_t *d;
-	block_t *b;
 	bool has_children;
 	int rc;
@@ -776,17 +777,16 @@
 	assert(childp->lnkcnt == 1);
 	fibril_mutex_lock(&childp->idx->lock);
-	bs = block_bb_get(childp->idx->devmap_handle);
-
-	rc = _fat_block_get(&b, bs, childp->idx->devmap_handle, childp->idx->pfc,
-	    NULL, (childp->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
-	    BLOCK_FLAGS_NONE);
+	
+	fat_directory_t di;
+	rc = fat_directory_open(parentp,&di);
 	if (rc != EOK)
 		goto error;
-	d = (fat_dentry_t *)b->data +
-	    (childp->idx->pdi % (BPS(bs) / sizeof(fat_dentry_t)));
-	/* mark the dentry as not-currently-used */
-	d->name[0] = FAT_DENTRY_ERASED;
-	b->dirty = true;		/* need to sync block */
-	rc = block_put(b);
+	rc = fat_directory_seek(&di, childp->idx->pdi);
+	if (rc != EOK)
+		goto error;
+	rc = fat_directory_erase(&di);
+	if (rc != EOK)
+		goto error;
+	rc = fat_directory_close(&di);
 	if (rc != EOK)
 		goto error;
@@ -807,7 +807,8 @@
 
 error:
-	fibril_mutex_unlock(&parentp->idx->lock);
+	(void) fat_directory_close(&di);
+	fibril_mutex_unlock(&childp->idx->lock);
 	fibril_mutex_unlock(&childp->lock);
-	fibril_mutex_unlock(&childp->idx->lock);
+	fibril_mutex_unlock(&parentp->lock);
 	return rc;
 }
@@ -1232,5 +1233,5 @@
 			goto err;
 		(void) async_data_read_finalize(callid, name, str_size(name) + 1);
-		bytes = (pos - spos);
+		bytes = (pos - spos)+1;
 	}
 
